Go modules are soon going to be the only future

December 20, 2020

One of the things that the Go project talked about in Eleven Years of Go, posted in November, is the plans for Go 1.16 and Go 1.17, and along with them the plans for Go modules. A short summary of all of that information is that Go modules are soon going to be our only option. This is said straight up in the article:

We will also finally wind down support for GOPATH-based development: any programs using dependencies other than the standard library will need a go.mod.

The current specifics are set out in the GOPATH wiki page. Go 1.16, expected in February 2021, will change the default to GO111MODULE=on (which requires go.mod even if you are under $GOPATH/src). Go 1.17 will entirely remove support for anything other than Go module mode. Given how the Go authors usually work, I expect this to remove the actual code that supports 'GOPATH development mode', not just remove access to it (for instance by removing checking $GO111MODULE and hard-wiring the value).

(It's possible that this timeline will turn out to be too aggressive and the Go authors will get enough pushback to postpone the removal past Go 1.17. The upgrade to Go 1.16 will be when people who are currently quietly working in GOPATH development mode will be forced to confront this, so this may uncover more people with more practical problems than expected.)

Given this aggressive timeline, I don't think there's any point in explicitly setting $GO111MODULE to 'auto' or 'off' (contrary to what I thought a year or so ago, which I admit that I didn't follow). If anything, you should set GO111MODULE=on now to buy yourself a bit of extra time to find any problems and figure out workarounds and new ways of working if you need them. I'm not going to go that far, but I'm lazy.

I have mixed feelings about the shift overall. I think Go modules are clearly better for development (including for enabling easy self-contained source code), but as someone who mostly consumes Go programs that I get with 'go get ...', it's probably going to make my life more complicated.

(I'd say that it'll make it harder for me to keep up with what programs have updated source code (cf), but in practice I no longer even look; I just do 'go get -u' on everything every so often.)

Written on 20 December 2020.
« On Go, release timing, and new machines
Who I think CentOS Stream is and isn't for »

Page tools: View Source, Add Comment.
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Sun Dec 20 00:52:36 2020
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.