@@ -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 ,
@@ -264,15 +275,16 @@ func pathsToOverride(goMinor int, needsSyscallPackage bool) map[string]bool {
264
275
paths ["crypto/internal/boring/sig/" ] = false
265
276
}
266
277
267
- if needsSyscallPackage {
278
+ if needsSyscallPackage ( buildTags ) {
268
279
paths ["syscall/" ] = true // include syscall/js
269
280
}
270
281
271
- // to enable network support for linux systems, reuse the Go version of the net package
272
- // and the according runtime functions
273
- // if runtime.GOOS == "linux" {
274
- // paths["runtime/netpoll/"] = true
275
- // }
282
+ if linuxNetworking (buildTags ) {
283
+ for _ , v := range []string {"crypto/tls/" , "net/http/" , "net/" } {
284
+ delete (paths , v ) // remote entries so go stdlib is used
285
+ }
286
+ }
287
+
276
288
return paths
277
289
}
278
290
0 commit comments