From 036731c170e4d3b5458ad156b52e76611fd3d13c Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Wed, 14 Mar 2012 13:19:14 -0700 Subject: [PATCH] go/build: clearer argument name for Import (src -> srcDir) R=rsc CC=golang-dev https://golang.org/cl/5820052 --- src/pkg/go/build/build.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/pkg/go/build/build.go b/src/pkg/go/build/build.go index d2dbb58a1c5..ba3bfdf9a0f 100644 --- a/src/pkg/go/build/build.go +++ b/src/pkg/go/build/build.go @@ -328,10 +328,10 @@ func (e *NoGoError) Error() string { } // Import returns details about the Go package named by the import path, -// interpreting local import paths relative to the src directory. If the path -// is a local import path naming a package that can be imported using a -// standard import path, the returned package will set p.ImportPath to -// that path. +// interpreting local import paths relative to the srcDir directory. +// If the path is a local import path naming a package that can be imported +// using a standard import path, the returned package will set p.ImportPath +// to that path. // // In the directory containing the package, .go, .c, .h, and .s files are // considered part of the package except for: @@ -343,7 +343,7 @@ func (e *NoGoError) Error() string { // If an error occurs, Import returns a non-nil error also returns a non-nil // *Package containing partial information. // -func (ctxt *Context) Import(path string, src string, mode ImportMode) (*Package, error) { +func (ctxt *Context) Import(path string, srcDir string, mode ImportMode) (*Package, error) { p := &Package{ ImportPath: path, } @@ -363,11 +363,11 @@ func (ctxt *Context) Import(path string, src string, mode ImportMode) (*Package, binaryOnly := false if IsLocalImport(path) { - if src == "" { + if srcDir == "" { return p, fmt.Errorf("import %q: import relative to unknown directory", path) } if !ctxt.isAbsPath(path) { - p.Dir = ctxt.joinPath(src, path) + p.Dir = ctxt.joinPath(srcDir, path) } // Determine canonical import path, if any. if ctxt.GOROOT != "" { @@ -640,8 +640,8 @@ func cleanImports(m map[string][]token.Position) ([]string, map[string][]token.P } // Import is shorthand for Default.Import. -func Import(path, src string, mode ImportMode) (*Package, error) { - return Default.Import(path, src, mode) +func Import(path, srcDir string, mode ImportMode) (*Package, error) { + return Default.Import(path, srcDir, mode) } // ImportDir is shorthand for Default.ImportDir.