Go 1.16 Beta 1 - Clarification regarding module

95 views
Skip to first unread message

Amit Saha

unread,
Dec 18, 2020, 7:41:33 AM12/18/20
to golang-nuts
Hi all,

The release notes has this:

Module-aware mode is enabled by default, regardless of whether a go.mod file is present in the current working directory or a parent directory. More precisely, the GO111MODULE environment variable now defaults to on. To switch to the previous behavior, set GO111MODULE to auto.

I didn’t quite understand what that meant but I think I understand it now that we always have to initialise a module before we can build a package? So, before I could just create a main.go and happily build my program. But now I have to run `go mod init <module name>` before I can build it?

$ ~/go/bin/go1.16beta1 build
go: cannot find main module; see 'go help modules’

Thanks,
Amit

Reply all
Reply to author
Forward
0 new messages