@@ -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,14 +225,25 @@ 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
- "" : true ,
233
- "crypto/" : true ,
234
- "crypto/rand/" : false ,
235
- // "crypto/tls/": false,
243
+ "" : true ,
244
+ "crypto/" : true ,
245
+ "crypto/rand/" : false ,
246
+ "crypto/tls/" : false ,
236
247
"device/" : false ,
237
248
"examples/" : false ,
238
249
"internal/" : true ,
@@ -246,13 +257,13 @@ func pathsToOverride(goMinor int, needsSyscallPackage bool) map[string]bool {
246
257
"internal/wasi/" : false ,
247
258
"machine/" : false ,
248
259
"net/" : false ,
249
- // "net/http/": false,
250
- "os/" : true ,
251
- "reflect/" : false ,
252
- "runtime/" : false ,
253
- "sync/" : true ,
254
- "testing/" : true ,
255
- "unique/" : false ,
260
+ "net/http/" : false ,
261
+ "os/" : true ,
262
+ "reflect/" : false ,
263
+ "runtime/" : false ,
264
+ "sync/" : true ,
265
+ "testing/" : true ,
266
+ "unique/" : false ,
256
267
}
257
268
258
269
if goMinor >= 19 {
@@ -261,15 +272,16 @@ func pathsToOverride(goMinor int, needsSyscallPackage bool) map[string]bool {
261
272
paths ["crypto/internal/boring/sig/" ] = false
262
273
}
263
274
264
- if needsSyscallPackage {
275
+ if needsSyscallPackage ( buildTags ) {
265
276
paths ["syscall/" ] = true // include syscall/js
266
277
}
267
278
268
- // to enable network support for linux systems, reuse the Go version of the net package
269
- // and the according runtime functions
270
- // if runtime.GOOS == "linux" {
271
- // paths["runtime/netpoll/"] = true
272
- // }
279
+ if linuxNetworking (buildTags ) {
280
+ for _ , v := range []string {"crypto/tls/" , "net/http/" , "net/" } {
281
+ delete (paths , v ) // remote entries so go stdlib is used
282
+ }
283
+ }
284
+
273
285
return paths
274
286
}
275
287
0 commit comments