summaryrefslogtreecommitdiff
path: root/src/pkg/go/build/dir.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/go/build/dir.go')
-rw-r--r--src/pkg/go/build/dir.go15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/pkg/go/build/dir.go b/src/pkg/go/build/dir.go
index 77e80bff0..e0000b534 100644
--- a/src/pkg/go/build/dir.go
+++ b/src/pkg/go/build/dir.go
@@ -50,7 +50,6 @@ func ScanDir(dir string, allowMain bool) (info *DirInfo, err os.Error) {
var di DirInfo
imported := make(map[string]bool)
- pkgName := ""
fset := token.NewFileSet()
for i := range dirs {
d := &dirs[i]
@@ -89,17 +88,17 @@ func ScanDir(dir string, allowMain bool) (info *DirInfo, err os.Error) {
if s == "documentation" {
continue
}
- if pkgName == "" {
- pkgName = s
- } else if pkgName != s {
+ if di.PkgName == "" {
+ di.PkgName = s
+ } else if di.PkgName != s {
// Only if all files in the directory are in package main
- // do we return pkgName=="main".
+ // do we return PkgName=="main".
// A mix of main and another package reverts
// to the original (allowMain=false) behaviour.
- if s == "main" || pkgName == "main" {
+ if s == "main" || di.PkgName == "main" {
return ScanDir(dir, false)
}
- return nil, os.ErrorString("multiple package names in " + dir)
+ return nil, os.NewError("multiple package names in " + dir)
}
isCgo := false
for _, spec := range pf.Imports {
@@ -140,7 +139,7 @@ func goodOSArch(filename string) bool {
if dot := strings.Index(filename, "."); dot != -1 {
filename = filename[:dot]
}
- l := strings.Split(filename, "_", -1)
+ l := strings.Split(filename, "_")
n := len(l)
if n == 0 {
return true