diff options
Diffstat (limited to 'src/pkg/go/build')
-rw-r--r-- | src/pkg/go/build/build.go | 17 | ||||
-rw-r--r-- | src/pkg/go/build/deps_test.go | 17 | ||||
-rw-r--r-- | src/pkg/go/build/doc.go | 9 | ||||
-rw-r--r-- | src/pkg/go/build/syslist.go | 4 |
4 files changed, 32 insertions, 15 deletions
diff --git a/src/pkg/go/build/build.go b/src/pkg/go/build/build.go index 50d2fb4ae..412abea3a 100644 --- a/src/pkg/go/build/build.go +++ b/src/pkg/go/build/build.go @@ -292,10 +292,10 @@ func defaultContext() Context { // say "+build go1.x", and code that should only be built before Go 1.x // (perhaps it is the stub to use in that case) should say "+build !go1.x". // - // When we reach Go 1.3 the line will read - // c.ReleaseTags = []string{"go1.1", "go1.2", "go1.3"} + // When we reach Go 1.4 the line will read + // c.ReleaseTags = []string{"go1.1", "go1.2", "go1.3", "go1.4"} // and so on. - c.ReleaseTags = []string{"go1.1", "go1.2"} + c.ReleaseTags = []string{"go1.1", "go1.2", "go1.3"} switch os.Getenv("CGO_ENABLED") { case "1": @@ -303,8 +303,7 @@ func defaultContext() Context { case "0": c.CgoEnabled = false default: - // golang.org/issue/5141 - // cgo should be disabled for cross compilation builds + // cgo must be explicitly enabled for cross compilation builds if runtime.GOARCH == c.GOARCH && runtime.GOOS == c.GOOS { c.CgoEnabled = cgoEnabled[c.GOOS+"/"+c.GOARCH] break @@ -358,6 +357,7 @@ type Package struct { IgnoredGoFiles []string // .go source files ignored for this build CFiles []string // .c source files CXXFiles []string // .cc, .cpp and .cxx source files + MFiles []string // .m (Objective-C) source files HFiles []string // .h, .hh, .hpp and .hxx source files SFiles []string // .s source files SwigFiles []string // .swig files @@ -622,6 +622,9 @@ Found: case ".cc", ".cpp", ".cxx": p.CXXFiles = append(p.CXXFiles, name) continue + case ".m": + p.MFiles = append(p.MFiles, name) + continue case ".h", ".hh", ".hpp", ".hxx": p.HFiles = append(p.HFiles, name) continue @@ -789,7 +792,7 @@ func (ctxt *Context) matchFile(dir, name string, returnImports bool, allTags map } switch ext { - case ".go", ".c", ".cc", ".cxx", ".cpp", ".s", ".h", ".hh", ".hpp", ".hxx", ".S", ".swig", ".swigcxx": + case ".go", ".c", ".cc", ".cxx", ".cpp", ".m", ".s", ".h", ".hh", ".hpp", ".hxx", ".S", ".swig", ".swigcxx": // tentatively okay - read to make sure case ".syso": // binary, no reading @@ -1207,7 +1210,7 @@ func ArchChar(goarch string) (string, error) { switch goarch { case "386": return "8", nil - case "amd64": + case "amd64", "amd64p32": return "6", nil case "arm": return "5", nil diff --git a/src/pkg/go/build/deps_test.go b/src/pkg/go/build/deps_test.go index dd162c7db..7421e144f 100644 --- a/src/pkg/go/build/deps_test.go +++ b/src/pkg/go/build/deps_test.go @@ -8,6 +8,7 @@ package build import ( + "runtime" "sort" "testing" ) @@ -29,7 +30,7 @@ var pkgDeps = map[string][]string{ "errors": {}, "io": {"errors", "sync"}, "runtime": {"unsafe"}, - "sync": {"sync/atomic", "unsafe"}, + "sync": {"runtime", "sync/atomic", "unsafe"}, "sync/atomic": {"unsafe"}, "unsafe": {}, @@ -125,7 +126,7 @@ var pkgDeps = map[string][]string{ "os": {"L1", "os", "syscall", "time"}, "path/filepath": {"L2", "os", "syscall"}, "io/ioutil": {"L2", "os", "path/filepath", "time"}, - "os/exec": {"L2", "os", "syscall"}, + "os/exec": {"L2", "os", "path/filepath", "syscall"}, "os/signal": {"L2", "os", "syscall"}, // OS enables basic operating system functionality, @@ -301,7 +302,7 @@ var pkgDeps = map[string][]string{ // SSL/TLS. "crypto/tls": { "L4", "CRYPTO-MATH", "CGO", "OS", - "crypto/x509", "encoding/pem", "net", "syscall", + "container/list", "crypto/x509", "encoding/pem", "net", "syscall", }, "crypto/x509": { "L4", "CRYPTO-MATH", "OS", "CGO", @@ -359,7 +360,7 @@ func allowed(pkg string) map[string]bool { } var bools = []bool{false, true} -var geese = []string{"darwin", "dragonfly", "freebsd", "linux", "netbsd", "openbsd", "plan9", "windows"} +var geese = []string{"darwin", "dragonfly", "freebsd", "linux", "nacl", "netbsd", "openbsd", "plan9", "solaris", "windows"} var goarches = []string{"386", "amd64", "arm"} type osPkg struct { @@ -374,6 +375,11 @@ var allowedErrors = map[osPkg]bool{ } func TestDependencies(t *testing.T) { + if runtime.GOOS == "nacl" { + // NaCl tests run in a limited file system and we do not + // provide access to every source file. + t.Skip("skipping on NaCl") + } var all []string for k := range pkgDeps { @@ -387,6 +393,9 @@ func TestDependencies(t *testing.T) { if isMacro(pkg) { continue } + if pkg == "runtime/cgo" && !ctxt.CgoEnabled { + continue + } p, err := ctxt.Import(pkg, "", 0) if err != nil { if allowedErrors[osPkg{ctxt.GOOS, pkg}] { diff --git a/src/pkg/go/build/doc.go b/src/pkg/go/build/doc.go index b2f04ea45..f17f76ccc 100644 --- a/src/pkg/go/build/doc.go +++ b/src/pkg/go/build/doc.go @@ -57,11 +57,15 @@ // // Build Constraints // -// A build constraint is a line comment beginning with the directive +build +// A build constraint, also known as a build tag, is a line comment that begins +// +// // +build +// // that lists the conditions under which a file should be included in the package. // Constraints may appear in any kind of source file (not just Go), but // they must appear near the top of the file, preceded -// only by blank lines and other line comments. +// only by blank lines and other line comments. These rules mean that in Go +// files a build constraint must appear before the package clause. // // To distinguish build constraints from package documentation, a series of // build constraints must be followed by a blank line. @@ -95,6 +99,7 @@ // - "cgo", if ctxt.CgoEnabled is true // - "go1.1", from Go version 1.1 onward // - "go1.2", from Go version 1.2 onward +// - "go1.3", from Go version 1.3 onward // - any additional words listed in ctxt.BuildTags // // If a file's name, after stripping the extension and a possible _test suffix, diff --git a/src/pkg/go/build/syslist.go b/src/pkg/go/build/syslist.go index e1fbf6330..5c42b946b 100644 --- a/src/pkg/go/build/syslist.go +++ b/src/pkg/go/build/syslist.go @@ -4,5 +4,5 @@ package build -const goosList = "darwin dragonfly freebsd linux netbsd openbsd plan9 windows " -const goarchList = "386 amd64 arm " +const goosList = "darwin dragonfly freebsd linux nacl netbsd openbsd plan9 solaris windows " +const goarchList = "386 amd64 amd64p32 arm " |