Skip to content

Commit

Permalink
cmd/go: let list -m -json include an Origin
Browse files Browse the repository at this point in the history
MergeOrigin will work when m1 or m2 both not nil. But if one of it is nil. It should return other one which is not nil.

Fixes golang#67363
  • Loading branch information
khndhkx123 committed May 27, 2024
1 parent 3776465 commit 1299733
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/cmd/go/internal/modload/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,11 @@ func addUpdate(ctx context.Context, m *modinfo.ModulePublic) {
// If the two origins conflict including if either is nil,
// mergeOrigin returns nil.
func mergeOrigin(m1, m2 *codehost.Origin) *codehost.Origin {
if m1 == nil || m2 == nil {
return nil
if m1 == nil {
return m2
}
if m2 == nil {
return m1
}

if m2.VCS != m1.VCS ||
Expand Down

0 comments on commit 1299733

Please sign in to comment.