I was attempting to test changes in a branch of a vendored dependency on a private repository. Having never done this before using go modules, I found the docs (https://golang.org/cmd/go/#hdr-Add_dependencies_to_current_module_and_install_them) which indicated I should go get the associated repo and have the default version overridden by adding an @version suffix to the package argument, as in 'go get email@example.com'.
I assumed from there that I should add the branch as the checkout point. This resulted in the error below, indicating the version string was disallowed. Our company namespaces our github branches before doing the proper branch name. For us, slashes in the branch name are a common workflow. We occasionally also use multiple sub-namespaces for organisation.
Upon further research, I found a docs issue (#30851), and an associated issue (#36902). After commenting on the final issue, I opened this one.
A workaround at this time is to git log the sha of the HEAD of the namespaced branch and then go get using that sha. EG: go get github.com/org/repo@sha
An ideal configuration would download new commits upon a subsequent go get, which the sha checkout would not.
What did you expect to see?
go get github.com/org/repo@namespace/branch downloading and checking out that go module at that branch sha.
What did you see instead?
go get github.com/org/repo@namespace/branch: github.com/org/repo@namespace/branch: invalid version: version "branch" invalid: disallowed version string
The text was updated successfully, but these errors were encountered: