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

Commit be14ae0

Browse files
committed
Update feedback to support revision without version
Doing this so we can get feedback for the detached head use case that govendor frequently has.
1 parent 465e239 commit be14ae0

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

cmd/dep/govendor_importer.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,7 @@ func (g *govendorImporter) convert(pr gps.ProjectRoot) (*dep.Manifest, *dep.Lock
155155
pi.Source = pkg.Origin
156156
}
157157
revision := gps.Revision(pkg.Revision)
158-
pp := manifest.Constraints[pi.ProjectRoot]
159-
version, err := lookupVersionForLockedProject(pi, pp.Constraint, revision, g.sm)
158+
version, err := lookupVersionForLockedProject(pi, nil, revision, g.sm)
160159
if err != nil {
161160
// Only warn about the problem, it is not enough to warrant failing
162161
g.logger.Println(err.Error())

internal/feedback/feedback.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func (cf ConstraintFeedback) LogFeedback(logger *log.Logger) {
7373
if cf.Constraint != "" {
7474
logger.Printf(" %v", GetUsingFeedback(cf.Constraint, cf.ConstraintType, cf.DependencyType, cf.ProjectPath))
7575
}
76-
if cf.LockedVersion != "" && cf.Revision != "" {
76+
if cf.Revision != "" {
7777
logger.Printf(" %v", GetLockingFeedback(cf.LockedVersion, cf.Revision, cf.DependencyType, cf.ProjectPath))
7878
}
7979
}
@@ -104,7 +104,11 @@ func GetLockingFeedback(version, revision, depType, projectPath string) string {
104104
}
105105

106106
if depType == DepTypeImported {
107-
return fmt.Sprintf("Trying %s (%s) as initial lock for %s %s", version, revision, depType, projectPath)
107+
if version != "" {
108+
return fmt.Sprintf("Trying %s (%s) as initial lock for %s %s", version, revision, depType, projectPath)
109+
} else {
110+
return fmt.Sprintf("Trying * (%s) as initial lock for %s %s", revision, depType, projectPath)
111+
}
108112
}
109113
return fmt.Sprintf("Locking in %s (%s) for %s %s", version, revision, depType, projectPath)
110114
}

0 commit comments

Comments
 (0)