go mod use latest version #1631
Comments
|
According to: you can add this to your
|
|
But I just tried it and couldn't get it to work, so please let us know if you find a working solution. |
|
@gmlewis i tried also. It does not work. |
@gmlewis In what way did it not work? A require directive should work to ensure the mentioned version (or a later version) is selected. Maybe you had a replace directive too? Those take higher precedence. If this issue isn't related to go-github, then some of the places listed in http://golang.org/wiki/Questions may help you get better answers. |
|
@dmitshur - I'm away from my machine until 9/30, and I don't remember the details now. When I return, I will try it out again and if it still fails, I'll share the details. Thanks for the confirmation. |
|
I apologize for the delay, but now I have investigated this once again... this time with Go version I started with this test case: diff --git a/example/newreposecret/go.mod b/example/newreposecret/go.mod
index 5d05d95..1fa359a 100644
--- a/example/newreposecret/go.mod
+++ b/example/newreposecret/go.mod
@@ -6,4 +6,5 @@ require (
github.com/GoKillers/libsodium-go v0.0.0-20171022220152-dd733721c3cb
github.com/google/go-github/v33 v33.0.0
golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43
+ gopkg.in/yaml.v2 v2.3.0
)With Go However, the moment I type
So it seems that this will work as long as you don't run One other odd thing I noticed is that when explicitly specifying a specific version, the
in addition to the existing line:
So I'm still a bit confused as to the behavior of I'll write a PR to update this example and then close this issue. |
|
Thanks for providing details @gmlewis. I'm able to reproduce the behavior you're seeing. My current understanding is that it's working as intended per https://golang.org/ref/mod#go-mod-tidy. The I agree the behavior seems surprising in this situation where there's a reason to upgrade that module requirement due to a security concern in the otherwise selected v2.2.2 version, and it might be worth filing a cmd/go issue about it. |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

Is there a way to force the latest version for dependencies.
e.g. my go.mod looks a bit like this:
replace( gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7 => gopkg.in/yaml.v2 v2.2.7 gopkg.in/yaml.v2 v2.0.0 => gopkg.in/yaml.v2 v2.2.7 gopkg.in/yaml.v2 v2.1.0 => gopkg.in/yaml.v2 v2.2.7 gopkg.in/yaml.v2 v2.2.0 => gopkg.in/yaml.v2 v2.2.7 gopkg.in/yaml.v2 v2.2.1 => gopkg.in/yaml.v2 v2.2.7 gopkg.in/yaml.v2 v2.2.2 => gopkg.in/yaml.v2 v2.2.7 gopkg.in/yaml.v2 v2.2.3 => gopkg.in/yaml.v2 v2.2.7 gopkg.in/yaml.v2 v2.2.4 => gopkg.in/yaml.v2 v2.2.7 gopkg.in/yaml.v2 v2.2.5 => gopkg.in/yaml.v2 v2.2.7 gopkg.in/yaml.v2 v2.2.6 => gopkg.in/yaml.v2 v2.2.7 )can i do something like:
replace ( gopkg.in/yaml.v2 v2.x.x => gopkg.in/yaml.v2 v2.2.7 )My usecase is to prevent security flaws such as a Billion Laughs Attack which is yaml.v2 is vulnerable to in <v.2.2.3
The text was updated successfully, but these errors were encountered: