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

Commit e747186

Browse files
authored
Merge pull request #526 from jmank88/remove_trace_param
gps/solver - Remove SolveParameters.Trace
2 parents 553fbf0 + 3193a3d commit e747186

File tree

8 files changed

+4
-24
lines changed

8 files changed

+4
-24
lines changed

cmd/dep/ensure.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ func (cmd *ensureCommand) Run(ctx *dep.Ctx, args []string) error {
123123

124124
params := p.MakeParams()
125125
if *verbose {
126-
params.Trace = true
127126
params.TraceLogger = log.New(os.Stderr, "", 0)
128127
}
129128
params.RootPackageTree, err = pkgtree.ListPackages(p.AbsRoot, string(p.ImportRoot))

cmd/dep/init.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ func (cmd *initCommand) Run(ctx *dep.Ctx, args []string) error {
155155
}
156156

157157
if *verbose {
158-
params.Trace = true
159158
params.TraceLogger = log.New(os.Stderr, "", 0)
160159
}
161160
s, err := gps.Prepare(params, sm)

cmd/dep/prune.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ func (cmd *pruneCommand) Run(ctx *dep.Ctx, args []string) error {
6363
params.RootPackageTree = ptree
6464

6565
if *verbose {
66-
params.Trace = true
6766
params.TraceLogger = log.New(os.Stderr, "", 0)
6867
}
6968

cmd/dep/remove.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ func (cmd *removeCommand) Run(ctx *dep.Ctx, args []string) error {
166166
params.RootPackageTree = pkgT
167167

168168
if *verbose {
169-
params.Trace = true
170169
params.TraceLogger = log.New(os.Stderr, "", 0)
171170
}
172171
s, err := gps.Prepare(params, sm)

cmd/dep/status.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,6 @@ func runStatusAll(out outputter, p *dep.Project, sm *gps.SourceMgr) error {
256256
// Locks aren't a part of the input hash check, so we can omit it.
257257
}
258258
if *verbose {
259-
params.Trace = true
260259
params.TraceLogger = log.New(os.Stderr, "", 0)
261260
}
262261

gps/example.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ func main() {
3636
// Set up params, including tracing
3737
params := gps.SolveParameters{
3838
RootDir: root,
39-
Trace: true,
4039
TraceLogger: log.New(os.Stdout, "", 0),
4140
ProjectAnalyzer: NaiveAnalyzer{},
4241
}

gps/solve_test.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ func fixSolve(params SolveParameters, sm SourceManager, t *testing.T) (Solution,
7979
// Trace unconditionally; by passing the trace through t.Log(), the testing
8080
// system will decide whether or not to actually show the output (based on
8181
// -v, or selectively on test failure).
82-
params.Trace = true
8382
params.TraceLogger = log.New(testlogger{T: t}, "", 0)
8483

8584
s, err := Prepare(params, sm)
@@ -374,13 +373,6 @@ func TestBadSolveOpts(t *testing.T) {
374373
},
375374
},
376375
}
377-
params.Trace = true
378-
_, err = Prepare(params, sm)
379-
if err == nil {
380-
t.Errorf("Should have errored on trace with no logger")
381-
} else if !strings.Contains(err.Error(), "no logger provided") {
382-
t.Error("Prepare should have given error on missing trace logger, but gave:", err)
383-
}
384376
params.TraceLogger = log.New(ioutil.Discard, "", 0)
385377

386378
params.Manifest = simpleRootManifest{

gps/solver.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,9 @@ type SolveParameters struct {
105105
// typical case.
106106
Downgrade bool
107107

108-
// Trace controls whether the solver will generate informative trace output
109-
// as it moves through the solving process.
110-
Trace bool
111-
112-
// TraceLogger is the logger to use for generating trace output. If Trace is
113-
// true but no logger is provided, solving will result in an error.
108+
// TraceLogger is the logger to use for generating trace output. If set, the
109+
// solver will generate informative trace output as it moves through the
110+
// solving process.
114111
TraceLogger *log.Logger
115112
}
116113

@@ -122,7 +119,7 @@ type solver struct {
122119
// starts moving forward again.
123120
attempts int
124121

125-
// Logger used exclusively for trace output, if the trace option is set.
122+
// Logger used exclusively for trace output, or nil to suppress.
126123
tl *log.Logger
127124

128125
// A bridge to the standard SourceManager. The adapter does some local
@@ -281,9 +278,6 @@ func Prepare(params SolveParameters, sm SourceManager) (Solver, error) {
281278
if sm == nil {
282279
return nil, badOptsFailure("must provide non-nil SourceManager")
283280
}
284-
if params.Trace && params.TraceLogger == nil {
285-
return nil, badOptsFailure("trace requested, but no logger provided")
286-
}
287281

288282
rd, err := params.toRootdata()
289283
if err != nil {

0 commit comments

Comments
 (0)