oligot / go-mod-upgrade

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

worked and then failed. Please try me steps to reproduce.... #16

Closed gedw99 closed 3 years ago

gedw99 commented 3 years ago

thanks for this great tool.

I ran it and it worked on this repo.

But then when i ran it again it failed, and i am eager to understand where the problem is so we can make this tool better.

steps to reproduce

Get the git repo and run it:

git clone ssh://git@github.com/blugelabs/beer-search -b master
cd beer-search && go run .
2021/08/15 10:43:02 Indexing...
2021/08/15 10:43:02 Listening on :8094
# open at: http://localhost:8094

Now do a go mod upgrade, selecting the github.com/blugelabs/bluge for upgrade.


cd beer-search && go get github.com/oligot/go-mod-upgrade
cd beer-search && go-mod-upgrade
   • Discovering modules...   
  ? Choose which modules to update  [Use arrows to move, space to select, <right> to all, <left> to none, type to filter]
> [x]  github.com/blugelabs/bluge 0.1.2 -> 0.1.7
  [ ]  github.com/gorilla/mux     1.7.4 -> 1.8.0

Updating github.com/blugelabs/bluge to version 0.1.7...

Now I run again and it works fine:

cd beer-search && go run .
2021/08/15 10:43:02 Indexing...
2021/08/15 10:43:02 Listening on :8094
# open at: http://localhost:8094

But now here is the bug, when i try to rerun the go mod upgrade again:

cd beer-search && go-mod-upgrade
   • Discovering modules...   
   ⨯ upgrade failed            error=Error running go command to discover modules: exit status 1 stderr=go list -m: loading module retractions for github.com/RoaringBitmap/real-roaring-datasets@v0.0.0-20190726190000-eb7c87156f76: no matching versions for query "latest"

exit status 1
gedw99 commented 3 years ago

I also did the exact same steps to repro, but instead upgraded github.com/gorilla/mux and it works fine, even when i run it again and again.

SO must be something to do with the github.com/blugelabs/bluge package...

Curious to know whats going on, and if it relates to https://github.com/oligot/go-mod-upgrade/issues/2

oligot commented 3 years ago

Hi,

This is a transitive dependency problem.

When updating github.com/blugelabs/bluge to version 0.1.7, we also update github.com/RoaringBitmap/roaring to version 0.9.1 (see commit https://github.com/blugelabs/bluge/commit/ac312c52ba3f0bd6475cfc2e3929a874c221880d#diff-33ef32bf6c23acb95f5902d7097b7a1d5128ca061167ec0716715b0b9eeaa5f6), which adds the (faulty) dependency to github.com/RoaringBitmap/real-roaring-datasets@v0.0.0-20190726190000-eb7c87156f76.

This has actually been removed recently (see commit https://github.com/RoaringBitmap/roaring/commit/e68bbda56edf220b9d320eb1fac4089502e608f0#diff-33ef32bf6c23acb95f5902d7097b7a1d5128ca061167ec0716715b0b9eeaa5f6). So, to solve the problem, we should first update github.com/RoaringBitmap/roaring to version 0.9.4 in github.com/blugelabs/bluge (via a pull request for example). Then, wait for github.com/RoaringBitmap/roaring to release a new version with this change (something like v0.1.8), and finally update to this version.

Hoping this helps.

gedw99 commented 3 years ago

thanks @oligot for digging into it.

that makes sense and what i figured was going on.

With go 1.17 they are changing the go .mod i read today in the release notes. https://golang.org/doc/go1.17#go-command "Prunes Module Graphs"

I have not tried it yet. It's going to change how transitive dependencies are modelled. Will be interesting to see how go-mod-upgrade is effected.

The idea of course is for the use case i hit to be sorted out so that the CLI tells you , hints what you need to do maybe. No tool is perfect so hinting to the user what to do might be a way to solve it ?

oligot commented 3 years ago

I didn't know about this new change in Go 1.17, thanks for the link!

I'll try to update to Go 1.17 soon, and see how this affect go-mod-upgrade.

oligot commented 3 years ago

I just tested with Go 1.17 and the problem disappear entirely :+1: Could you try it on your side and see if it also works for you ?

gedw99 commented 3 years ago

hey @oligot Yep i just tried it and it works :)

very nice to use... thanks for remembering to tell me...

also beer-search go.mod is on go 1.14, and still works, so will work on old repos too. YEAH :)

Will close this issue.. thanks again for this tool.