Live data from Hacker News

Using Go Modules

blog.golang.org

121–124 of 124 posts

Re: Using Go Modules

#121
post #103
post #29

Earlier quoted context omitted.

You can put your project in ~/work/my-go-project but then symlink it to ~/go/src/github.com/joshklien/my-go-project (assuming your $GOPATH is ~/go). But yes, with modules you don't need to do this anymore. go mod init github.com/joshklien/my-go-project

Where in your gopath are you supposed to put your source code if you never intend to upload it? All gopath tutorials I see say to put your github in the path like you did, and never say what to do if its not public.

If your project isn't intended to be uploaded (or is, but isn't intended to be consumed by other go projects as a go module), then you can make the project name whatever you want as far as I know.

Re: Using Go Modules

#122
post #119

Earlier quoted context omitted.

we should form a club or something. we’ll call it the gopher 8th light seekers and drink sparkling water + bitch about go while the rest invent the future. in go :)

hah. What kind of future are you talking about? :P It still seems that Java and C# and python are dominant in their respective areas, and golang being relegated to devops stuff, those guys can deal with all the shortcomings of the language because they don't know better, but at least it's not infiltrating other areas. Ironic that the golang authors wrote it as a C++ replacement and it completely flopped there, just s…

the “future”. the one with flying cars and strong AI and aliens. where everything compiles instantly and we laugh at peasants that worry about dependency management and sanity.

Re: Using Go Modules

#123

Google API's latest semantic version is behind the doc site (godoc.org/google.golang.org/api). Is this standard practice in Go? I was coincidentally converting my Go project to use Go modules yesterday. I depended on a Google API which was originally retrieved via 'Go get', corresponded to docs and worked fine as this pulled from HEAD. `go mod` did not work out of the box, as it required the latest semantic version (…

Ah. The trick is to substitute in the go.mod file's require block.: s/$SEMANTIC_VERSION_BRANCH/$BRANCH In this case, $BRANCH == 'master'. 'go build' will resolve 'master' to a specific commit hash version.

you can also `go get google.golang.org/api@master`
Post reply on HN