Skip to content

cmd/go: go mod tidy does not always remove unneeded entries #33008

@rogpeppe

Description

@rogpeppe
$ go version
go version devel +d410642f49 Mon Jul 1 21:30:23 2019 +0000 linux/amd64

There was an unnecessary entry in a go.sum file that wasn't being removed by go mod tidy.

Here's a testscript script that reproduces the issue:

go mod tidy
grep -count=1 'fastuuid v[0-9.]+ ' go.sum

# When we use the go.sum file with an extra
# fastuuid entry, it should remove it, but it doesn't.
cp go.sum-extra-fastuuid go.sum
go mod tidy
grep -count=1 'fastuuid v[0-9.]+ ' go.sum

-- go.mod --
module m

go 1.13

require (
	github.com/heetch/sqalx v0.4.0
	github.com/rogpeppe/fastuuid v1.2.0
)
-- go.sum-extra-fastuuid --
github.com/rogpeppe/fastuuid v1.1.0 h1:INyGLmTCMGFr6OVIb977ghJvABML2CMVjPoRfNDdYDo=
github.com/rogpeppe/fastuuid v1.1.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
github.com/rogpeppe/fastuuid v1.2.0 h1:Ppwyp6VYCF1nvBTXL3trRso7mXMlRrw9ooo375wvi2s=
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
-- m.go --
package main

import (
	_ "github.com/heetch/sqalx"
	_ "github.com/rogpeppe/fastuuid"
)

func main() {
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.modules

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions