blob: 76b915afaae9167885069b9a38adb4cd66046d65 [file] [log] [blame]
cp go.mod go.mod.old
cp lazy.go lazy.go.old
go mod tidy
cmp go.mod go.mod.old
# Before adding a new import, the go.mod file should
# enumerate modules for all packages already imported.
go list all
cmp go.mod go.mod.old
# When we add a new import of a package in an existing dependency,
# and that dependency is already tidy, its transitive dependencies
# should already be present.
cp lazy.go.new lazy.go
go list all
go list -m all
stdout '^example.com/c v0.1.0' # not v0.2.0 as would be be resolved by 'latest'
cmp go.mod go.mod.old
# TODO(#36460):
cp lazy.go.old lazy.go
cp go.mod.old go.mod
go mod edit -go=1.16
# When a new import is found, we should perform a deepening scan of the existing
# dependencies and add a requirement on the version required by those
# dependencies — not re-resolve 'latest'.
-- go.mod --
module example.com/lazy
go 1.14
require example.com/a v0.1.0
replace (
example.com/a v0.1.0 => ./a
example.com/b v0.1.0 => ./b
example.com/c v0.1.0 => ./c1
example.com/c v0.2.0 => ./c2
)
-- lazy.go --
package lazy
import (
_ "example.com/a/x"
)
-- lazy.go.new --
package lazy
import (
_ "example.com/a/x"
_ "example.com/a/y"
)
-- a/go.mod --
module example.com/a
go 1.14
require (
example.com/b v0.1.0
example.com/c v0.1.0
)
-- a/x/x.go --
package x
import _ "example.com/b"
-- a/y/y.go --
package y
import _ "example.com/c"
-- b/go.mod --
module example.com/b
go 1.14
-- b/b.go --
package b
-- c1/go.mod --
module example.com/c
go 1.14
-- c1/c.go --
package c
-- c2/go.mod --
module example.com/c
go 1.14
-- c2/c.go --
package c
This file should not be used, so this syntax error should be ignored.