gopl.io icon indicating copy to clipboard operation
gopl.io copied to clipboard

Add go.mod for go module support

Open b1ackmartian opened this issue 4 years ago • 4 comments

b1ackmartian avatar Jun 22 '20 08:06 b1ackmartian

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.

alandonovan avatar Jun 22 '20 13:06 alandonovan

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" :-)

pavelanni avatar Dec 26 '20 18:12 pavelanni

@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

hyangah avatar Jul 12 '21 14:07 hyangah

1ae3ec64947b7a5331b186f1b1138fc98c0f1c06 added go.mod

vdm avatar Feb 06 '22 10:02 vdm