As I have begun learning Go (or golang as I needed to use for searching on the web), I’ve been running into some sort of chasm that the Go language seems to have crossed1 that my old textbook obviously could not have foreseen when it was published.2

The book asks me to do a go run . to get my file to compile and run.
Go seems to having none of it.

go: go.mod file not found in current directory or any parent directory; see 'go help modules'

Some searching on the web, and I found setting the GO111MODULE environment variable to auto or off will do the trick. So …

export GO111MODULE='auto'

did indeed do the trick.

I’m not putting this in my .bashrc to make it persistent though. The Go folks must have had some reason to make this change, which I’m (currently) not aware of. Was it architectural? Security related? That is a web search for another day.

Right now the code compiles and I must be off to my next exercise.


Feedback on this post? Mail me at feedback@janusworx.com

P.S. Subscribe to my mailing list!
Forward these posts and letters to your friends and get them to subscribe!
P.P.S. Feed my insatiable reading habit.



  1. I’m using v1.20.1 ↩︎

  2. I’m learning from Packt’s, The Go Workshop (Delio D’Anna et al), 2019 ↩︎