Gelio / go-global-update

A command to update globally installed go executables
MIT License
147 stars 4 forks source link

could not introspect binary #27

Closed devashishRaj closed 1 month ago

devashishRaj commented 1 month ago

go version : go1.23.0 darwin/arm64

> go-global-update --dry-run
could not introspect binary actionlint: could not get latest version of github.com/rhysd/actionlint: exit status 1
could not introspect binary air: could not get latest version of github.com/air-verse/air: exit status 1
could not introspect binary asmfmt: could not get latest version of github.com/klauspost/asmfmt: exit status 1
could not introspect binary dlv: could not get latest version of github.com/go-delve/delve: exit status 1
could not introspect binary errcheck: could not get latest version of github.com/kisielk/errcheck: exit status 1
could not introspect binary fillstruct: could not get latest version of github.com/davidrjenni/reftools: exit status 1
could not introspect binary go-global-update: could not get latest version of github.com/Gelio/go-global-update: exit status 1
could not introspect binary go-outline: could not get latest version of github.com/ramya-rao-a/go-outline: exit status 1
could not introspect binary godef: could not get latest version of github.com/rogpeppe/godef: exit status 1
could not introspect binary goimportcycle: could not get latest version of github.com/samlitowitz/goimportcycle: exit status 1
could not introspect binary goimports: could not get latest version of golang.org/x/tools: exit status 1
could not introspect binary golangci-lint: could not get latest version of github.com/golangci/golangci-lint: exit status 1
could not introspect binary golint: could not get latest version of golang.org/x/lint: exit status 1
could not introspect binary gomodifytags: could not get latest version of github.com/fatih/gomodifytags: exit status 1
could not introspect binary gopls: could not get latest version of golang.org/x/tools/gopls: exit status 1
could not introspect binary gorename: could not get latest version of golang.org/x/tools: exit status 1
could not introspect binary gotags: could not get latest version of github.com/jstemmer/gotags: exit status 1
could not introspect binary gotestdox: could not get latest version of github.com/bitfield/gotestdox: exit status 1
could not introspect binary guru: could not get latest version of golang.org/x/tools: exit status 1
could not introspect binary iferr: could not get latest version of github.com/koron/iferr: exit status 1
could not introspect binary impl: could not get latest version of github.com/josharian/impl: exit status 1
could not introspect binary keyify: could not get latest version of honnef.co/go/tools: exit status 1
could not introspect binary ko: could not get latest version of github.com/google/ko: exit status 1
could not introspect binary motion: could not get latest version of github.com/fatih/motion: exit status 1
could not introspect binary revive: could not get latest version of github.com/mgechev/revive: exit status 1
could not introspect binary scc: could not get latest version of github.com/boyter/scc/v3: exit status 1
could not introspect binary staticcheck: could not get latest version of honnef.co/go/tools: exit status 1
could not introspect binary swag: could not get latest version of github.com/swaggo/swag: exit status 1
could not introspect binary task: could not get latest version of github.com/go-task/task/v3: exit status 1
could not introspect binary tomlv: could not get latest version of github.com/BurntSushi/toml: exit status 1

go is installed via brew

❯ brew config
HOMEBREW_VERSION: 4.3.16
ORIGIN: https://github.com/Homebrew/brew
HEAD: f930795c36aea910a39866a131374b4b237cdc58
Last commit: 24 hours ago
Core tap JSON: 17 Aug 07:26 UTC
Core cask tap JSON: 17 Aug 07:26 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_DISPLAY: /private/tmp/com.apple.launchd.zmmZ5WqiYz/org.xquartz:0
HOMEBREW_MAKE_JOBS: 10
Homebrew Ruby: 3.3.4 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/bin/ruby
CPU: 10-core 64-bit arm_blizzard_avalanche
Clang: 15.0.0 build 1500
Git: 2.46.0 => /opt/homebrew/bin/git
Curl: 8.7.1 => /usr/bin/curl
macOS: 14.6.1-arm64
CLT: 15.3.0.0.1.1708646388
Xcode: 15.4
Rosetta 2: false
Gelio commented 1 month ago

Hey there, thanks for the bug report!

I cannot reproduce it locally - running go-global-update --dry-run works for me.

Could you help me discover the root problem of this error?

I would appreciate it if you ran the following command and told me the output:

go list -m -f "{{.Version}}" github.com/BurntSushi/toml@latest

For me, it prints v1.4.0, which seems to be correct given https://github.com/BurntSushi/toml/releases

devashishRaj commented 1 month ago

same

> go list -m -f "{{.Version}}" github.com/BurntSushi/toml@latest
v1.4.0
Gelio commented 1 month ago

That's awkward. The logs in the initial message say that this command failed previously when ran by go-global-update.

could not introspect binary tomlv: could not get latest version of github.com/BurntSushi/toml: exit status 1

Does the problem still persist when you run go-global-update --dry-run? If you still see the same errors (exit status 1), then please run go list -m -f "{{.Version}}" github.com/BurntSushi/toml@latest again, and then echo ?! to also capture the last exit code so we can see if it was 1 (as when run inside go-global-update) or 0.

devashishRaj commented 1 month ago
❯ go-global-update --dry-run
could not introspect binary actionlint: could not get latest version of github.com/rhysd/actionlint: exit status 1
could not introspect binary air: could not get latest version of github.com/air-verse/air: exit status 1
could not introspect binary asmfmt: could not get latest version of github.com/klauspost/asmfmt: exit status 1
could not introspect binary dlv: could not get latest version of github.com/go-delve/delve: exit status 1
could not introspect binary errcheck: could not get latest version of github.com/kisielk/errcheck: exit status 1
could not introspect binary fillstruct: could not get latest version of github.com/davidrjenni/reftools: exit status 1
could not introspect binary go-global-update: could not get latest version of github.com/Gelio/go-global-update: exit status 1
could not introspect binary go-outline: could not get latest version of github.com/ramya-rao-a/go-outline: exit status 1
could not introspect binary godef: could not get latest version of github.com/rogpeppe/godef: exit status 1
could not introspect binary goimportcycle: could not get latest version of github.com/samlitowitz/goimportcycle: exit status 1
could not introspect binary goimports: could not get latest version of golang.org/x/tools: exit status 1
could not introspect binary golangci-lint: could not get latest version of github.com/golangci/golangci-lint: exit status 1
could not introspect binary golint: could not get latest version of golang.org/x/lint: exit status 1
could not introspect binary gomodifytags: could not get latest version of github.com/fatih/gomodifytags: exit status 1
could not introspect binary gopls: could not get latest version of golang.org/x/tools/gopls: exit status 1
could not introspect binary gorename: could not get latest version of golang.org/x/tools: exit status 1
could not introspect binary gotags: could not get latest version of github.com/jstemmer/gotags: exit status 1
could not introspect binary gotestdox: could not get latest version of github.com/bitfield/gotestdox: exit status 1
could not introspect binary guru: could not get latest version of golang.org/x/tools: exit status 1
could not introspect binary iferr: could not get latest version of github.com/koron/iferr: exit status 1
could not introspect binary impl: could not get latest version of github.com/josharian/impl: exit status 1
could not introspect binary keyify: could not get latest version of honnef.co/go/tools: exit status 1
could not introspect binary ko: could not get latest version of github.com/google/ko: exit status 1
could not introspect binary motion: could not get latest version of github.com/fatih/motion: exit status 1
could not introspect binary revive: could not get latest version of github.com/mgechev/revive: exit status 1
could not introspect binary scc: could not get latest version of github.com/boyter/scc/v3: exit status 1
could not introspect binary staticcheck: could not get latest version of honnef.co/go/tools: exit status 1
could not introspect binary swag: could not get latest version of github.com/swaggo/swag: exit status 1
could not introspect binary task: could not get latest version of github.com/go-task/task/v3: exit status 1
could not introspect binary tomlv: could not get latest version of github.com/BurntSushi/toml: exit status 1
Binary      Current version      Status
ais         (devel)              cannot upgrade
❯ go list -m -f "{{.Version}}" github.com/BurntSushi/toml@latest
v1.4.0
❯ echo ?!
zsh: no matches found: ?!
❯ echo $!
82420
❯ echo $!
82420
❯ echo $?
0

ignore ais one

Gelio commented 1 month ago

Looks like I made a mistake. It should have been echo $? directly after go list -m -f "{{.Version}}" github.com/BurntSushi/toml@latest to report the status code of that go list command. Could you rerun that again?

Also, can you include the output of go version?

devashishRaj commented 1 month ago
> go list -m -f "{{.Version}}" github.com/BurntSushi/toml@latest echo $?
go: list -m cannot be used with GO111MODULE=off

i tried go env -w GO111MODULE=auto but same error , it is set to auto

❯ go env | grep "GO111MODULE"
GO111MODULE='auto'
❯ go version
go version go1.23.0 darwin/arm64
devashishRaj commented 1 month ago

oh it's go list , ran it inside a package using that toml lib

❯ go list -m -f "{{.Version}}" github.com/BurntSushi/toml@latest
v1.4.0
❯ echo $?
0
Gelio commented 1 month ago

Thanks for that information. That's really weird, since if you run the command yourself, it works just fine, but when go-global-update runs the same command, it fails with exit code 1 😕

I am using the same go version myself and I don't have any problems with this tool.

Can you run go-global-update --dry-run --debug and paste the output?

It will be large, so you can do that with just a single binary, like go-global-update --dry-run --debug actionlint

Output I got on my machine ``` at 09:50:55 ❯ go-global-update --dry-run --debug gotop 2024-08-22T09:51:24.953+0200 DEBUG gocli/cmd_runner.go:28 go command output {"args": ["env", "GOBIN"], "output": "\n"} 2024-08-22T09:51:24.967+0200 DEBUG gocli/cmd_runner.go:28 go command output {"args": ["env", "GOPATH"], "output": "/Users/grzegorz.rozdzialik/go\n"} 2024-08-22T09:51:24.967+0200 DEBUG updater/updater.go:46 found GOBIN path {"GOBIN": "/Users/grzegorz.rozdzialik/go/bin"} 2024-08-22T09:51:24.980+0200 DEBUG gocli/cmd_runner.go:28 go command output {"args": ["version", "-m", "/Users/grzegorz.rozdzialik/go/bin/gotop"], "output": "/Users/grzegorz.rozdzialik/go/bin/gotop: go1.22.4\n\tpath\tgithub.com/xxxserxxx/gotop/v4/cmd/gotop\n\tmod\tgithub.com/xxxserxxx/gotop/v4\tv4.2.0\th1:M6fiSCx666qEVuKOYrHjvsLm+eq7jKpWLe0joJYQoAY=\n\tdep\tgithub.com/BurntSushi/toml\tv1.1.0\th1:ksErzDEI1khOiGPgpwuI7x2ebx/uXQNw7xJpn9Eq1+I=\n\tdep\tgithub.com/VictoriaMetrics/metrics\tv1.18.1\th1:OZ0+kTTto8oPfHnVAnTOoyl0XlRhRkoQrD2n2cOuRw0=\n\tdep\tgithub.com/VividCortex/ewma\tv1.2.0\th1:f58SaIzcDXrSy3kWaHNvuJgJ3Nmz59Zji6XoJR/q1ow=\n\tdep\tgithub.com/anatol/smart.go\tv0.0.0-20220917195147-c0b00d90f8cc\th1:UH+K+oojIu7jWqJrmPXCb33A/ZIfCLBIorj3KQGJxgs=\n\tdep\tgithub.com/cloudfoundry-attic/jibber_jabber\tv0.0.0-20151120183258-bcc4c8345a21\th1:Yg2hDs4b13Evkpj42FU2idX2cVXVFqQSheXYKM86Qsk=\n\tdep\tgithub.com/distatus/battery\tv0.10.0\th1:YbizvmV33mqqC1fPCAEaQGV3bBhfYOfM+2XmL+mvt5o=\n\tdep\tgithub.com/droundy/goopt\tv0.0.0-20220217183150-48d6390ad4d1\th1:6PKU05V7zJIJlTBq7AnEIrLVEUIYF4NjTU2a28Ho6ko=\n\tdep\tgithub.com/ghodss/yaml\tv1.0.0\th1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=\n\tdep\tgithub.com/gizak/termui/v3\tv3.1.0\th1:ZZmVDgwHl7gR7elfKf1xc4IudXZ5qqfDh4wExk4Iajc=\n\tdep\tgithub.com/jaypipes/ghw\tv0.9.0\th1:TWF4wNIGtZcgDJaiNcFgby5BR8s2ixcUe0ydxNO2McY=\n\tdep\tgithub.com/jaypipes/pcidb\tv1.0.0\th1:vtZIfkiCUE42oYbJS0TAq9XSfSmcsgo9IdxSm9qzYU8=\n\tdep\tgithub.com/mattn/go-runewidth\tv0.0.13\th1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU=\n\tdep\tgithub.com/mitchellh/go-homedir\tv1.1.0\th1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=\n\tdep\tgithub.com/mitchellh/go-wordwrap\tv1.0.1\th1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0=\n\tdep\tgithub.com/nsf/termbox-go\tv1.1.1\th1:nksUPLCb73Q++DwbYUBEglYBRPZyoXJdrj5L+TkjyZY=\n\tdep\tgithub.com/pkg/errors\tv0.9.1\th1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=\n\tdep\tgithub.com/rivo/uniseg\tv0.2.0\th1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=\n\tdep\tgithub.com/shibukawa/configdir\tv0.0.0-20170330084843-e180dbdc8da0\th1:Xuk8ma/ibJ1fOy4Ee11vHhUFHQNpHhrBneOCNHVXS5w=\n\tdep\tgithub.com/shirou/gopsutil\tv3.20.12+incompatible\th1:6VEGkOXP/eP4o2Ilk8cSsX0PhOEfX6leqAnD+urrp9M=\n\tdep\tgithub.com/valyala/fastrand\tv1.1.0\th1:f+5HkLW4rsgzdNoleUOB69hyT9IlD2ZQh9GyDMfb5G8=\n\tdep\tgithub.com/valyala/histogram\tv1.2.0\th1:wyYGAZZt3CpwUiIb9AU/Zbllg1llXyrtApRS815OLoQ=\n\tdep\tgithub.com/xxxserxxx/lingo/v2\tv2.0.1\th1:6uLLKzPqL0XpdFmNMmpSfu+uIzQk344ebfdpFWbGuxs=\n\tdep\tgolang.org/x/sys\tv0.0.0-20220915200043-7b5979e65e41\th1:ohgcoMbSofXygzo6AD2I1kz3BFmW1QArPYTtwEM3UXc=\n\tdep\tgopkg.in/yaml.v2\tv2.4.0\th1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=\n\tdep\thowett.net/plist\tv1.0.0\th1:7CrbWYbPPO/PyNy38b2EB/+gYbjCe2DXBxgtOOZbSQM=\n\tbuild\t-buildmode=exe\n\tbuild\t-compiler=gc\n\tbuild\tDefaultGODEBUG=httplaxcontentlength=1,httpmuxgo121=1,panicnil=1,tls10server=1,tlsrsakex=1,tlsunsafeekm=1\n\tbuild\tCGO_ENABLED=1\n\tbuild\tCGO_CFLAGS=\n\tbuild\tCGO_CPPFLAGS=\n\tbuild\tCGO_CXXFLAGS=\n\tbuild\tCGO_LDFLAGS=\n\tbuild\tGOARCH=arm64\n\tbuild\tGOOS=darwin\n"} 2024-08-22T09:51:25.259+0200 DEBUG gocli/cmd_runner.go:28 go command output {"args": ["list", "-m", "-f", "{{.Version}}", "github.com/xxxserxxx/gotop/v4@latest"], "output": "v4.2.0\n"} 2024-08-22T09:51:25.259+0200 DEBUG gobinaries/introspecter.go:53 introspected binary gotop: {ModuleURL:github.com/xxxserxxx/gotop/v4 PathURL:github.com/xxxserxxx/gotop/v4/cmd/gotop Name:gotop Path:/Users/grzegorz.rozdzialik/go/bin/gotop Version:v4.2.0 LatestVersion:v4.2.0} Binary Current version Status gotop v4.2.0 up-to-date ```
devashishRaj commented 1 month ago
❯ go-global-update --dry-run --debug actionlint
2024-08-22T19:55:14.818+0530    DEBUG   gocli/cmd_runner.go:28  go command output       {"args": ["env", "GOBIN"], "output": "/Users/xyz/go/bin\n"}
2024-08-22T19:55:14.818+0530    DEBUG   updater/updater.go:46   found GOBIN path        {"GOBIN": "/Users/xyz/go/bin"}
2024-08-22T19:55:14.829+0530    DEBUG   gocli/cmd_runner.go:28  go command output       {"args": ["version", "-m", "/Users/xyz/go/bin/actionlint"], "output": "/Users/xyz/go/bin/actionlint: go1.22.5\n\tpath\tgithub.com/rhysd/actionlint/cmd/actionlint\n\tmod\tgithub.com/rhysd/actionlint\tv1.7.1\th1:WJaDzyT1StBWVKGSsZPYnbV0HF9Y9/vD6KFdZQL42qE=\n\tdep\tgithub.com/fatih/color\tv1.17.0\th1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4=\n\tdep\tgithub.com/mattn/go-colorable\tv0.1.13\th1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=\n\tdep\tgithub.com/mattn/go-isatty\tv0.0.20\th1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=\n\tdep\tgithub.com/mattn/go-runewidth\tv0.0.15\th1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=\n\tdep\tgithub.com/rivo/uniseg\tv0.4.7\th1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=\n\tdep\tgithub.com/robfig/cron/v3\tv3.0.1\th1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=\n\tdep\tgolang.org/x/sync\tv0.7.0\th1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=\n\tdep\tgolang.org/x/sys\tv0.20.0\th1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=\n\tdep\tgopkg.in/yaml.v3\tv3.0.1\th1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=\n\tbuild\t-buildmode=exe\n\tbuild\t-compiler=gc\n\tbuild\tDefaultGODEBUG=httplaxcontentlength=1,httpmuxgo121=1,netedns0=0,panicnil=1,tls10server=1,tlsrsakex=1,tlsunsafeekm=1\n\tbuild\tCGO_ENABLED=1\n\tbuild\tCGO_CFLAGS=\n\tbuild\tCGO_CPPFLAGS=\n\tbuild\tCGO_CXXFLAGS=\n\tbuild\tCGO_LDFLAGS=\n\tbuild\tGOARCH=arm64\n\tbuild\tGOOS=darwin\n"}
2024-08-22T19:55:14.835+0530    DEBUG   gocli/cmd_runner.go:28  go command output       {"args": ["list", "-m", "-f", "{{.Version}}", "github.com/rhysd/actionlint@latest"], "output": "go: list -m cannot be used with GO111MODULE=off\n", "error": "exit status 1"}
could not introspect binary actionlint: could not get latest version of github.com/rhysd/actionlint: exit status 1
Binary      Current version      Status
Gelio commented 1 month ago
2024-08-22T19:55:14.835+0530    DEBUG   gocli/cmd_runner.go:28  go command output       {"args": ["list", "-m", "-f", "{{.Version}}", "github.com/rhysd/actionlint@latest"], "output": "go: list -m cannot be used with GO111MODULE=off\n", "error": "exit status 1"}

"output": "go: list -m cannot be used with GO111MODULE=off\n", "error": "exit status 1"

Looks like this is the culprit. I have no clue why there is GO111MODULE=off for you. I presume this is something related to your system configuration. You also mentioned similar problems in https://github.com/Gelio/go-global-update/issues/27#issuecomment-2303947877 and then solved it in https://github.com/Gelio/go-global-update/issues/27#issuecomment-2303955097.

I don't know how I can help further

devashishRaj commented 1 month ago

i tried : go env -w GO111MODULE=on and it worked . it won't work with GO111MODULE=auto (https://go.dev/ref/mod#mod-commands)

Gelio commented 1 month ago

Thanks for sharing the fix, I appreciate it 👍