dependabot-go_modules 0.160.1 → 0.162.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5deaca59df2d639ff53f08c49cb7552000e1f92619dcf3e6f84834c2956d1bf5
4
- data.tar.gz: 23e5966de5d891a356062b60a5d8e1f835df7b5674a0110f67d5601ede8e4645
3
+ metadata.gz: 8e3c6239526bd28a624f7afb5b64255811a199b3f4a9a6b8c84ad23ca08ef34f
4
+ data.tar.gz: 261b57bd8060fa89837d3b5d2585d5e8c3a1da58c70e591e0952b6211d3206a7
5
5
  SHA512:
6
- metadata.gz: fd1eebdf65c8b1241cb4bd84bb6d493026000d5af743fb521f2ee3108ddb5238f4bcb5524e5182bee77b2f55ca0557ee1d4b51360babf2e9b0d20eec259c011e
7
- data.tar.gz: 108bf74aa458b4f508a62b5ef47261d072ba2f50a4f9aad00bb756fc5b149e9fa859a3459eba1a0de1e3f17e1e898ec1e04f044e1bd8e590b7649ab3638eff5a
6
+ metadata.gz: 450ceb0c75ae7da96125ff6c8b4148b17716e37c174d5e30f7fa5f996ed90a05c5aa23d8f7ae9ff3fcc85f9dbfa373fca83da1a9c99ae8a3b4acfab3fd5a9f29
7
+ data.tar.gz: e1654d8aae5907d64a2d76b027de4d169e355714c570a5ffaa2363096b2972d4c2b25f069080f47538541f68c9c9b644660999a37112dd4542753b8ba8e7721b
data/helpers/go.mod CHANGED
@@ -4,6 +4,6 @@ go 1.16
4
4
 
5
5
  require (
6
6
  github.com/Masterminds/vcs v1.13.1
7
- github.com/dependabot/gomodules-extracted v1.4.1
7
+ github.com/dependabot/gomodules-extracted v1.4.2
8
8
  golang.org/x/mod v0.5.0
9
9
  )
data/helpers/go.sum CHANGED
@@ -1,7 +1,7 @@
1
1
  github.com/Masterminds/vcs v1.13.1 h1:NL3G1X7/7xduQtA2sJLpVpfHTNBALVNSjob6KEjPXNQ=
2
2
  github.com/Masterminds/vcs v1.13.1/go.mod h1:N09YCmOQr6RLxC6UNHzuVwAdodYbbnycGHSmwVJjcKA=
3
- github.com/dependabot/gomodules-extracted v1.4.1 h1:GbodKHQWk7P7whnNlM1DgphYibwEDHW320SMpLjjTl0=
4
- github.com/dependabot/gomodules-extracted v1.4.1/go.mod h1:cpzrmDX1COyhSDQXHfkRMw0STb0vmguBFqmrkr51h1I=
3
+ github.com/dependabot/gomodules-extracted v1.4.2 h1:3IxvHARuuSojSNUHguc6kzWgs+uQN3fdRCowJMU1kDE=
4
+ github.com/dependabot/gomodules-extracted v1.4.2/go.mod h1:cpzrmDX1COyhSDQXHfkRMw0STb0vmguBFqmrkr51h1I=
5
5
  golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
6
6
  golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8=
7
7
  golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
@@ -52,7 +52,7 @@ module Dependabot
52
52
  Dependency.new(
53
53
  name: details["Path"],
54
54
  version: version,
55
- requirements: details["Indirect"] ? [] : reqs,
55
+ requirements: details["Indirect"] || dependency_is_replaced(details) ? [] : reqs,
56
56
  package_manager: "go_modules"
57
57
  )
58
58
  end
@@ -92,6 +92,15 @@ module Dependabot
92
92
 
93
93
  def local_replacements
94
94
  @local_replacements ||=
95
+ # Find all the local replacements, and return them with a stub path
96
+ # we can use in their place. Using generated paths is safer as it
97
+ # means we don't need to worry about references to parent
98
+ # directories, etc.
99
+ ReplaceStubber.new(repo_contents_path).stub_paths(manifest, go_mod.directory)
100
+ end
101
+
102
+ def manifest
103
+ @manifest ||=
95
104
  SharedHelpers.in_a_temporary_directory do |path|
96
105
  File.write("go.mod", go_mod.content)
97
106
 
@@ -106,12 +115,7 @@ module Dependabot
106
115
  stdout, stderr, status = Open3.capture3(env, command)
107
116
  handle_parser_error(path, stderr) unless status.success?
108
117
 
109
- # Find all the local replacements, and return them with a stub path
110
- # we can use in their place. Using generated paths is safer as it
111
- # means we don't need to worry about references to parent
112
- # directories, etc.
113
- manifest = JSON.parse(stdout)
114
- ReplaceStubber.new(repo_contents_path).stub_paths(manifest, go_mod.directory)
118
+ JSON.parse(stdout)
115
119
  end
116
120
  end
117
121
 
@@ -172,6 +176,24 @@ module Dependabot
172
176
  false
173
177
  end
174
178
  end
179
+
180
+ def dependency_is_replaced(details)
181
+ # Mark dependency as replaced if the requested dependency has a
182
+ # "replace" directive and that either has the same version, or no
183
+ # version mentioned. This mimics the behaviour of go get -u, and
184
+ # prevents that we change dependency versions without any impact since
185
+ # the actual version that is being imported is defined by the replace
186
+ # directive.
187
+ if manifest["Replace"]
188
+ dep_replace = manifest["Replace"].find do |replace|
189
+ replace["Old"]["Path"] == details["Path"] &&
190
+ (!replace["Old"]["Version"] || replace["Old"]["Version"] == details["Version"])
191
+ end
192
+
193
+ return true if dep_replace
194
+ end
195
+ false
196
+ end
175
197
  end
176
198
  end
177
199
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependabot-go_modules
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.160.1
4
+ version: 0.162.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-26 00:00:00.000000000 Z
11
+ date: 2021-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dependabot-common
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.160.1
19
+ version: 0.162.2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.160.1
26
+ version: 0.162.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: byebug
29
29
  requirement: !ruby/object:Gem::Requirement