@@ -45,7 +45,7 @@ func GetCachedGoroot(config *compileopts.Config) (string, error) {
4545 }
4646
4747 // Find the overrides needed for the goroot.
48- overrides := pathsToOverride (config .GoMinorVersion , needsSyscallPackage ( config .BuildTags () ))
48+ overrides := pathsToOverride (config .GoMinorVersion , config .BuildTags ())
4949
5050 // Resolve the merge links within the goroot.
5151 merge , err := listGorootMergeLinks (goroot , tinygoroot , overrides )
@@ -225,9 +225,20 @@ func needsSyscallPackage(buildTags []string) bool {
225225 return false
226226}
227227
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+
228239// The boolean indicates whether to merge the subdirs. True means merge, false
229240// 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 {
231242 paths := map [string ]bool {
232243 "" : true ,
233244 "crypto/" : true ,
@@ -267,15 +278,16 @@ func pathsToOverride(goMinor int, needsSyscallPackage bool) map[string]bool {
267278 paths ["crypto/internal/boring/sig/" ] = false
268279 }
269280
270- if needsSyscallPackage {
281+ if needsSyscallPackage ( buildTags ) {
271282 paths ["syscall/" ] = true // include syscall/js
272283 }
273284
274- // to enable network support for linux systems, reuse the Go version of the net package
275- // and the according runtime functions
276- // if runtime.GOOS == "linux" {
277- // paths["runtime/netpoll/"] = true
278- // }
285+ if linuxNetworking (buildTags ) {
286+ for _ , v := range []string {"crypto/tls/" , "net/http/" , "net/" } {
287+ delete (paths , v ) // remote entries so go stdlib is used
288+ }
289+ }
290+
279291 return paths
280292}
281293
0 commit comments