Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bingo get fails complaining go1.18+ required which is already the case #125

Closed
unicell opened this issue Oct 13, 2022 · 7 comments · Fixed by #134
Closed

Bingo get fails complaining go1.18+ required which is already the case #125

unicell opened this issue Oct 13, 2022 · 7 comments · Fixed by #134
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@unicell
Copy link

unicell commented Oct 13, 2022

bingo version output:

v0.7

go version output:

go version go1.18.3 linux/amd64

What happened:

Failed to run bingo get for this particular go package.

$ bingo list
Name Binary Name Package @ Version Build EnvVars Build Flags
---- ----------- ----------------- ------------- -----------
$ bingo get github.com/hofstadter-io/hof/cmd/hof@v0.6.7-rc.2
Bingo not used before here, creating directory for pinned modules for you at .bingo
Error: get command failed: get: hof.mod: getting github.com/hofstadter-io/hof/cmd/hof@v0.6.7-rc.2: install: build versioned: # github.com/hofstadter-io/cinful
/mnt/gocode/pkg/mod/github.com/hofstadter-io/cinful@v1.0.0/cinful.go:25:11: undeclared name: any (requires version go1.18 or later)
/mnt/gocode/pkg/mod/github.com/hofstadter-io/cinful@v1.0.0/cinful.go:26:11: undeclared name: any (requires version go1.18 or later)
: exit 1

What you expected to happen:

Expecting bingo get to succeed, since:

go install works just fine

$  go install github.com/hofstadter-io/hof/cmd/hof@v0.6.7-rc.2

and the underlying go build command bingo runs also works fine.

$ cd .bingo/
$ ls .bingo/
README.md go.mod hof.tmp.mod hof.tmp.sum
$ GOWORK=off go build -mod=mod -modfile=hof.tmp.mod -o=./hof-v0.6.7-rc.2 "github.com/hofstadter-io/hof/cmd/hof"
$ ls
README.md go.mod hof-v0.6.7-rc.2 hof.tmp.mod hof.tmp.sum

How to reproduce it (as minimally and precisely as possible):

mkdir testdir; cd testdir
bingo get github.com/hofstadter-io/hof/cmd/hof@v0.6.7-rc.2

Logs (use bingo get -v <thing you do> for verbose output):

