dependabot-go_modules 0.401.0 → 0.403.0
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/lib/dependabot/go_modules/file_updater/go_mod_updater.rb +35 -0
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3ce2af6f74e26334e34e6f9f4adb5fc892d9dfc711b6fa964c2edb3199d1a060
|
|
4
|
+
data.tar.gz: 792d2865b21314188ad23c0e98bc215c6e89b87dff6f87669081dc125a10cc22
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 01db7a9b289ca3f3f1d2c443f0db181af398464a367ba03e157fefcafa6d9ae445705adf395c4dca32a50a2d2c71b8c33765132a8918e5358e6e3fc8055f57ce
|
|
7
|
+
data.tar.gz: b163437bba7deb781def5aa0a49eca690a36182be9ca07f8f3fb1ada68967c4174f68eaf11cb0a2af6f449bf640995ed6273a60912326ca79657216243681987
|
|
@@ -114,6 +114,12 @@ module Dependabot
|
|
|
114
114
|
GITHUB_403_REGEX =
|
|
115
115
|
%r{https://github\.com/(?<repo>[^/'\s]+/[^/'\s]+)/?': The requested URL returned error: 403}
|
|
116
116
|
|
|
117
|
+
# An import that no module provides, as `go mod tidy` and `go get` report it. The package is often inside the
|
|
118
|
+
# repository's own module, and is generated code (protobuf, mocks) that is not committed.
|
|
119
|
+
MISSING_PACKAGE_ERROR = /^\s*(?<package>\S+): no matching versions for query "latest"/
|
|
120
|
+
|
|
121
|
+
GO_PROGRESS_LINE = /^go: (?:downloading|extracting) /
|
|
122
|
+
|
|
117
123
|
GO_MOD_VERSION = /^go 1\.\d+(\.\d+)?$/
|
|
118
124
|
|
|
119
125
|
sig do
|
|
@@ -252,6 +258,7 @@ module Dependabot
|
|
|
252
258
|
|
|
253
259
|
run_go_work_sync
|
|
254
260
|
run_workspace_tidy
|
|
261
|
+
run_go_list_modules
|
|
255
262
|
|
|
256
263
|
collect_workspace_file_contents
|
|
257
264
|
end
|
|
@@ -277,6 +284,20 @@ module Dependabot
|
|
|
277
284
|
end
|
|
278
285
|
end
|
|
279
286
|
|
|
287
|
+
# Go < 1.28 leaves go.work.sum without the checksums that `go list -m all` adds after `go work sync`
|
|
288
|
+
# (golang/go#63901). Loading the full module list last records them for the final workspace graph.
|
|
289
|
+
# Best-effort: sync and tidy have already succeeded, so a failure here must not fail the update.
|
|
290
|
+
sig { void }
|
|
291
|
+
def run_go_list_modules
|
|
292
|
+
return unless dependency_files.any? { |f| f.name == "go.work.sum" }
|
|
293
|
+
|
|
294
|
+
command = "go list -m all"
|
|
295
|
+
_, stderr, status = Open3.capture3(command)
|
|
296
|
+
return if status.success?
|
|
297
|
+
|
|
298
|
+
Dependabot.logger.info "Failed to `#{command}` in the workspace: #{stderr}"
|
|
299
|
+
end
|
|
300
|
+
|
|
280
301
|
sig { returns(T::Array[String]) }
|
|
281
302
|
def workspace_module_paths
|
|
282
303
|
go_work_file = dependency_files.find { |f| f.name.end_with?("go.work") }
|
|
@@ -498,6 +519,8 @@ module Dependabot
|
|
|
498
519
|
)
|
|
499
520
|
end
|
|
500
521
|
|
|
522
|
+
raise_for_missing_package_error(stderr)
|
|
523
|
+
|
|
501
524
|
# We don't know what happened so we raise a generic error
|
|
502
525
|
msg = stderr.lines.last(10).join.strip
|
|
503
526
|
raise Dependabot::DependabotError, msg
|
|
@@ -531,6 +554,18 @@ module Dependabot
|
|
|
531
554
|
end
|
|
532
555
|
end
|
|
533
556
|
|
|
557
|
+
sig { params(stderr: String).void }
|
|
558
|
+
def raise_for_missing_package_error(stderr)
|
|
559
|
+
packages = stderr.scan(MISSING_PACKAGE_ERROR).flatten.uniq
|
|
560
|
+
return if packages.empty?
|
|
561
|
+
|
|
562
|
+
raise Dependabot::DependencyFileNotResolvable,
|
|
563
|
+
"Go cannot find a module that provides #{packages.join(', ')}. If they are generated code " \
|
|
564
|
+
"(for example protobuf or mock output) that is not committed, Dependabot cannot generate it: " \
|
|
565
|
+
"commit the generated files, or check the import paths.\n\n" \
|
|
566
|
+
"#{stderr.lines.grep_v(GO_PROGRESS_LINE).join.strip}"
|
|
567
|
+
end
|
|
568
|
+
|
|
534
569
|
sig { params(stderr: String).void }
|
|
535
570
|
def raise_for_go_mod_parse_error(stderr)
|
|
536
571
|
go_mod_parse_error_regex = GO_MOD_PARSE_ERROR_REGEXES.find { |r| stderr =~ r }
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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.403.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dependabot
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - '='
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 0.
|
|
18
|
+
version: 0.403.0
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - '='
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 0.
|
|
25
|
+
version: 0.403.0
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: debug
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -277,7 +277,7 @@ licenses:
|
|
|
277
277
|
- MIT
|
|
278
278
|
metadata:
|
|
279
279
|
bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
|
|
280
|
-
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.
|
|
280
|
+
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.403.0
|
|
281
281
|
rdoc_options: []
|
|
282
282
|
require_paths:
|
|
283
283
|
- lib
|