Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

Commit

Permalink
cmd/dep: fix analyzer to always use the same name
Browse files Browse the repository at this point in the history
Different names should be used for different solve algorithms. Otherwise
running dep init then dep ensure will always result in a modified lock hash.
  • Loading branch information
carolynvs committed Aug 30, 2017
1 parent 153953d commit 0e74a8d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 21 deletions.
10 changes: 3 additions & 7 deletions cmd/dep/root_analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,11 @@ func (a *rootAnalyzer) FinalizeRootManifestAndLock(m *dep.Manifest, l *dep.Lock,
}
}

// Info provides metadata on the analyzer algorithm used during solve.
func (a *rootAnalyzer) Info() gps.ProjectAnalyzerInfo {
name := "dep"
version := 1
if !a.skipTools {
name = "dep+import"
}
return gps.ProjectAnalyzerInfo{
Name: name,
Version: version,
Name: "dep",
Version: 1,
}
}

Expand Down
14 changes: 0 additions & 14 deletions cmd/dep/root_analyzer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,6 @@ import (
"github.com/pkg/errors"
)

func TestRootAnalyzer_Info(t *testing.T) {
testCases := map[bool]string{
true: "dep",
false: "dep+import",
}
for skipTools, want := range testCases {
a := rootAnalyzer{skipTools: skipTools}
got := a.Info().Name
if got != want {
t.Errorf("Expected the name of the importer with skipTools=%t to be '%s', got '%s'", skipTools, want, got)
}
}
}

func TestLookupVersionForLockedProject_MatchRevisionToTag(t *testing.T) {
h := test.NewHelper(t)
defer h.Cleanup()
Expand Down

0 comments on commit 0e74a8d

Please sign in to comment.