зеркало из https://github.com/golang/dep.git
Split input components out in Gopkg.lock
This commit is contained in:
Родитель
e17ccb8db0
Коммит
8be9bb629b
|
@ -211,7 +211,7 @@ func (cmd *initCommand) Run(ctx *dep.Ctx, args []string) error {
|
|||
return errors.Wrap(err, "prepare solver")
|
||||
}
|
||||
|
||||
l.Memo = s.HashInputs()
|
||||
l.Inputs.Memo = s.HashInputs()
|
||||
|
||||
// Pass timestamp (yyyyMMddHHmmss format) as suffix to backup name.
|
||||
vendorbak, err := dep.BackupVendor(vpath, time.Now().Format("20060102150405"))
|
||||
|
|
|
@ -68,7 +68,7 @@ func (cmd *pruneCommand) Run(ctx *dep.Ctx, args []string) error {
|
|||
return errors.Wrap(err, "could not set up solver for input hashing")
|
||||
}
|
||||
|
||||
if !bytes.Equal(s.HashInputs(), p.Lock.Memo) {
|
||||
if !bytes.Equal(s.HashInputs(), p.Lock.Inputs.Memo) {
|
||||
return fmt.Errorf("lock hash doesn't match")
|
||||
}
|
||||
|
||||
|
|
|
@ -277,7 +277,7 @@ func runStatusAll(loggers *dep.Loggers, out outputter, p *dep.Project, sm gps.So
|
|||
slp := p.Lock.Projects()
|
||||
sort.Sort(dep.SortedLockedProjects(slp))
|
||||
|
||||
if bytes.Equal(s.HashInputs(), p.Lock.Memo) {
|
||||
if bytes.Equal(s.HashInputs(), p.Lock.Inputs.Memo) {
|
||||
// If these are equal, we're guaranteed that the lock is a transitively
|
||||
// complete picture of all deps. That eliminates the need for at least
|
||||
// some checks.
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
memo = "14b07b05e0f01051b03887ab2bf80b516bc5510ea92f75f76c894b1745d8850c"
|
||||
|
||||
[inputs]
|
||||
analyzerName = "dep"
|
||||
analyzerVersion = 1
|
||||
memo = "14b07b05e0f01051b03887ab2bf80b516bc5510ea92f75f76c894b1745d8850c"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/sdboyer/deptest"
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
["init"],
|
||||
["ensure", "-update"]
|
||||
],
|
||||
"error-expected": "",
|
||||
"vendor-final": [
|
||||
"github.com/sdboyer/deptest"
|
||||
]
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
memo = "e7725ea56516a42a641aaaf5d48754258d9f3c59949cb8a0e8a21b1ab6e07179"
|
||||
|
||||
[inputs]
|
||||
analyzerName = "dep"
|
||||
analyzerVersion = 1
|
||||
memo = "e7725ea56516a42a641aaaf5d48754258d9f3c59949cb8a0e8a21b1ab6e07179"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/sdboyer/deptest"
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
"commands": [
|
||||
["ensure"]
|
||||
],
|
||||
"error-expected": "",
|
||||
"vendor-final": [
|
||||
"github.com/sdboyer/deptest"
|
||||
]
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
memo = "e5c16e09ed6f0a1a2b3cf472c34b7fd50861dd070e81d5e623f72e8173f0c065"
|
||||
|
||||
[inputs]
|
||||
analyzerName = "dep"
|
||||
analyzerVersion = 1
|
||||
memo = "e5c16e09ed6f0a1a2b3cf472c34b7fd50861dd070e81d5e623f72e8173f0c065"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
"commands": [
|
||||
["ensure"]
|
||||
],
|
||||
"error-expected": "",
|
||||
"vendor-final": [
|
||||
"github.com/sdboyer/deptest"
|
||||
]
|
||||
|
|
6
cmd/dep/testdata/harness_tests/ensure/override/case1/final/Gopkg.lock
сгенерированный
поставляемый
6
cmd/dep/testdata/harness_tests/ensure/override/case1/final/Gopkg.lock
сгенерированный
поставляемый
|
@ -1,4 +1,8 @@
|
|||
memo = "8bca9526e654e56e05d9075d1f33fa5b649bf6d58aa7d71ca39e7fbea8468e07"
|
||||
|
||||
[inputs]
|
||||
analyzerName = "dep"
|
||||
analyzerVersion = 1
|
||||
memo = "8bca9526e654e56e05d9075d1f33fa5b649bf6d58aa7d71ca39e7fbea8468e07"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/sdboyer/deptest"
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
["init"],
|
||||
["ensure", "-override", "github.com/sdboyer/deptest@1.0.0"]
|
||||
],
|
||||
"error-expected": "",
|
||||
"vendor-final": [
|
||||
"github.com/sdboyer/deptest"
|
||||
]
|
||||
|
|
6
cmd/dep/testdata/harness_tests/ensure/pkg-errors/case1/final/Gopkg.lock
сгенерированный
поставляемый
6
cmd/dep/testdata/harness_tests/ensure/pkg-errors/case1/final/Gopkg.lock
сгенерированный
поставляемый
|
@ -1 +1,5 @@
|
|||
memo = "ab4fef131ee828e96ba67d31a7d690bd5f2f42040c6766b1b12fe856f87e0ff7"
|
||||
|
||||
[inputs]
|
||||
analyzerName = "dep"
|
||||
analyzerVersion = 1
|
||||
memo = "ab4fef131ee828e96ba67d31a7d690bd5f2f42040c6766b1b12fe856f87e0ff7"
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
{
|
||||
"commands": [
|
||||
["init", "-no-examples"],
|
||||
["ensure", "-update"]
|
||||
],
|
||||
"error-expected" : "all dirs lacked any go code"
|
||||
}
|
||||
"commands": [
|
||||
["init", "-no-examples"],
|
||||
["ensure", "-update"]
|
||||
],
|
||||
"error-expected": "all dirs lacked any go code",
|
||||
"vendor-final": []
|
||||
}
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
memo = "1b381263a360eafafe3ef7f9be626672668d17250a3c9a8debd169d1b5e2eebb"
|
||||
|
||||
[inputs]
|
||||
analyzerName = "dep"
|
||||
analyzerVersion = 1
|
||||
memo = "1b381263a360eafafe3ef7f9be626672668d17250a3c9a8debd169d1b5e2eebb"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/sdboyer/deptest"
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
"commands": [
|
||||
["ensure", "-update", "github.com/sdboyer/deptest"]
|
||||
],
|
||||
"error-expected": "",
|
||||
"vendor-final": [
|
||||
"github.com/sdboyer/deptest",
|
||||
"github.com/sdboyer/deptestdos"
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
"commands": [
|
||||
["ensure", "-n", "-update", "github.com/sdboyer/deptest"]
|
||||
],
|
||||
"error-expected": "",
|
||||
"vendor-final": []
|
||||
}
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
memo = "88d2718cda70cce45158f953d2c6ead79c1db38e67e9704aff72be8fddb096e7"
|
||||
|
||||
[inputs]
|
||||
analyzerName = "dep"
|
||||
analyzerVersion = 1
|
||||
memo = "88d2718cda70cce45158f953d2c6ead79c1db38e67e9704aff72be8fddb096e7"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/sdboyer/deptest"
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
"commands": [
|
||||
["init", "-no-examples"]
|
||||
],
|
||||
"error-expected": "",
|
||||
"gopath-initial": {
|
||||
"github.com/sdboyer/deptest": "v0.8.0",
|
||||
"github.com/sdboyer/deptestdos": "a0196baa11ea047dd65037287451d36b861b00ea"
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
memo = "b4fe6e8bceac924197838b6ea47989abbdd3a8d31035d20ee0a1dabc0994c368"
|
||||
|
||||
[inputs]
|
||||
analyzerName = "dep"
|
||||
analyzerVersion = 1
|
||||
memo = "b4fe6e8bceac924197838b6ea47989abbdd3a8d31035d20ee0a1dabc0994c368"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/sdboyer/deptest"
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
"commands": [
|
||||
["init", "-no-examples"]
|
||||
],
|
||||
"error-expected": "",
|
||||
"gopath-initial": {
|
||||
"github.com/sdboyer/deptest": "v0.8.0"
|
||||
},
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
memo = "af9a783a5430dabcaaf44683c09e2b729e1c0d61f13bfdf6677c4fd0b41387ca"
|
||||
|
||||
[inputs]
|
||||
analyzerName = "dep"
|
||||
analyzerVersion = 1
|
||||
memo = "af9a783a5430dabcaaf44683c09e2b729e1c0d61f13bfdf6677c4fd0b41387ca"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
"commands": [
|
||||
["init", "-no-examples"]
|
||||
],
|
||||
"error-expected": "",
|
||||
"gopath-initial": {
|
||||
"github.com/sdboyer/deptestdos": "a0196baa11ea047dd65037287451d36b861b00ea"
|
||||
},
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"commands": [
|
||||
["init"]
|
||||
],
|
||||
"error-expected" : "manifest already exists:"
|
||||
}
|
||||
"commands": [
|
||||
["init"]
|
||||
],
|
||||
"error-expected": "manifest already exists:",
|
||||
"vendor-final": []
|
||||
}
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
memo = "14b07b05e0f01051b03887ab2bf80b516bc5510ea92f75f76c894b1745d8850c"
|
||||
|
||||
[inputs]
|
||||
analyzerName = "dep"
|
||||
analyzerVersion = 1
|
||||
memo = "14b07b05e0f01051b03887ab2bf80b516bc5510ea92f75f76c894b1745d8850c"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/sdboyer/deptest"
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
"commands": [
|
||||
["init", "-no-examples"]
|
||||
],
|
||||
"error-expected": "",
|
||||
"vendor-final": [
|
||||
"github.com/sdboyer/deptest"
|
||||
]
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
memo = "88d2718cda70cce45158f953d2c6ead79c1db38e67e9704aff72be8fddb096e7"
|
||||
|
||||
[inputs]
|
||||
analyzerName = "dep"
|
||||
analyzerVersion = 1
|
||||
memo = "88d2718cda70cce45158f953d2c6ead79c1db38e67e9704aff72be8fddb096e7"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/sdboyer/deptest"
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
"commands": [
|
||||
["remove", "-force", "github.com/sdboyer/deptestdos", "github.com/not/used"]
|
||||
],
|
||||
"error-expected": "",
|
||||
"vendor-final": [
|
||||
"github.com/sdboyer/deptest",
|
||||
"github.com/sdboyer/deptestdos"
|
||||
|
|
6
cmd/dep/testdata/harness_tests/remove/specific/case1/final/Gopkg.lock
сгенерированный
поставляемый
6
cmd/dep/testdata/harness_tests/remove/specific/case1/final/Gopkg.lock
сгенерированный
поставляемый
|
@ -1,4 +1,8 @@
|
|||
memo = "d414dbf5fc668c1085effa68372d02e54b23d058cc66f9fd19ba094c6a946d9b"
|
||||
|
||||
[inputs]
|
||||
analyzerName = "dep"
|
||||
analyzerVersion = 1
|
||||
memo = "d414dbf5fc668c1085effa68372d02e54b23d058cc66f9fd19ba094c6a946d9b"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/sdboyer/deptest"
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
"commands": [
|
||||
["remove", "github.com/not/used"]
|
||||
],
|
||||
"error-expected": "",
|
||||
"vendor-final": [
|
||||
"github.com/sdboyer/deptest",
|
||||
"github.com/sdboyer/deptestdos"
|
||||
|
|
6
cmd/dep/testdata/harness_tests/remove/specific/case2/final/Gopkg.lock
сгенерированный
поставляемый
6
cmd/dep/testdata/harness_tests/remove/specific/case2/final/Gopkg.lock
сгенерированный
поставляемый
|
@ -1,4 +1,8 @@
|
|||
memo = "38d8431865759ee3bf28fbdfc464f98ee8b56319394ec717df45e9969544cfca"
|
||||
|
||||
[inputs]
|
||||
analyzerName = "dep"
|
||||
analyzerVersion = 1
|
||||
memo = "38d8431865759ee3bf28fbdfc464f98ee8b56319394ec717df45e9969544cfca"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/sdboyer/deptest"
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
"commands": [
|
||||
["remove", "github.com/not/used"]
|
||||
],
|
||||
"error-expected": "",
|
||||
"vendor-initial": {
|
||||
"github.com/sdboyer/deptest": "v0.8.0",
|
||||
"github.com/sdboyer/deptestdos": "a0196baa11ea047dd65037287451d36b861b00ea"
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
memo = "d414dbf5fc668c1085effa68372d02e54b23d058cc66f9fd19ba094c6a946d9b"
|
||||
|
||||
[inputs]
|
||||
analyzerName = "dep"
|
||||
analyzerVersion = 1
|
||||
memo = "d414dbf5fc668c1085effa68372d02e54b23d058cc66f9fd19ba094c6a946d9b"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/sdboyer/deptest"
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
"commands": [
|
||||
["remove", "-unused"]
|
||||
],
|
||||
"error-expected": "",
|
||||
"vendor-final": [
|
||||
"github.com/sdboyer/deptest",
|
||||
"github.com/sdboyer/deptestdos"
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
memo = "88d2718cda70cce45158f953d2c6ead79c1db38e67e9704aff72be8fddb096e7"
|
||||
|
||||
[inputs]
|
||||
analyzerName = "dep"
|
||||
analyzerVersion = 1
|
||||
memo = "88d2718cda70cce45158f953d2c6ead79c1db38e67e9704aff72be8fddb096e7"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/sdboyer/deptest"
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
{
|
||||
"commands": [
|
||||
["ensure"],
|
||||
["status","-dot"]
|
||||
["status", "-dot"]
|
||||
],
|
||||
"error-expected": "",
|
||||
"vendor-final": [
|
||||
"github.com/sdboyer/deptest",
|
||||
"github.com/sdboyer/deptestdos"
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
memo = "88d2718cda70cce45158f953d2c6ead79c1db38e67e9704aff72be8fddb096e7"
|
||||
|
||||
[inputs]
|
||||
analyzerName = "dep"
|
||||
analyzerVersion = 1
|
||||
memo = "88d2718cda70cce45158f953d2c6ead79c1db38e67e9704aff72be8fddb096e7"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/sdboyer/deptest"
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
{
|
||||
"commands": [
|
||||
["ensure"],
|
||||
["status","-json"]
|
||||
["status", "-json"]
|
||||
],
|
||||
"error-expected": "",
|
||||
"vendor-final": [
|
||||
"github.com/sdboyer/deptest",
|
||||
"github.com/sdboyer/deptestdos"
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
memo = "88d2718cda70cce45158f953d2c6ead79c1db38e67e9704aff72be8fddb096e7"
|
||||
|
||||
[inputs]
|
||||
analyzerName = "dep"
|
||||
analyzerVersion = 1
|
||||
memo = "88d2718cda70cce45158f953d2c6ead79c1db38e67e9704aff72be8fddb096e7"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/sdboyer/deptest"
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
["ensure"],
|
||||
["status"]
|
||||
],
|
||||
"error-expected": "",
|
||||
"vendor-final": [
|
||||
"github.com/sdboyer/deptest",
|
||||
"github.com/sdboyer/deptestdos"
|
||||
|
|
|
@ -14,6 +14,10 @@ import (
|
|||
// additional methods that report information about the solve run.
|
||||
type Solution interface {
|
||||
Lock
|
||||
// The name of the ProjectAnalyzer used in generating this solution.
|
||||
AnalyzerName() string
|
||||
// The version of the ProjectAanalyzer used in generating this solution.
|
||||
AnalyzerVersion() int
|
||||
Attempts() int
|
||||
}
|
||||
|
||||
|
@ -26,6 +30,12 @@ type solution struct {
|
|||
|
||||
// The hash digest of the input opts
|
||||
hd []byte
|
||||
|
||||
// The analyzer name
|
||||
analyzerName string
|
||||
|
||||
// The analyzer version
|
||||
analyzerVersion int
|
||||
}
|
||||
|
||||
// WriteDepTree takes a basedir and a Lock, and exports all the projects
|
||||
|
@ -76,3 +86,11 @@ func (r solution) Attempts() int {
|
|||
func (r solution) InputHash() []byte {
|
||||
return r.hd
|
||||
}
|
||||
|
||||
func (r solution) AnalyzerName() string {
|
||||
return r.analyzerName
|
||||
}
|
||||
|
||||
func (r solution) AnalyzerVersion() int {
|
||||
return r.analyzerVersion
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ func init() {
|
|||
}, nil),
|
||||
},
|
||||
}
|
||||
basicResult.analyzerName, basicResult.analyzerVersion = (naiveAnalyzer{}).Info()
|
||||
|
||||
// just in case something needs punishing, kubernetes is happy to oblige
|
||||
kub = atom{
|
||||
|
|
|
@ -358,7 +358,7 @@ func (s *solver) Solve() (Solution, error) {
|
|||
soln = solution{
|
||||
att: s.attempts,
|
||||
}
|
||||
|
||||
soln.analyzerName, soln.analyzerVersion = s.rd.an.Info()
|
||||
soln.hd = s.HashInputs()
|
||||
|
||||
// Convert ProjectAtoms into LockedProjects
|
||||
|
|
50
lock.go
50
lock.go
|
@ -18,15 +18,27 @@ import (
|
|||
const LockName = "Gopkg.lock"
|
||||
|
||||
type Lock struct {
|
||||
Memo []byte
|
||||
P []gps.LockedProject
|
||||
Inputs InputInfo
|
||||
P []gps.LockedProject
|
||||
}
|
||||
|
||||
type InputInfo struct {
|
||||
Memo []byte
|
||||
AnalyzerName string
|
||||
AnalyzerVersion int
|
||||
}
|
||||
|
||||
type rawLock struct {
|
||||
Memo string `toml:"memo"`
|
||||
Inputs inputInfo `toml:"inputs"`
|
||||
Projects []rawLockedProject `toml:"projects"`
|
||||
}
|
||||
|
||||
type inputInfo struct {
|
||||
Memo string `toml:"memo"`
|
||||
AnalyzerName string `toml:"analyzerName"`
|
||||
AnalyzerVersion int `toml:"analyzerVersion"`
|
||||
}
|
||||
|
||||
type rawLockedProject struct {
|
||||
Name string `toml:"name"`
|
||||
Branch string `toml:"branch,omitempty"`
|
||||
|
@ -58,11 +70,14 @@ func fromRawLock(raw rawLock) (*Lock, error) {
|
|||
P: make([]gps.LockedProject, len(raw.Projects)),
|
||||
}
|
||||
|
||||
l.Memo, err = hex.DecodeString(raw.Memo)
|
||||
l.Inputs.Memo, err = hex.DecodeString(raw.Inputs.Memo)
|
||||
if err != nil {
|
||||
return nil, errors.Errorf("invalid hash digest in lock's memo field")
|
||||
}
|
||||
|
||||
l.Inputs.AnalyzerName = raw.Inputs.AnalyzerName
|
||||
l.Inputs.AnalyzerVersion = raw.Inputs.AnalyzerVersion
|
||||
|
||||
for i, ld := range raw.Projects {
|
||||
r := gps.Revision(ld.Revision)
|
||||
|
||||
|
@ -84,11 +99,12 @@ func fromRawLock(raw rawLock) (*Lock, error) {
|
|||
}
|
||||
l.P[i] = gps.NewLockedProject(id, v, ld.Packages)
|
||||
}
|
||||
|
||||
return l, nil
|
||||
}
|
||||
|
||||
func (l *Lock) InputHash() []byte {
|
||||
return l.Memo
|
||||
return l.Inputs.Memo
|
||||
}
|
||||
|
||||
func (l *Lock) Projects() []gps.LockedProject {
|
||||
|
@ -98,7 +114,11 @@ func (l *Lock) Projects() []gps.LockedProject {
|
|||
// toRaw converts the manifest into a representation suitable to write to the lock file
|
||||
func (l *Lock) toRaw() rawLock {
|
||||
raw := rawLock{
|
||||
Memo: hex.EncodeToString(l.Memo),
|
||||
Inputs: inputInfo{
|
||||
Memo: hex.EncodeToString(l.Inputs.Memo),
|
||||
AnalyzerName: l.Inputs.AnalyzerName,
|
||||
AnalyzerVersion: l.Inputs.AnalyzerVersion,
|
||||
},
|
||||
Projects: make([]rawLockedProject, len(l.P)),
|
||||
}
|
||||
|
||||
|
@ -137,21 +157,19 @@ func (l *Lock) MarshalTOML() ([]byte, error) {
|
|||
//
|
||||
// As gps.Solution is a superset of gps.Lock, this can also be used to convert
|
||||
// solutions to dep's lock format.
|
||||
func LockFromInterface(in gps.Lock) *Lock {
|
||||
if in == nil {
|
||||
return nil
|
||||
} else if l, ok := in.(*Lock); ok {
|
||||
return l
|
||||
}
|
||||
|
||||
func LockFromInterface(in gps.Solution) *Lock {
|
||||
h, p := in.InputHash(), in.Projects()
|
||||
|
||||
l := &Lock{
|
||||
Memo: make([]byte, len(h)),
|
||||
P: make([]gps.LockedProject, len(p)),
|
||||
Inputs: InputInfo{
|
||||
Memo: make([]byte, len(h)),
|
||||
AnalyzerName: in.AnalyzerName(),
|
||||
AnalyzerVersion: in.AnalyzerVersion(),
|
||||
},
|
||||
P: make([]gps.LockedProject, len(p)),
|
||||
}
|
||||
|
||||
copy(l.Memo, h)
|
||||
copy(l.Inputs.Memo, h)
|
||||
copy(l.P, p)
|
||||
return l
|
||||
}
|
||||
|
|
16
lock_test.go
16
lock_test.go
|
@ -28,7 +28,9 @@ func TestReadLock(t *testing.T) {
|
|||
|
||||
b, _ := hex.DecodeString("2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e")
|
||||
want := &Lock{
|
||||
Memo: b,
|
||||
Inputs: InputInfo{
|
||||
Memo: b,
|
||||
},
|
||||
P: []gps.LockedProject{
|
||||
gps.NewLockedProject(
|
||||
gps.ProjectIdentifier{ProjectRoot: gps.ProjectRoot("github.com/golang/dep/internal/gps")},
|
||||
|
@ -52,7 +54,9 @@ func TestReadLock(t *testing.T) {
|
|||
|
||||
b, _ = hex.DecodeString("2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e")
|
||||
want = &Lock{
|
||||
Memo: b,
|
||||
Inputs: InputInfo{
|
||||
Memo: b,
|
||||
},
|
||||
P: []gps.LockedProject{
|
||||
gps.NewLockedProject(
|
||||
gps.ProjectIdentifier{ProjectRoot: gps.ProjectRoot("github.com/golang/dep/internal/gps")},
|
||||
|
@ -75,7 +79,9 @@ func TestWriteLock(t *testing.T) {
|
|||
want := h.GetTestFileString(golden)
|
||||
memo, _ := hex.DecodeString("2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e")
|
||||
l := &Lock{
|
||||
Memo: memo,
|
||||
Inputs: InputInfo{
|
||||
Memo: memo,
|
||||
},
|
||||
P: []gps.LockedProject{
|
||||
gps.NewLockedProject(
|
||||
gps.ProjectIdentifier{ProjectRoot: gps.ProjectRoot("github.com/golang/dep/internal/gps")},
|
||||
|
@ -104,7 +110,9 @@ func TestWriteLock(t *testing.T) {
|
|||
want = h.GetTestFileString(golden)
|
||||
memo, _ = hex.DecodeString("2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e")
|
||||
l = &Lock{
|
||||
Memo: memo,
|
||||
Inputs: InputInfo{
|
||||
Memo: memo,
|
||||
},
|
||||
P: []gps.LockedProject{
|
||||
gps.NewLockedProject(
|
||||
gps.ProjectIdentifier{ProjectRoot: gps.ProjectRoot("github.com/golang/dep/internal/gps")},
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
[inputs]
|
||||
memo = "000aaa2a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e"
|
||||
|
||||
[[projects]]
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
memo = "2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e"
|
||||
|
||||
[inputs]
|
||||
analyzerName = ""
|
||||
analyzerVersion = 0
|
||||
memo = "2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
memo = "2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e"
|
||||
|
||||
[inputs]
|
||||
analyzerName = ""
|
||||
analyzerVersion = 0
|
||||
memo = "2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/golang/dep/internal/gps"
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
Memo: 595716d270828e763c811ef79c9c41f85b1d1bfbdfe85280036405c03772206c -> 2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e
|
||||
|
||||
Add:
|
||||
[[projects]]
|
||||
name = "github.com/sdboyer/deptest"
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
memo = "595716d270828e763c811ef79c9c41f85b1d1bfbdfe85280036405c03772206c"
|
||||
|
||||
[inputs]
|
||||
analyzerName = ""
|
||||
analyzerVersion = 0
|
||||
memo = "595716d270828e763c811ef79c9c41f85b1d1bfbdfe85280036405c03772206c"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/sdboyer/dep-test"
|
||||
|
|
|
@ -261,7 +261,7 @@ func TestSafeWriter_ModifiedLock(t *testing.T) {
|
|||
|
||||
originalLock := new(Lock)
|
||||
*originalLock = *pc.Project.Lock
|
||||
originalLock.Memo = []byte{} // zero out the input hash to ensure non-equivalency
|
||||
originalLock.Inputs.Memo = []byte{} // zero out the input hash to ensure non-equivalency
|
||||
sw, _ := NewSafeWriter(nil, originalLock, pc.Project.Lock, VendorOnChanged)
|
||||
|
||||
// Verify prepared actions
|
||||
|
@ -308,7 +308,7 @@ func TestSafeWriter_ModifiedLockSkipVendor(t *testing.T) {
|
|||
|
||||
originalLock := new(Lock)
|
||||
*originalLock = *pc.Project.Lock
|
||||
originalLock.Memo = []byte{} // zero out the input hash to ensure non-equivalency
|
||||
originalLock.Inputs.Memo = []byte{} // zero out the input hash to ensure non-equivalency
|
||||
sw, _ := NewSafeWriter(nil, originalLock, pc.Project.Lock, VendorNever)
|
||||
|
||||
// Verify prepared actions
|
||||
|
|
Загрузка…
Ссылка в новой задаче