$  bingo get -v github.com/hofstadter-io/hof/cmd/hof@v0.6.7-rc.2
getting target github.com/hofstadter-io/hof/cmd/hof@v0.6.7-rc.2 (module  )
exec 'go mod init -modfile=/mnt/test/.bingo/hof-e.tmp.mod _'
exec 'go get -modfile=/mnt/test/.bingo/hof-e.tmp.mod -d github.com/hofstadter-io/hof/cmd/hof@v0.6.7-rc.2'
resolveInGoModCache: Found /mnt/gocode/pkg/mod/cache/download/github.com/hofstadter-io/hof/cmd/hof/@v directory
resolveInGoModCache: /mnt/gocode/pkg/mod/cache/download/github.com/hofstadter-io/hof/cmd/hof/@v/v0.6.7-rc.2.info file not exists. Looking for +incompatible info file
resolveInGoModCache: /mnt/gocode/pkg/mod/cache/download/github.com/hofstadter-io/hof/cmd/hof/@v/v0.6.7-rc.2+incompatible.info file not exists. Looking for different module
resolveInGoModCache: /mnt/gocode/pkg/mod/cache/download/github.com/hofstadter-io/hof/cmd/@v directory does not exists
resolveInGoModCache: Found /mnt/gocode/pkg/mod/cache/download/github.com/hofstadter-io/hof/@v directory
exec 'go env GOPATH'
exec 'go mod init -modfile=/mnt/test/.bingo/hof.tmp.mod _'
exec 'go list -modfile=/mnt/test/.bingo/hof.tmp.mod -mod=mod -f={{.Name}} github.com/hofstadter-io/hof/cmd/hof'
Error: get command failed
> main.main     /mnt/gocode/pkg/mod/github.com/bwplotka/bingo@v0.7.0/main.go:223
> runtime.main  /mnt/go/src/runtime/proc.go:250
> runtime.goexit        /mnt/go/src/runtime/asm_amd64.s:1571
get
> main.main.func2       /mnt/gocode/pkg/mod/github.com/bwplotka/bingo@v0.7.0/main.go:147
> main.main.func5       /mnt/gocode/pkg/mod/github.com/bwplotka/bingo@v0.7.0/main.go:215
> github.com/oklog/run.(*Group).Run.func1       /mnt/gocode/pkg/mod/github.com/oklog/run@v1.1.0/group.go:38
> runtime.goexit        /mnt/go/src/runtime/asm_amd64.s:1571
hof.mod: getting github.com/hofstadter-io/hof/cmd/hof@v0.6.7-rc.2
> main.get      /mnt/gocode/pkg/mod/github.com/bwplotka/bingo@v0.7.0/get.go:290
> main.main.func2       /mnt/gocode/pkg/mod/github.com/bwplotka/bingo@v0.7.0/main.go:146
> main.main.func5       /mnt/gocode/pkg/mod/github.com/bwplotka/bingo@v0.7.0/main.go:215
> github.com/oklog/run.(*Group).Run.func1       /mnt/gocode/pkg/mod/github.com/oklog/run@v1.1.0/group.go:38
> runtime.goexit        /mnt/go/src/runtime/asm_amd64.s:1571
install: build versioned: # github.com/hofstadter-io/cinful
/mnt/gocode/pkg/mod/github.com/hofstadter-io/cinful@v1.0.0/cinful.go:25:11: undeclared name: any (requires version go1.18 or later)
/mnt/gocode/pkg/mod/github.com/hofstadter-io/cinful@v1.0.0/cinful.go:26:11: undeclared name: any (requires version go1.18 or later)
: error while running command 'go build -modfile=/mnt/test/.bingo/hof.tmp.mod -o=/mnt/gocode/bin/hof-v0.6.7-rc.2 github.com/hofstadter-io/hof/cmd/hof'; err: exit status 2

Anything else we need to know:

@Red-GV
Copy link

Red-GV commented Oct 13, 2022

If you need a workaround for this, I've found that setting the go.mod file to go 1.16 allows tools to be pinned correctly.

@sevein
Copy link
Contributor

sevein commented Oct 22, 2022

Is this perhaps related to issue golang/go#54908 in Go?

@0xERR0R
Copy link

0xERR0R commented Nov 5, 2022

Am I getting this right: it is a bug in Go and it will be fixed in Go 1.20?

@martin-sucha
Copy link
Contributor

I see similar issue when installing golangci-lint, even with Go 1.20. I've opened golang/go#58388

@martin-sucha
Copy link
Contributor

It seems that the go list -mod=mod command does not update the mod/sum files like go mod tidy does. Bingo should perhaps do this instead:

  • Use per-tool directories under .bingo with go.mod/go.sum files and a dummy .go file importing the package.
  • Run go mod tidy and go build in that directory.

@bwplotka
Copy link
Owner

Thanks for this, I was just investigating this. Especially golang/go#58388 is super helpful 💪🏽

I assume the .sum is not up to date for our .mod? It's really annoying go mod tidy does not have modfile flag...

I think the best way would be to create tmp dir only to execute go mod tidy and remove after done... PRs welcome, otherwise I will do it later this week.

@bwplotka bwplotka added bug Something isn't working help wanted Extra attention is needed labels Feb 14, 2023
@bwplotka
Copy link
Owner

Closing dup: #128

bwplotka added a commit that referenced this issue Feb 19, 2023
Reason was that go list command no longer updates go.sum.

Fixes: #125

Signed-off-by: bwplotka <bwplotka@gmail.com>
bwplotka added a commit that referenced this issue Feb 19, 2023
Reason was that go list command no longer updates go.sum.

Fixes: #125

Signed-off-by: bwplotka <bwplotka@gmail.com>
bwplotka added a commit that referenced this issue Feb 19, 2023
…134)

Reason was that go list command no longer updates go.sum.

Fixes: #125

Signed-off-by: bwplotka <bwplotka@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants