oligot / go-mod-upgrade

Update outdated Go dependencies interactively
MIT License
954 stars 45 forks source link

not find any module could update in go worksapce #35

Closed DingYou closed 1 year ago

DingYou commented 1 year ago

There are two modules in a go workspace like this

image image

then run go-mod-upgrade, It always print "All modules are up to date"

image

I tried to find what's wrong. When I run go list -u -f '{{if (and (not (or .Main .Indirect)) .Update)}}{{.Path}}: {{.Version}} -> {{.Update.Version}}{{end}}' -m all, I found that the Indirect field is always true. It seems a bug in go list. I think we can change a way to pick out the indirect moudles. I forked this repo and tried to use go mod edit -json , it works well.

image

I am going to submit a PR later, please review it, thanks.

oligot commented 1 year ago

Hi,

Indeed, this is an issue. I've solved it a bit differently than your suggestion (in the PR #36). See commit a5815993e7c285a97510d040d90015e7cde1a436 The main idea is to disable Go workspace mode when running the "go list" command. I've tested it locally and it now works as expected.

Could you try on your side and tell me if it also works for you ?

Thanks !

DingYou commented 1 year ago

Hi,

Indeed, this is an issue. I've solved it a bit differently than your suggestion (in the PR #36). See commit a581599 The main idea is to disable Go workspace mode when running the "go list" command. I've tested it locally and it now works as expected.

Could you try on your side and tell me if it also works for you ?

Thanks !

Yeah, it works! Simple and useful, what a great solution!Thanks!