1
0
mirror of https://github.com/golang/go synced 2024-11-24 23:07:56 -07:00

cmd/go: let list -m -json include an Origin

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 #67363
This commit is contained in:
Kioni 2024-05-28 02:02:44 +09:00
parent 377646589d
commit 1299733f3b

View File

@ -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 ||