diff --git a/context.go b/context.go index d1f855d9..573963d6 100644 --- a/context.go +++ b/context.go @@ -25,6 +25,7 @@ type Ctx struct { Verbose bool // Enables more verbose logging. } +// NewContext creates a struct containing path information and loggers. func NewContext(wd string, gopaths []string, out, err *log.Logger, verbose bool) *Ctx { ctx := &Ctx{ WorkingDir: wd, @@ -167,9 +168,8 @@ func (c *Ctx) ResolveProjectRootAndGOPATH(path string) (string, string, error) { // Otherwise, either the symlink or the resolved path is within a GOPATH. if pgp == "" { return resolved, rgp, nil - } else { - return path, pgp, nil } + return path, pgp, nil } // detectGOPATH detects the GOPATH for a given path from ctx.GOPATHs. diff --git a/context_test.go b/context_test.go index 27aa3365..c64f4ef9 100644 --- a/context_test.go +++ b/context_test.go @@ -176,7 +176,7 @@ func TestLoadProject(t *testing.T) { start := testcase.start ctx := &Ctx{ - GOPATH: tg.Path("."), + GOPATHs: []string{tg.Path(".")}, WorkingDir: tg.Path(start), Out: discardLogger, Err: discardLogger,