Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1500)

Delta Between Two Patch Sets: src/pkg/go/build/build.go

Issue 8134043: code review 8134043: go/build: disable cgo when cross compiling (Closed)
Left Patch Set: diff -r cfe93dfc5788 https://code.google.com/p/go Created 10 years, 12 months ago
Right Patch Set: diff -r e8d3578a3f34 https://code.google.com/p/go Created 10 years, 12 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2011 The Go Authors. All rights reserved. 1 // Copyright 2011 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package build 5 package build
6 6
7 import ( 7 import (
8 "bytes" 8 "bytes"
9 "errors" 9 "errors"
10 "fmt" 10 "fmt"
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 c.CgoEnabled = true 300 c.CgoEnabled = true
301 case "0": 301 case "0":
302 c.CgoEnabled = false 302 c.CgoEnabled = false
303 default: 303 default:
304 // golang.org/issue/5141 304 // golang.org/issue/5141
305 // cgo should be disabled for cross compilation builds 305 // cgo should be disabled for cross compilation builds
306 if runtime.GOARCH == c.GOARCH && runtime.GOOS == c.GOOS { 306 if runtime.GOARCH == c.GOARCH && runtime.GOOS == c.GOOS {
307 c.CgoEnabled = cgoEnabled[c.GOOS+"/"+c.GOARCH] 307 c.CgoEnabled = cgoEnabled[c.GOOS+"/"+c.GOARCH]
308 break 308 break
309 } 309 }
310 fmt.Printf("# CGO_ENABLED not set. Defaulting to '0' for %s/%s." , c.GOOS, c.GOARCH)
311 c.CgoEnabled = false 310 c.CgoEnabled = false
312 } 311 }
313 312
314 return c 313 return c
315 } 314 }
316 315
317 func envOr(name, def string) string { 316 func envOr(name, def string) string {
318 s := os.Getenv(name) 317 s := os.Getenv(name)
319 if s == "" { 318 if s == "" {
320 return def 319 return def
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
1115 switch goarch { 1114 switch goarch {
1116 case "386": 1115 case "386":
1117 return "8", nil 1116 return "8", nil
1118 case "amd64": 1117 case "amd64":
1119 return "6", nil 1118 return "6", nil
1120 case "arm": 1119 case "arm":
1121 return "5", nil 1120 return "5", nil
1122 } 1121 }
1123 return "", errors.New("unsupported GOARCH " + goarch) 1122 return "", errors.New("unsupported GOARCH " + goarch)
1124 } 1123 }
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b