gopl.io
gopl.io copied to clipboard
Add go.mod for go module support
Thanks, but is this necessary? All the commands in the book such as go get gopl.io/...
should work just fine without a go.mod file, and since the book predates and therefore doesn't explain go.mod files, I think it might be confusing to include it.
I think it would be helpful to have an Addendum to the book (at least on Github) which explains how to deal with new additions like modules, language server in VS Code, etc. For example, I started with instructions on the site (https://golang.org/doc/tutorial/getting-started and https://golang.org/doc/code.html) and then continued with the book. I was a bit confused and it took me a while to set my environment properly. BTW, I found this PR by googling "gopl.io modules" :-)
@alandonovan
Is it possible to add go.mod
for this material?
Now Module mode is the default and go tools got picky about the lack of go.mod. gopls also gets confused how to scope the module boundary without it. (see https://github.com/golang/vscode-go/issues/1613)
Many new Go users depend on this book. I believe adding go.mod
will reduce the unnecessary distraction and improve the first impression on the language and the tools.
cc @stamblerre @ianthehat
1ae3ec64947b7a5331b186f1b1138fc98c0f1c06 added go.mod