golang
golang copied to clipboard
Cannot install a package at a certain tag
:ghost: Brief Description
when I specify a package @ a tag, it complains " go: cannot use path@version syntax in GOPATH mode"
:pancakes: Cookbook version
v3.0.1
:woman_cook: Chef-Infra Version
13.10.0
:tophat: Platform details
ubuntu 18.04
Steps To Reproduce
Steps to reproduce the behavior:
- put something like 'github.com/etsy/hound/cmds/[email protected]' into node.default['golang']['packages']
- run the cookbook.
:police_car: Expected behavior
get, build, install the binary
:heavy_plus_sign: Additional context
Add any other context about the problem here. e.g. related issues or existing pull requests.
@jeffbyrnes is working on a cleanup with the resource these attributes use in #78. Can you see if this problem still exists using that branch?
@ramereth Since there is no setting of GO111MODULE to 'on' I would tend to doubt it. I'll give it a shot when I have a moment.
@grimm26 we can certainly work out a way to include that. I have plans to refactor the cookbook further, and provide for Go modules (since they are how the Go community appears to have decided to move forward).
I’d certainly welcome a PR, too!
@grimm26 What problem are you trying to solve? Could you add some detail about what result you expect from something like export GO111MODULE=on go get gitHub.com/vendor/[email protected]? I get really weird results from trying to install a package at a specific tag that way. Do you have a set of commands that would do what you expect?
Thanks, Mark
@MarkGibbons The problem I am trying to solve is installing github.com/itpp-labs/hound/cmds/[email protected]' go package. I created a fork of this cookbook and added an additional option to the package custom resource that adds GO111MODULE set to on to the environment for the go get bash command. That makes it work.
09:10:49 ❯ go version
go version go1.14.5 darwin/amd64
09:12:16 ❯ go get 'github.com/itpp-labs/hound/cmds/[email protected]'
go: cannot use path@version syntax in GOPATH mode
09:12:24 ❯ GO111MODULE=on go get 'github.com/itpp-labs/hound/cmds/[email protected]'
go: downloading github.com/itpp-labs/hound v3.0.0+incompatible
go: found github.com/itpp-labs/hound/cmds/... in github.com/itpp-labs/hound v3.0.0+incompatible
Thanks.
So in that case it looks like you expect to see the source code loaded in go/pkg/mod/github.com/itpp-labs/[email protected]+incompatible. Seems doable. Making the resource idempotent is a bit of an issue.
Have you considered submitting your code as a PR?
I can submit a PR, but the work I have done in my fork refactored your custom resource, too.
We can get Mark’s work in #82 merged in, then build on that, and release both as v4.1.0 (since it should be non-breaking, with the attributes preserved).
@grimm26 now that #82 has been merged, do you think you could make a PR that fixes this issue?