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

Commit 4c5e459

Browse files
authored
Merge pull request #353 from spenczar/cmd_use_interfaces
Use gps.SourceManager instead of *gps.SourceMgr in cmd/dep
2 parents e747186 + 25a5016 commit 4c5e459

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

cmd/dep/ensure.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ func applyUpdateArgs(args []string, params *gps.SolveParameters) {
189189
}
190190
}
191191

192-
func applyEnsureArgs(args []string, overrides stringSlice, p *dep.Project, sm *gps.SourceMgr, params *gps.SolveParameters) error {
192+
func applyEnsureArgs(args []string, overrides stringSlice, p *dep.Project, sm gps.SourceManager, params *gps.SolveParameters) error {
193193
var errs []error
194194
for _, arg := range args {
195195
pc, err := getProjectConstraint(arg, sm)
@@ -262,7 +262,7 @@ func (s *stringSlice) Set(value string) error {
262262
return nil
263263
}
264264

265-
func getProjectConstraint(arg string, sm *gps.SourceMgr) (gps.ProjectConstraint, error) {
265+
func getProjectConstraint(arg string, sm gps.SourceManager) (gps.ProjectConstraint, error) {
266266
constraint := gps.ProjectConstraint{
267267
Constraint: gps.Any(), // default to any; avoids panics later
268268
}

cmd/dep/init.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -273,14 +273,14 @@ type projectData struct {
273273
ondisk map[gps.ProjectRoot]gps.Version // projects that were found on disk
274274
}
275275

276-
func getProjectData(ctx *dep.Ctx, pkgT pkgtree.PackageTree, cpr string, sm *gps.SourceMgr) (projectData, error) {
276+
func getProjectData(ctx *dep.Ctx, pkgT pkgtree.PackageTree, cpr string, sm gps.SourceManager) (projectData, error) {
277277
constraints := make(gps.ProjectConstraints)
278278
dependencies := make(map[gps.ProjectRoot][]string)
279279
packages := make(map[string]bool)
280280
notondisk := make(map[gps.ProjectRoot]bool)
281281
ondisk := make(map[gps.ProjectRoot]gps.Version)
282282

283-
syncDep := func(pr gps.ProjectRoot, sm *gps.SourceMgr) {
283+
syncDep := func(pr gps.ProjectRoot, sm gps.SourceManager) {
284284
message := "Cached"
285285
if err := sm.SyncSourceFor(gps.ProjectIdentifier{ProjectRoot: pr}); err != nil {
286286
message = "Unable to cache"

cmd/dep/status.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ type MissingStatus struct {
234234
MissingPackages []string
235235
}
236236

237-
func runStatusAll(out outputter, p *dep.Project, sm *gps.SourceMgr) error {
237+
func runStatusAll(out outputter, p *dep.Project, sm gps.SourceManager) error {
238238
if p.Lock == nil {
239239
// TODO if we have no lock file, do...other stuff
240240
return nil
@@ -434,7 +434,7 @@ func formatVersion(v gps.Version) string {
434434
return v.String()
435435
}
436436

437-
func collectConstraints(ptree pkgtree.PackageTree, p *dep.Project, sm *gps.SourceMgr) map[string][]gps.Constraint {
437+
func collectConstraints(ptree pkgtree.PackageTree, p *dep.Project, sm gps.SourceManager) map[string][]gps.Constraint {
438438
// TODO
439439
return map[string][]gps.Constraint{}
440440
}

gps/manager_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ import (
2323
var bd string
2424

2525
// An analyzer that passes nothing back, but doesn't error. This is the naive
26-
// case - no constraints, no lock, and no errors. The SourceMgr will interpret
27-
// this as open/Any constraints on everything in the import graph.
26+
// case - no constraints, no lock, and no errors. The SourceManager will
27+
// interpret this as open/Any constraints on everything in the import graph.
2828
type naiveAnalyzer struct{}
2929

3030
func (naiveAnalyzer) DeriveManifestAndLock(string, ProjectRoot) (Manifest, Lock, error) {
@@ -544,7 +544,7 @@ func TestMultiFetchThreadsafe(t *testing.T) {
544544
//mkPI("bitbucket.org/sdboyer/nobm"),
545545
}
546546

547-
do := func(name string, sm *SourceMgr) {
547+
do := func(name string, sm SourceManager) {
548548
t.Run(name, func(t *testing.T) {
549549
// This gives us ten calls per op, per project, which should be(?)
550550
// decently likely to reveal underlying concurrency problems

test_project_context_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ type TestProjectContext struct {
2020

2121
Context *Ctx
2222
Project *Project
23-
SourceManager *gps.SourceMgr
23+
SourceManager gps.SourceManager
2424
}
2525

2626
// NewTestProjectContext creates a new on-disk test project

0 commit comments

Comments
 (0)