I have 2 projects with go.mod in root directory.
One is https://github.com/Gohryt/Impossible.go
Next one is something that require impossible in go.mod
I made simple commit with renaming a pair of variables.
My second module needs in this variables and I renamed it there too.
But I didn't find any command like go mod update, only go mod tidy and I can't use new names of variables. I tried tidy, but it made nothing. In some guides from internet i found that i should rename version in go mod and then tidy should work, but it has name like v0.0.0-20210101010359-ec9f21b49366 and i really can't guess what is new name like.
Is there any normal way to update module or i should use old version of dependency every time after first usage?
I tried name version with latest, but go mod tidy did nothing again.
If module A requires module B, and your program requires both... You will want to make sure module A requires the correct version of module B. Here's some things I end up doing often to keep everything synchronized how I want it.
To upgrade modules, first enter the repository...
upgrade all modules:
go get -v -u ./...
upgrade a certain module to latest commit:
go get -v -u github.com/user/repo@master
upgrade a certain module to a certain branch:
go get -v -u github.com/user/repo@develop
and then type this at the end:
go mod tidy
commit the changes to your repo, and consider a new tag.
git commit -v -a
git tag v0.0.2
git push origin branch --tags
Then, back to your program repository.. and do the same steps, but make sure your imported modules say the right tags when you run that -v -u command.
And make sure that your go.sum, go.mod files doesn't have extra stuff from old modules.
More info here https://blog.golang.org/publishing-go-modules.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With