Skip to content

Commit 4b123a7

Browse files
committed
switch net via build tags
Signed-off-by: leongross <[email protected]>
1 parent 1b05bd8 commit 4b123a7

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,
@@ -259,7 +261,7 @@ func pathsToOverride(goMinor int, buildTags []string) map[string]bool {
259261
"internal/task/": false,
260262
"internal/wasi/": false,
261263
"machine/": false,
262-
"net/": true,
264+
"net/": true, // this is important if the GOOS != linux
263265
"net/http/": false,
264266
"os/": true,
265267
"reflect/": false,
@@ -279,6 +281,8 @@ func pathsToOverride(goMinor int, buildTags []string) map[string]bool {
279281
paths["syscall/"] = true // include syscall/js
280282
}
281283

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

0 commit comments

Comments
 (0)