@@ -45,7 +45,7 @@ func GetCachedGoroot(config *compileopts.Config) (string, error) {
45
45
}
46
46
47
47
// Find the overrides needed for the goroot.
48
- overrides := pathsToOverride (config .GoMinorVersion , needsSyscallPackage ( config .BuildTags () ))
48
+ overrides := pathsToOverride (config .GoMinorVersion , config .BuildTags ())
49
49
50
50
// Resolve the merge links within the goroot.
51
51
merge , err := listGorootMergeLinks (goroot , tinygoroot , overrides )
@@ -225,9 +225,20 @@ func needsSyscallPackage(buildTags []string) bool {
225
225
return false
226
226
}
227
227
228
+ // linuxNetworking returns whether the unmodified go linux net stack should be used
229
+ // until the full rework of the net package is done.
230
+ func linuxNetworking (buildTags []string ) bool {
231
+ for _ , tag := range buildTags {
232
+ if tag == "linux" {
233
+ return true
234
+ }
235
+ }
236
+ return false
237
+ }
238
+
228
239
// The boolean indicates whether to merge the subdirs. True means merge, false
229
240
// means use the TinyGo version.
230
- func pathsToOverride (goMinor int , needsSyscallPackage bool ) map [string ]bool {
241
+ func pathsToOverride (goMinor int , buildTags [] string ) map [string ]bool {
231
242
paths := map [string ]bool {
232
243
"" : true ,
233
244
"crypto/" : true ,
@@ -265,15 +276,16 @@ func pathsToOverride(goMinor int, needsSyscallPackage bool) map[string]bool {
265
276
paths ["crypto/internal/boring/sig/" ] = false
266
277
}
267
278
268
- if needsSyscallPackage {
279
+ if needsSyscallPackage ( buildTags ) {
269
280
paths ["syscall/" ] = true // include syscall/js
270
281
}
271
282
272
- // to enable network support for linux systems, reuse the Go version of the net package
273
- // and the according runtime functions
274
- // if runtime.GOOS == "linux" {
275
- // paths["runtime/netpoll/"] = true
276
- // }
283
+ if linuxNetworking (buildTags ) {
284
+ for _ , v := range []string {"crypto/tls/" , "net/http/" , "net/" } {
285
+ delete (paths , v ) // remote entries so go stdlib is used
286
+ }
287
+ }
288
+
277
289
return paths
278
290
}
279
291
0 commit comments