Skip to content

Commit 01c3521

Browse files
committed
switch net via build tags
Signed-off-by: leongross <leon.gross@9elements.com>
1 parent 06e37b5 commit 01c3521

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@
3535
[submodule "lib/wasi-cli"]
3636
path = lib/wasi-cli
3737
url = https://github.com/WebAssembly/wasi-cli
38+
[submodule "src/net"]
39+
path = src/net
40+
url = https://github.com/tinygo-org/net

loader/goroot.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,10 @@ func linuxNetworking(buildTags []string) bool {
236236
return false
237237
}
238238

239-
// The boolean indicates whether to merge the subdirs. True means merge, false
240-
// means use the TinyGo version.
239+
// The boolean indicates whether to merge the subdirs.
240+
//
241+
// True: Merge the golang and tinygo source directories.
242+
// False: Uses the TinyGo version exclusively.
241243
func pathsToOverride(goMinor int, buildTags []string) map[string]bool {
242244
paths := map[string]bool{
243245
"": true,
@@ -260,7 +262,7 @@ func pathsToOverride(goMinor int, buildTags []string) map[string]bool {
260262
"internal/task/": false,
261263
"internal/wasi/": false,
262264
"machine/": false,
263-
"net/": true,
265+
"net/": true, // this is important if the GOOS != linux
264266
"net/http/": false,
265267
"os/": true,
266268
"reflect/": false,
@@ -280,6 +282,8 @@ func pathsToOverride(goMinor int, buildTags []string) map[string]bool {
280282
paths["syscall/"] = true // include syscall/js
281283
}
282284

285+
// To make sure the correct version of the net package is used, it is advised
286+
// to clean the go cache before building
283287
if linuxNetworking(buildTags) {
284288
for _, v := range []string{"crypto/tls/", "net/http/", "net/"} {
285289
delete(paths, v) // remote entries so go stdlib is used

0 commit comments

Comments
 (0)