I use gin-gonic for my rest API.
I have a problem with it.
The latest tag is v1.6.3 but in master branch there is a method that I want to use.
What do I put in the go.mod to use the master branch instead the latest tag?
Note:
CustomRecovery() method that available in the master branch but isn't present in v1.6.3Update:
Here is my go.mod
go 1.15
require (
github.com/gin-gonic/gin 16cd8cdd4ef9
)
but when I run go mod download it changes automatically to this
go 1.15
require (
github.com/gin-gonic/gin v1.6.3-0.20201025090830-16cd8cdd4ef9
github.com/joho/godotenv v1.3.0
gorm.io/driver/mysql v1.0.3
gorm.io/gorm v1.20.5
)
And it's working.
This should be possible by following the documentation "How to Upgrade and Downgrade Dependencies
A simple go get example.com/package is enough to modify the go.mod and use the latest version of a specific dependency.
To upgrade a dependency and all its dependencies to the latest version:
go get -u example.com/package
That is:
go get fooupdates to the latest version offoo.
go get foois equivalent togo get foo@latest— in other words,@latestis the default if no@version is specified.
And:
A common mistake is thinking
go get -u foosolely gets the latest version offoo.
In actuality, the-uingo get -u fooorgo get -u foo@latestmeans to also get the latest versions for all of the direct and indirect dependencies offoo.A common starting point when upgrading foo is instead to do
go get fooorgo get foo@latestwithout a-u(and after things are working, considergo get -u=patch foo,go get -u=patch,go get -u foo, orgo get -u).