File tree Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import (
13
13
"go/build"
14
14
"internal/buildcfg"
15
15
"internal/cfg"
16
+ "internal/platform"
16
17
"io"
17
18
"os"
18
19
"path/filepath"
@@ -132,7 +133,7 @@ func defaultContext() build.Context {
132
133
// 3. Otherwise, use built-in default for GOOS/GOARCH.
133
134
// Recreate that logic here with the new GOOS/GOARCH setting.
134
135
if v := Getenv ("CGO_ENABLED" ); v == "0" || v == "1" {
135
- ctxt .CgoEnabled , CGOChanged = v [0 ] == '1' , v [ 0 ] != '0 '
136
+ ctxt .CgoEnabled = v [0 ] == '1'
136
137
} else if ctxt .GOOS != runtime .GOOS || ctxt .GOARCH != runtime .GOARCH {
137
138
ctxt .CgoEnabled = false
138
139
} else {
@@ -166,6 +167,12 @@ func defaultContext() build.Context {
166
167
}
167
168
}
168
169
}
170
+ CGOChanged = ctxt .CgoEnabled != func () bool {
171
+ if runtime .GOARCH == ctxt .GOARCH && runtime .GOOS == ctxt .GOOS {
172
+ return platform .CgoSupported (ctxt .GOOS , ctxt .GOARCH )
173
+ }
174
+ return false
175
+ }()
169
176
170
177
ctxt .OpenFile = func (path string ) (io.ReadCloser , error ) {
171
178
return fsys .Open (path )
Original file line number Diff line number Diff line change @@ -129,7 +129,8 @@ func MkEnv() []cfg.EnvVar {
129
129
env [i ].Changed = true
130
130
}
131
131
case "GODEBUG" :
132
- env [i ].Value , env [i ].Changed = cfg .EnvOrAndChanged ("GODEBUG" , "" )
132
+ env [i ].Value = os .Getenv ("GODEBUG" )
133
+ env [i ].Changed = env [i ].Value != ""
133
134
}
134
135
}
135
136
Original file line number Diff line number Diff line change @@ -69,5 +69,4 @@ const KnownEnv = `
69
69
GOWORK
70
70
GO_EXTLINK_ENABLED
71
71
PKG_CONFIG
72
- GODEBUG
73
72
`
You can’t perform that action at this time.
0 commit comments