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.
Re:Using Go Modules
by chrisbroadfoot on Monday March 25, 2019 @01:21AM
(#19480456)
you can also `go get google.golang.org/api@master`
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 (v.0.2.0) of my this Google API import. This version, however, is behind documentation and broke my code.
I understand I can require a specific commit in the go.mod file, but the strings for specific commit seem cryptic. Where can I look up the version hash that matches the doc site?