golang icon indicating copy to clipboard operation
golang copied to clipboard

Cannot install a package at a certain tag

Open grimm26 opened this issue 5 years ago • 9 comments

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

  1. put something like 'github.com/etsy/hound/cmds/[email protected]' into node.default['golang']['packages']
  2. 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.

grimm26 avatar Jul 09 '20 20:07 grimm26

@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 avatar Jul 09 '20 22:07 ramereth

@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 avatar Jul 10 '20 16:07 grimm26

@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!

jeffbyrnes avatar Jul 10 '20 18:07 jeffbyrnes

@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 avatar Jul 19 '20 23:07 MarkGibbons

@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

grimm26 avatar Jul 20 '20 14:07 grimm26

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?

MarkGibbons avatar Jul 20 '20 14:07 MarkGibbons

I can submit a PR, but the work I have done in my fork refactored your custom resource, too.

grimm26 avatar Jul 20 '20 14:07 grimm26

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).

jeffbyrnes avatar Jul 20 '20 20:07 jeffbyrnes

@grimm26 now that #82 has been merged, do you think you could make a PR that fixes this issue?

ramereth avatar Oct 03 '20 21:10 ramereth