dependabot-go_modules 0.143.6 → 0.145.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/helpers/go.mod +1 -1
- data/helpers/go.sum +2 -2
- data/helpers/main.go +2 -2
- data/helpers/updatechecker/main.go +13 -37
- data/lib/dependabot/go_modules/file_parser.rb +15 -6
- data/lib/dependabot/go_modules/file_updater/go_mod_updater.rb +5 -34
- data/lib/dependabot/go_modules/replace_stubber.rb +55 -0
- data/lib/dependabot/go_modules/update_checker.rb +8 -58
- data/lib/dependabot/go_modules/update_checker/latest_version_finder.rb +150 -0
- metadata +8 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6fd4162b73e9c156a4501a0cccbe80b70938f612b6cbfeacd1fd4bfca0b2dbc
|
4
|
+
data.tar.gz: 2a1685ffcadd0b1131f0419c83b0a5bdce3cdd8351b0440affdf09d09f650272
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e56568eaa89b3ccbf6f5085665f90f0e463a5c3802e703119936a9d4a8ba6dd7b048ecafdd092ec4ca22b47340879111c15aaeab6c016a9b53bd3f5cda9b93e
|
7
|
+
data.tar.gz: 569c709ee4805cc17c21bd105268b1a7c215387133c964b13aada7f796f06444633e25ee82fb50e4368c464155c34e5e52e5b8aaa4c0c8ff16ef8eebecb549fd
|
data/helpers/go.mod
CHANGED
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
|
-
github.com/dependabot/gomodules-extracted v1.
|
3
|
+
github.com/dependabot/gomodules-extracted v1.3.0 h1:Rsnl5uR+wjE+7ontePia/B3p48aBRsyEhyNrzCwbkaw=
|
4
|
+
github.com/dependabot/gomodules-extracted v1.3.0/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=
|
data/helpers/main.go
CHANGED
@@ -33,10 +33,10 @@ func main() {
|
|
33
33
|
funcErr error
|
34
34
|
)
|
35
35
|
switch helperParams.Function {
|
36
|
-
case "
|
36
|
+
case "getVersions":
|
37
37
|
var args updatechecker.Args
|
38
38
|
parseArgs(helperParams.Args, &args)
|
39
|
-
funcOut, funcErr = updatechecker.
|
39
|
+
funcOut, funcErr = updatechecker.GetVersions(&args)
|
40
40
|
case "updateDependencyFile":
|
41
41
|
var args updater.Args
|
42
42
|
parseArgs(helperParams.Args, &args)
|
@@ -1,9 +1,9 @@
|
|
1
1
|
package updatechecker
|
2
2
|
|
3
3
|
import (
|
4
|
+
"context"
|
4
5
|
"errors"
|
5
6
|
"io/ioutil"
|
6
|
-
"regexp"
|
7
7
|
|
8
8
|
"github.com/dependabot/gomodules-extracted/cmd/go/_internal_/modfetch"
|
9
9
|
"github.com/dependabot/gomodules-extracted/cmd/go/_internal_/modload"
|
@@ -11,44 +11,27 @@ import (
|
|
11
11
|
"golang.org/x/mod/semver"
|
12
12
|
)
|
13
13
|
|
14
|
-
var (
|
15
|
-
pseudoVersionRegexp = regexp.MustCompile(`\b\d{14}-[0-9a-f]{12}$`)
|
16
|
-
)
|
17
|
-
|
18
14
|
type Dependency struct {
|
19
|
-
Name
|
20
|
-
Version
|
21
|
-
Indirect bool `json:"indirect"`
|
22
|
-
}
|
23
|
-
|
24
|
-
type IgnoreRange struct {
|
25
|
-
MinVersionInclusive string `json:"min_version_inclusive"`
|
26
|
-
MaxVersionExclusive string `json:"max_version_exclusive"`
|
15
|
+
Name string `json:"name"`
|
16
|
+
Version string `json:"version"`
|
27
17
|
}
|
28
18
|
|
29
19
|
type Args struct {
|
30
|
-
Dependency
|
31
|
-
IgnoreRanges []*IgnoreRange `json:"ignore_ranges"`
|
20
|
+
Dependency *Dependency `json:"dependency"`
|
32
21
|
}
|
33
22
|
|
34
|
-
|
23
|
+
// GetVersions returns a list of versions for the given dependency that
|
24
|
+
// are within the same major version.
|
25
|
+
func GetVersions(args *Args) (interface{}, error) {
|
35
26
|
if args.Dependency == nil {
|
36
27
|
return nil, errors.New("Expected args.dependency to not be nil")
|
37
28
|
}
|
38
29
|
|
39
30
|
currentVersion := args.Dependency.Version
|
40
|
-
currentPrerelease := semver.Prerelease(currentVersion)
|
41
|
-
if pseudoVersionRegexp.MatchString(currentPrerelease) {
|
42
|
-
return currentVersion, nil
|
43
|
-
}
|
44
|
-
|
45
|
-
modload.InitMod()
|
46
31
|
|
47
|
-
|
48
|
-
if err != nil {
|
49
|
-
return nil, err
|
50
|
-
}
|
32
|
+
modload.LoadModFile(context.Background())
|
51
33
|
|
34
|
+
repo := modfetch.Lookup("direct", args.Dependency.Name)
|
52
35
|
versions, err := repo.Versions("")
|
53
36
|
if err != nil {
|
54
37
|
return nil, err
|
@@ -60,7 +43,8 @@ func GetUpdatedVersion(args *Args) (interface{}, error) {
|
|
60
43
|
}
|
61
44
|
|
62
45
|
currentMajor := semver.Major(currentVersion)
|
63
|
-
|
46
|
+
|
47
|
+
var candidateVersions []string
|
64
48
|
|
65
49
|
Outer:
|
66
50
|
for _, v := range versions {
|
@@ -68,24 +52,16 @@ Outer:
|
|
68
52
|
continue
|
69
53
|
}
|
70
54
|
|
71
|
-
if semver.Compare(v, latestVersion) < 1 {
|
72
|
-
continue
|
73
|
-
}
|
74
|
-
|
75
|
-
if currentPrerelease == "" && semver.Prerelease(v) != "" {
|
76
|
-
continue
|
77
|
-
}
|
78
|
-
|
79
55
|
for _, exclude := range excludes {
|
80
56
|
if v == exclude {
|
81
57
|
continue Outer
|
82
58
|
}
|
83
59
|
}
|
84
60
|
|
85
|
-
|
61
|
+
candidateVersions = append(candidateVersions, v)
|
86
62
|
}
|
87
63
|
|
88
|
-
return
|
64
|
+
return candidateVersions, nil
|
89
65
|
}
|
90
66
|
|
91
67
|
func goModExcludes(dependency string) ([]string, error) {
|
@@ -4,6 +4,7 @@ require "open3"
|
|
4
4
|
require "dependabot/dependency"
|
5
5
|
require "dependabot/file_parsers/base/dependency_set"
|
6
6
|
require "dependabot/go_modules/path_converter"
|
7
|
+
require "dependabot/go_modules/replace_stubber"
|
7
8
|
require "dependabot/errors"
|
8
9
|
require "dependabot/file_parsers"
|
9
10
|
require "dependabot/file_parsers/base"
|
@@ -17,7 +18,7 @@ module Dependabot
|
|
17
18
|
dependency_set = Dependabot::FileParsers::Base::DependencySet.new
|
18
19
|
|
19
20
|
required_packages.each do |dep|
|
20
|
-
dependency_set << dependency_from_details(dep) unless dep
|
21
|
+
dependency_set << dependency_from_details(dep) unless skip_dependency?(dep)
|
21
22
|
end
|
22
23
|
|
23
24
|
dependency_set.dependencies
|
@@ -109,11 +110,8 @@ module Dependabot
|
|
109
110
|
# we can use in their place. Using generated paths is safer as it
|
110
111
|
# means we don't need to worry about references to parent
|
111
112
|
# directories, etc.
|
112
|
-
|
113
|
-
|
114
|
-
compact.
|
115
|
-
select { |p| p.start_with?(".") || p.start_with?("/") }.
|
116
|
-
map { |p| [p, "./" + Digest::SHA2.hexdigest(p)] }
|
113
|
+
manifest = JSON.parse(stdout)
|
114
|
+
ReplaceStubber.new(repo_contents_path).stub_paths(manifest, go_mod.directory)
|
117
115
|
end
|
118
116
|
end
|
119
117
|
|
@@ -163,6 +161,17 @@ module Dependabot
|
|
163
161
|
|
164
162
|
raw_version.match(GIT_VERSION_REGEX).named_captures.fetch("sha")
|
165
163
|
end
|
164
|
+
|
165
|
+
def skip_dependency?(dep)
|
166
|
+
return true if dep["Indirect"]
|
167
|
+
|
168
|
+
begin
|
169
|
+
path_uri = URI.parse("https://#{dep['Path']}")
|
170
|
+
!path_uri.host.include?(".")
|
171
|
+
rescue URI::InvalidURIError
|
172
|
+
false
|
173
|
+
end
|
174
|
+
end
|
166
175
|
end
|
167
176
|
end
|
168
177
|
end
|
@@ -4,6 +4,7 @@ require "dependabot/shared_helpers"
|
|
4
4
|
require "dependabot/errors"
|
5
5
|
require "dependabot/go_modules/file_updater"
|
6
6
|
require "dependabot/go_modules/native_helpers"
|
7
|
+
require "dependabot/go_modules/replace_stubber"
|
7
8
|
require "dependabot/go_modules/resolvability_errors"
|
8
9
|
|
9
10
|
module Dependabot
|
@@ -38,10 +39,9 @@ module Dependabot
|
|
38
39
|
].freeze
|
39
40
|
|
40
41
|
MODULE_PATH_MISMATCH_REGEXES = [
|
41
|
-
/go get: \S+ updating to\n\s+\S+\sparsing\sgo.mod:\n\s+module declares its path as: \S+\n\s+but was required as: \S+/,
|
42
42
|
/go: ([^@\s]+)(?:@[^\s]+)?: .* has non-.* module path "(.*)" at/,
|
43
43
|
/go: ([^@\s]+)(?:@[^\s]+)?: .* unexpected module path "(.*)"/,
|
44
|
-
/go
|
44
|
+
/go(?: get)?: ([^@\s]+)(?:@[^\s]+)?:? .* declares its path as: ([\S]*)/m
|
45
45
|
].freeze
|
46
46
|
|
47
47
|
OUT_OF_DISK_REGEXES = [
|
@@ -222,37 +222,8 @@ module Dependabot
|
|
222
222
|
# process afterwards.
|
223
223
|
def replace_directive_substitutions(manifest)
|
224
224
|
@replace_directive_substitutions ||=
|
225
|
-
(
|
226
|
-
|
227
|
-
compact.
|
228
|
-
select { |p| stub_replace_path?(p) }.
|
229
|
-
map { |p| [p, "./" + Digest::SHA2.hexdigest(p)] }.
|
230
|
-
to_h
|
231
|
-
end
|
232
|
-
|
233
|
-
# returns true if the provided path should be replaced with a stub
|
234
|
-
def stub_replace_path?(path)
|
235
|
-
return true if absolute_path?(path)
|
236
|
-
return false unless relative_replacement_path?(path)
|
237
|
-
|
238
|
-
resolved_path = module_pathname.join(path).realpath
|
239
|
-
inside_repo_contents_path = resolved_path.to_s.start_with?(repo_contents_path.to_s)
|
240
|
-
!inside_repo_contents_path
|
241
|
-
rescue Errno::ENOENT
|
242
|
-
true
|
243
|
-
end
|
244
|
-
|
245
|
-
def absolute_path?(path)
|
246
|
-
path.start_with?("/")
|
247
|
-
end
|
248
|
-
|
249
|
-
def relative_replacement_path?(path)
|
250
|
-
# https://golang.org/ref/mod#go-mod-file-replace
|
251
|
-
path.start_with?("./") || path.start_with?("../")
|
252
|
-
end
|
253
|
-
|
254
|
-
def module_pathname
|
255
|
-
@module_pathname ||= Pathname.new(repo_contents_path).join(directory.sub(%r{^/}, ""))
|
225
|
+
Dependabot::GoModules::ReplaceStubber.new(repo_contents_path).
|
226
|
+
stub_paths(manifest, directory)
|
256
227
|
end
|
257
228
|
|
258
229
|
def substitute_all(substitutions)
|
@@ -263,7 +234,7 @@ module Dependabot
|
|
263
234
|
write_go_mod(body)
|
264
235
|
end
|
265
236
|
|
266
|
-
def handle_subprocess_error(stderr)
|
237
|
+
def handle_subprocess_error(stderr) # rubocop:disable Metrics/AbcSize
|
267
238
|
stderr = stderr.gsub(Dir.getwd, "")
|
268
239
|
|
269
240
|
# Package version doesn't match the module major version
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Dependabot
|
4
|
+
module GoModules
|
5
|
+
# Given a go.mod file, find all `replace` directives pointing to a path
|
6
|
+
# on the local filesystem outside of the current checkout, and return a hash
|
7
|
+
# mapping the original path to a hash of the path.
|
8
|
+
#
|
9
|
+
# This lets us substitute all parts of the go.mod that are dependent on
|
10
|
+
# the layout of the filesystem with a structure we can reproduce (i.e.
|
11
|
+
# no paths such as ../../../foo), run the Go tooling, then reverse the
|
12
|
+
# process afterwards.
|
13
|
+
class ReplaceStubber
|
14
|
+
def initialize(repo_contents_path)
|
15
|
+
@repo_contents_path = repo_contents_path
|
16
|
+
end
|
17
|
+
|
18
|
+
def stub_paths(manifest, directory)
|
19
|
+
(manifest["Replace"] || []).
|
20
|
+
map { |r| r["New"]["Path"] }.
|
21
|
+
compact.
|
22
|
+
select { |p| stub_replace_path?(p, directory) }.
|
23
|
+
map { |p| [p, "./" + Digest::SHA2.hexdigest(p)] }.
|
24
|
+
to_h
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def stub_replace_path?(path, directory)
|
30
|
+
return true if absolute_path?(path)
|
31
|
+
return false unless relative_replacement_path?(path)
|
32
|
+
return true if @repo_contents_path.nil?
|
33
|
+
|
34
|
+
resolved_path = module_pathname(directory).join(path).realpath
|
35
|
+
inside_repo_contents_path = resolved_path.to_s.start_with?(@repo_contents_path.to_s)
|
36
|
+
!inside_repo_contents_path
|
37
|
+
rescue Errno::ENOENT
|
38
|
+
true
|
39
|
+
end
|
40
|
+
|
41
|
+
def absolute_path?(path)
|
42
|
+
path.start_with?("/")
|
43
|
+
end
|
44
|
+
|
45
|
+
def relative_replacement_path?(path)
|
46
|
+
# https://golang.org/ref/mod#go-mod-file-replace
|
47
|
+
path.start_with?("./") || path.start_with?("../")
|
48
|
+
end
|
49
|
+
|
50
|
+
def module_pathname(directory)
|
51
|
+
@module_pathname ||= Pathname.new(@repo_contents_path).join(directory.sub(%r{^/}, ""))
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -5,19 +5,12 @@ require "dependabot/update_checkers/base"
|
|
5
5
|
require "dependabot/shared_helpers"
|
6
6
|
require "dependabot/errors"
|
7
7
|
require "dependabot/go_modules/native_helpers"
|
8
|
-
require "dependabot/go_modules/resolvability_errors"
|
9
8
|
require "dependabot/go_modules/version"
|
10
9
|
|
11
10
|
module Dependabot
|
12
11
|
module GoModules
|
13
12
|
class UpdateChecker < Dependabot::UpdateCheckers::Base
|
14
|
-
|
15
|
-
# Package url/proxy doesn't include any redirect meta tags
|
16
|
-
/no go-import meta tags/,
|
17
|
-
# Package url 404s
|
18
|
-
/404 Not Found/,
|
19
|
-
/Repository not found/
|
20
|
-
].freeze
|
13
|
+
require_relative "update_checker/latest_version_finder"
|
21
14
|
|
22
15
|
def latest_resolvable_version
|
23
16
|
# We don't yet support updating indirect dependencies for go_modules
|
@@ -32,7 +25,13 @@ module Dependabot
|
|
32
25
|
end
|
33
26
|
|
34
27
|
@latest_resolvable_version ||=
|
35
|
-
|
28
|
+
LatestVersionFinder.new(
|
29
|
+
dependency: dependency,
|
30
|
+
dependency_files: dependency_files,
|
31
|
+
credentials: credentials,
|
32
|
+
ignored_versions: ignored_versions,
|
33
|
+
raise_on_ignored: raise_on_ignored
|
34
|
+
).latest_version
|
36
35
|
end
|
37
36
|
|
38
37
|
# This is currently used to short-circuit latest_resolvable_version,
|
@@ -55,51 +54,6 @@ module Dependabot
|
|
55
54
|
|
56
55
|
private
|
57
56
|
|
58
|
-
def find_latest_resolvable_version
|
59
|
-
SharedHelpers.in_a_temporary_directory do
|
60
|
-
SharedHelpers.with_git_configured(credentials: credentials) do
|
61
|
-
File.write("go.mod", go_mod.content)
|
62
|
-
|
63
|
-
# Turn off the module proxy for now, as it's causing issues with
|
64
|
-
# private git dependencies
|
65
|
-
env = { "GOPRIVATE" => "*" }
|
66
|
-
|
67
|
-
SharedHelpers.run_helper_subprocess(
|
68
|
-
command: NativeHelpers.helper_path,
|
69
|
-
env: env,
|
70
|
-
function: "getUpdatedVersion",
|
71
|
-
args: {
|
72
|
-
dependency: {
|
73
|
-
name: dependency.name,
|
74
|
-
version: "v" + dependency.version,
|
75
|
-
indirect: dependency.requirements.empty?
|
76
|
-
}
|
77
|
-
}
|
78
|
-
)
|
79
|
-
end
|
80
|
-
end
|
81
|
-
rescue SharedHelpers::HelperSubprocessFailed => e
|
82
|
-
retry_count ||= 0
|
83
|
-
retry_count += 1
|
84
|
-
retry if transitory_failure?(e) && retry_count < 2
|
85
|
-
|
86
|
-
handle_subprocess_error(e)
|
87
|
-
end
|
88
|
-
|
89
|
-
def handle_subprocess_error(error)
|
90
|
-
if RESOLVABILITY_ERROR_REGEXES.any? { |rgx| error.message =~ rgx }
|
91
|
-
ResolvabilityErrors.handle(error.message, credentials: credentials)
|
92
|
-
end
|
93
|
-
|
94
|
-
raise
|
95
|
-
end
|
96
|
-
|
97
|
-
def transitory_failure?(error)
|
98
|
-
return true if error.message.include?("EOF")
|
99
|
-
|
100
|
-
error.message.include?("Internal Server Error")
|
101
|
-
end
|
102
|
-
|
103
57
|
def latest_version_resolvable_with_full_unlock?
|
104
58
|
# Full unlock checks aren't implemented for Go (yet)
|
105
59
|
false
|
@@ -136,10 +90,6 @@ module Dependabot
|
|
136
90
|
{ type: "default", source: dependency.name }
|
137
91
|
end
|
138
92
|
|
139
|
-
def go_mod
|
140
|
-
@go_mod ||= dependency_files.find { |f| f.name == "go.mod" }
|
141
|
-
end
|
142
|
-
|
143
93
|
def git_commit_checker
|
144
94
|
@git_commit_checker ||=
|
145
95
|
GitCommitChecker.new(
|
@@ -0,0 +1,150 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "excon"
|
4
|
+
|
5
|
+
require "dependabot/go_modules/update_checker"
|
6
|
+
require "dependabot/shared_helpers"
|
7
|
+
require "dependabot/errors"
|
8
|
+
require "dependabot/go_modules/requirement"
|
9
|
+
require "dependabot/go_modules/resolvability_errors"
|
10
|
+
|
11
|
+
module Dependabot
|
12
|
+
module GoModules
|
13
|
+
class UpdateChecker
|
14
|
+
class LatestVersionFinder
|
15
|
+
RESOLVABILITY_ERROR_REGEXES = [
|
16
|
+
# Package url/proxy doesn't include any redirect meta tags
|
17
|
+
/no go-import meta tags/,
|
18
|
+
# Package url 404s
|
19
|
+
/404 Not Found/,
|
20
|
+
/Repository not found/,
|
21
|
+
/unrecognized import path/
|
22
|
+
].freeze
|
23
|
+
PSEUDO_VERSION_REGEX = /\b\d{14}-[0-9a-f]{12}$/.freeze
|
24
|
+
|
25
|
+
def initialize(dependency:, dependency_files:, credentials:,
|
26
|
+
ignored_versions:, raise_on_ignored: false)
|
27
|
+
@dependency = dependency
|
28
|
+
@dependency_files = dependency_files
|
29
|
+
@credentials = credentials
|
30
|
+
@ignored_versions = ignored_versions
|
31
|
+
@raise_on_ignored = raise_on_ignored
|
32
|
+
end
|
33
|
+
|
34
|
+
def latest_version
|
35
|
+
@latest_version ||= fetch_latest_version
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
attr_reader :dependency, :dependency_files, :credentials, :ignored_versions
|
41
|
+
|
42
|
+
def fetch_latest_version
|
43
|
+
return dependency.version if dependency.version =~ PSEUDO_VERSION_REGEX
|
44
|
+
|
45
|
+
candidate_versions = available_versions
|
46
|
+
candidate_versions = filter_prerelease_versions(candidate_versions)
|
47
|
+
candidate_versions = filter_lower_versions(candidate_versions)
|
48
|
+
candidate_versions = filter_ignored_versions(candidate_versions)
|
49
|
+
|
50
|
+
candidate_versions.max
|
51
|
+
end
|
52
|
+
|
53
|
+
def available_versions
|
54
|
+
SharedHelpers.in_a_temporary_directory do
|
55
|
+
SharedHelpers.with_git_configured(credentials: credentials) do
|
56
|
+
File.write("go.mod", go_mod.content)
|
57
|
+
|
58
|
+
# Turn off the module proxy for now, as it's causing issues with
|
59
|
+
# private git dependencies
|
60
|
+
env = { "GOPRIVATE" => "*" }
|
61
|
+
|
62
|
+
version_strings = SharedHelpers.run_helper_subprocess(
|
63
|
+
command: NativeHelpers.helper_path,
|
64
|
+
env: env,
|
65
|
+
function: "getVersions",
|
66
|
+
args: {
|
67
|
+
dependency: {
|
68
|
+
name: dependency.name,
|
69
|
+
version: "v" + dependency.version
|
70
|
+
}
|
71
|
+
}
|
72
|
+
)
|
73
|
+
|
74
|
+
return [version_class.new(dependency.version)] if version_strings.nil?
|
75
|
+
|
76
|
+
version_strings.select { |v| version_class.correct?(v) }.
|
77
|
+
map { |v| version_class.new(v) }
|
78
|
+
end
|
79
|
+
end
|
80
|
+
rescue SharedHelpers::HelperSubprocessFailed => e
|
81
|
+
retry_count ||= 0
|
82
|
+
retry_count += 1
|
83
|
+
retry if transitory_failure?(e) && retry_count < 2
|
84
|
+
|
85
|
+
handle_subprocess_error(e)
|
86
|
+
end
|
87
|
+
|
88
|
+
def handle_subprocess_error(error)
|
89
|
+
if RESOLVABILITY_ERROR_REGEXES.any? { |rgx| error.message =~ rgx }
|
90
|
+
ResolvabilityErrors.handle(error.message, credentials: credentials)
|
91
|
+
end
|
92
|
+
|
93
|
+
raise
|
94
|
+
end
|
95
|
+
|
96
|
+
def transitory_failure?(error)
|
97
|
+
return true if error.message.include?("EOF")
|
98
|
+
|
99
|
+
error.message.include?("Internal Server Error")
|
100
|
+
end
|
101
|
+
|
102
|
+
def go_mod
|
103
|
+
@go_mod ||= dependency_files.find { |f| f.name == "go.mod" }
|
104
|
+
end
|
105
|
+
|
106
|
+
def filter_prerelease_versions(versions_array)
|
107
|
+
return versions_array if wants_prerelease?
|
108
|
+
|
109
|
+
versions_array.reject(&:prerelease?)
|
110
|
+
end
|
111
|
+
|
112
|
+
def filter_lower_versions(versions_array)
|
113
|
+
versions_array.
|
114
|
+
select { |version| version >= version_class.new(dependency.version) }
|
115
|
+
end
|
116
|
+
|
117
|
+
def filter_ignored_versions(versions_array)
|
118
|
+
filtered = versions_array.
|
119
|
+
reject { |v| ignore_requirements.any? { |r| r.satisfied_by?(v) } }
|
120
|
+
raise AllVersionsIgnored if @raise_on_ignored && filtered.empty? && versions_array.any?
|
121
|
+
|
122
|
+
filtered
|
123
|
+
end
|
124
|
+
|
125
|
+
def wants_prerelease?
|
126
|
+
@wants_prerelease ||=
|
127
|
+
begin
|
128
|
+
current_version = dependency.version
|
129
|
+
current_version && version_class.correct?(current_version) &&
|
130
|
+
version_class.new(current_version).prerelease?
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
def ignore_requirements
|
135
|
+
ignored_versions.flat_map { |req| requirement_class.requirements_array(req) }
|
136
|
+
end
|
137
|
+
|
138
|
+
def requirement_class
|
139
|
+
Utils.requirement_class_for_package_manager(
|
140
|
+
dependency.package_manager
|
141
|
+
)
|
142
|
+
end
|
143
|
+
|
144
|
+
def version_class
|
145
|
+
Utils.version_class_for_package_manager(dependency.package_manager)
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
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.
|
4
|
+
version: 0.145.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dependabot
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-05-07 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.
|
19
|
+
version: 0.145.3
|
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.
|
26
|
+
version: 0.145.3
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: byebug
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 1.
|
103
|
+
version: 1.14.0
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 1.
|
110
|
+
version: 1.14.0
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: simplecov
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -202,9 +202,11 @@ files:
|
|
202
202
|
- lib/dependabot/go_modules/metadata_finder.rb
|
203
203
|
- lib/dependabot/go_modules/native_helpers.rb
|
204
204
|
- lib/dependabot/go_modules/path_converter.rb
|
205
|
+
- lib/dependabot/go_modules/replace_stubber.rb
|
205
206
|
- lib/dependabot/go_modules/requirement.rb
|
206
207
|
- lib/dependabot/go_modules/resolvability_errors.rb
|
207
208
|
- lib/dependabot/go_modules/update_checker.rb
|
209
|
+
- lib/dependabot/go_modules/update_checker/latest_version_finder.rb
|
208
210
|
- lib/dependabot/go_modules/version.rb
|
209
211
|
homepage: https://github.com/dependabot/dependabot-core
|
210
212
|
licenses:
|