Skip to content

Commit

Permalink
Fix Go modules prerelease
Browse files Browse the repository at this point in the history
The `@prerelease` component should include everything after the `-`, not
only the initial split.

Fixes #10020.
  • Loading branch information
stefanvanburen committed Jun 17, 2024
1 parent fff2779 commit ba4cbc3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion go_modules/lib/dependabot/go_modules/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def initialize(version)
@version_string = version.to_s.gsub(/^v/, "")
version = version.gsub(/^v/, "") if version.is_a?(String)
version = version.to_s.split("+").first if version.to_s.include?("+")
version, @prerelease = version.to_s.split("-") if version.to_s.include?("-")
version, @prerelease = version.to_s.split("-", 2) if version.to_s.include?("-")

super
end
Expand Down
4 changes: 3 additions & 1 deletion go_modules/spec/dependabot/go_modules/version_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,9 @@
"v1.1.0-rc0",
"v1.1.0-rc5",
"v1.1.0-rc6",
"v1.1.0"
"v1.1.0",
"v1.34.2-20220907172603-9a877cf260e1.1",
"v1.34.2-20220907172603-9a877cf260e1.2"
]
sorted_versions.combination(2).each do |lhs, rhs|
it "'#{lhs}' < '#{rhs}'" do
Expand Down

0 comments on commit ba4cbc3

Please sign in to comment.