]> Cypherpunks repositories - gostls13.git/commitdiff
net: add wasip1 support
authorJohan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Sat, 25 Mar 2023 23:57:07 +0000 (16:57 -0700)
committerGopher Robot <gobot@golang.org>
Tue, 11 Apr 2023 20:54:12 +0000 (20:54 +0000)
For #58141

Co-authored-by: Richard Musiol <neelance@gmail.com>
Co-authored-by: Achille Roussel <achille.roussel@gmail.com>
Co-authored-by: Julien Fabre <ju.pryz@gmail.com>
Co-authored-by: Evan Phoenix <evan@phx.io>
Change-Id: I09a7cf33e43cb0e17ab3793c22cbad90b9e83b62
Reviewed-on: https://go-review.googlesource.com/c/go/+/479626
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Auto-Submit: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

55 files changed:
src/net/conf.go
src/net/conn_test.go
src/net/dial_test.go
src/net/dnsclient_unix.go
src/net/dnsconfig_unix.go
src/net/dnsname_test.go
src/net/error_posix.go
src/net/error_test.go
src/net/error_unix.go
src/net/external_test.go
src/net/file_stub.go
src/net/file_test.go
src/net/hook_unix.go
src/net/interface_stub.go
src/net/interface_test.go
src/net/ip_test.go
src/net/iprawsock_posix.go
src/net/iprawsock_test.go
src/net/ipsock_posix.go
src/net/listen_test.go
src/net/lookup_fake.go
src/net/lookup_test.go
src/net/main_conf_test.go
src/net/main_noconf_test.go
src/net/main_posix_test.go
src/net/main_test.go
src/net/mockserver_test.go
src/net/net_fake.go
src/net/net_test.go
src/net/packetconn_test.go
src/net/parse_test.go
src/net/port_unix.go
src/net/protoconn_test.go
src/net/rawconn_stub_test.go
src/net/rawconn_test.go
src/net/resolverdialfunc_test.go
src/net/sendfile_stub.go
src/net/sendfile_test.go
src/net/server_test.go
src/net/sock_stub.go
src/net/sockaddr_posix.go
src/net/sockopt_stub.go
src/net/sockoptip_stub.go
src/net/tcpsock_posix.go
src/net/tcpsock_test.go
src/net/tcpsock_unix_test.go
src/net/tcpsockopt_stub.go
src/net/timeout_test.go
src/net/udpsock_posix.go
src/net/udpsock_test.go
src/net/unixsock.go
src/net/unixsock_posix.go
src/net/unixsock_readmsg_other.go
src/net/unixsock_test.go
src/net/writev_test.go

index 41196042bb607ce4341b2d0ca84b393ccd1432f7..8a4ee935c6d24516f470123009ab271fad261419 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build !js
+//go:build !js && !wasip1
 
 package net
 
index d168dda08e19e4bb1df1073b8e15f5f768ae7d71..4f391b0675f3fbb3ba4a9c46c42e62ea4d085c21 100644 (file)
@@ -5,7 +5,7 @@
 // This file implements API tests across platforms and will never have a build
 // tag.
 
-//go:build !js
+//go:build !js && !wasip1
 
 package net
 
index 57f685e5471a3fd91f8e4643024951845cd7a9e3..d4db405e3732a8592a8e51ad1c89f8434e055cd6 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build !js
+//go:build !js && !wasip1
 
 package net
 
index 20da8f197031f0df42c937a451a468f65380140d..6923f6a4a78145f93cf39212a93d6e3af3744e0f 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build !js
+//go:build !js && !wasip1
 
 // DNS client: see RFC 1035.
 // Has to be linked into package net for Dial.
index 69b300410ab0e18e74b2b7e4a2ee682277c54537..d5f34e530049038f83ac52ca5fe477093ad2fbe1 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build !js && !windows
+//go:build !js && !wasip1 && !windows
 
 // Read system DNS config from /etc/resolv.conf
 
index 28b7c680feb16a27fa7ce3fd6d310c5cb80bc84b..4a5f01a04a0529d2b3290a8840bac9680dc796d2 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build !js
+//go:build !js && !wasip1
 
 package net
 
index 619483593b58949c717b16e3dd058296157294c4..c8dc069db446b014f0878b1f8c89a30bd28adf0f 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build unix || (js && wasm) || windows
+//go:build unix || (js && wasm) || wasip1 || windows
 
 package net
 
index 4467dc11b20965036678575d9d4779499c3be4ce..fe0d9f676da8d747aea80632c839f01ea17af1bb 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build !js
+//go:build !js && !wasip1
 
 package net
 
index 1f9b6eb78ce870b960c81fdcb86df4fd59d35668..d6948670b6a305606753214e3f0398b5f4b6df9a 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build unix || js
+//go:build unix || js || wasip1
 
 package net
 
index 3a97011fe8570b65283046d79b6c3ada1b3ad3a8..0709b9d6f5dac675969f45b7402f3e52a4e91ae1 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build !js
+//go:build !js && !wasip1
 
 package net
 
index 91df926a5789144ef0ad8e197d854b8c5c01d1b0..1299f0e67f943497b321274571790e9de57f278b 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build js && wasm
+//go:build (js && wasm) || wasip1
 
 package net
 
index ea2a218dfbc562146c5904f51b6309e34411b47c..53cd3c1074374312c9cb71f26ce8bd8298a2dec8 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build !js
+//go:build !js && !wasip1
 
 package net
 
index fa82c7e52ba67b611a0ff703b1e7e7f4e5e582d2..4e20f592180cac1afbb249914dd66579dfcd4fe5 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build unix || (js && wasm)
+//go:build unix || (js && wasm) || wasip1
 
 package net
 
index 2d4475f63eeba33722afd2e6234abf4b073da104..829dbc6938b6b21e2da413c9bc40dde1a0ece3b4 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build js && wasm
+//go:build (js && wasm) || wasip1
 
 package net
 
index f6c98684181efbc4c68c0ec4db2c3c8da2bad035..da54a660e5ca3be537afbdebaf303067a4dcdc0e 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build !js
+//go:build !js && !wasip1
 
 package net
 
index 68ada4939ae16d73b4640f1ad9a261ad1126f4ce..1373059abe01e8ec9c1ace9a4a7eafcedd18351d 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build !js
+//go:build !js && !wasip1
 
 package net
 
index 7b4d23927ff3f9d95fdb166e014ffb862d327d1b..59967eb923a63289c9d5f8f110c1c4ddcc37ea7f 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build unix || (js && wasm) || windows
+//go:build unix || (js && wasm) || wasip1 || windows
 
 package net
 
index a6db77480f8f950b7334a9037a6dc63c73d98f7f..14c03a1f4de02288e98756794975fb64965043dd 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build !js
+//go:build !js && !wasip1
 
 package net
 
index 7fd676bd2c2561d1b4bc5d430117d142b13edafa..b0a00a62960a925d705a65b96070e4b6ae9efae5 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build unix || (js && wasm) || windows
+//go:build unix || (js && wasm) || wasip1 || windows
 
 package net
 
index df3cadfa1a9ca6d5fb4882d9cabb1af2124c4f8e..f0a8861370c134b6d4152508fe5f1e600b4e5718 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build !js && !plan9
+//go:build !js && !plan9 && !wasip1
 
 package net
 
index c27eae4ba5097e11460aae0f40f7206eb3c0a9df..45146e1c959add7916aebbb810cb76f2ecb35059 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build js && wasm
+//go:build (js && wasm) || wasip1
 
 package net
 
index b47e444375fcb468bcc6c68ec19f41cf731fa55f..e02c45f638adc70582616e2c2f424c8f777e1e84 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build !js
+//go:build !js && !wasip1
 
 package net
 
index 71257976bdebfa962c1ae67e3f2d8fa3ca36658f..e5994f5e5f156ba4459a1a5603bd9ed7abe1a5e3 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build !js && !plan9
+//go:build !js && !plan9 && !wasip1
 
 package net
 
index d7f22664b542379acc1d155213f396cd391ab30e..077a36e5d6fb96ef53e20c35e66c62c474641759 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build (js && wasm) || plan9
+//go:build (js && wasm) || plan9 || wasip1
 
 package net
 
index 8899aa9c94ec7200b1e25b17062428e99d16eac3..a7942ee32767ef6a6b990721fbbc9eb2d690bfb3 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build !js && !plan9
+//go:build !js && !plan9 && !wasip1
 
 package net
 
index 1ee8c2efe717b44c1723a5f8e6435ce4f0b213f3..9fd5c885430972836390a274b6871a1fd36ac200 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build !js
+//go:build !js && !wasip1
 
 package net
 
index 61c17530c27ef2958bde6b95549f4941cdf8fac6..f86dd66a2d19cb5683b648ad1a15435ab2bfada0 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build !js
+//go:build !js && !wasip1
 
 package net
 
index 2ecc1fa46a7d23e93fae6ab8b0e0b60cc0f2e992..8e801d15d1bba56892555cb9a0608688aeda0cef 100644 (file)
@@ -2,9 +2,9 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// Fake networking for js/wasm. It is intended to allow tests of other package to pass.
+// Fake networking for js/wasm and wasip1/wasm. It is intended to allow tests of other package to pass.
 
-//go:build js && wasm
+//go:build (js && wasm) || wasip1
 
 package net
 
index 05c058a46c1ac2631e2bba7da06d821f4ed60959..a0ac85f406799df6c4161c28fa8452c7b46bad10 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build !js
+//go:build !js && !wasip1
 
 package net
 
index fa160df5f50a1da8f5e36f69007f162e238912d8..dc0c14b93d3c38832f50831dd106715723371736 100644 (file)
@@ -5,7 +5,7 @@
 // This file implements API tests across platforms and will never have a build
 // tag.
 
-//go:build !js
+//go:build !js && !wasip1
 
 package net
 
index 97716d769a9b498c037dcae8f89e0d4bc32aa1b5..7c509a97f2d20dae9353ab7c7ae0521dc4f9a4cd 100644 (file)
@@ -12,9 +12,10 @@ import (
 )
 
 func TestReadLine(t *testing.T) {
-       // /etc/services file does not exist on android, plan9, windows.
+       // /etc/services file does not exist on android, plan9, windows, or wasip1
+       // where it would be required to be mounted from the host file system.
        switch runtime.GOOS {
-       case "android", "plan9", "windows":
+       case "android", "plan9", "windows", "wasip1":
                t.Skipf("not supported on %s", runtime.GOOS)
        }
        filename := "/etc/services" // a nice big file
index b05b588f17dd3c5e321f91dbc08773a20c73961d..0b2ea3ec5d83bce79195e50e5bc30862a0a342d2 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build unix || (js && wasm)
+//go:build unix || (js && wasm) || wasip1
 
 // Read system port mappings from /etc/services
 
index 8275d80d7494015dc7050493f1bc47d2776a9dfa..c5668079a94aba349f569b8dccc9a5b4ee7c1637 100644 (file)
@@ -5,7 +5,7 @@
 // This file implements API tests across platforms and will never have a build
 // tag.
 
-//go:build !js
+//go:build !js && !wasip1
 
 package net
 
index ff3d829893d06e07c6ff8631b9d1f5add88a5caa..c8ad80cc84ea8763bc610dbf7c776d2e0a3fd856 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build (js && wasm) || plan9
+//go:build (js && wasm) || plan9 || wasip1
 
 package net
 
index d1ef79d7157a3b87b8d82ab3312bbc12150f3180..06d5856a9ad55dc55350d46c30ac9d18e5418919 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build !js
+//go:build !js && !wasip1
 
 package net
 
index 1fb02b17370d472cb03c5c442f18a7f91eae77ea..1de0402389a1ceb3ba84768344cee46096b792f8 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build !js
+//go:build !js && !wasip1
 
 // Test that Resolver.Dial can be a func returning an in-memory net.Conn
 // speaking DNS.
index 7428da3127b10b22a763eb65b8b928fe56145c64..c7a2e6a1e43a20a7258c855707aad6dff8606ecb 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build aix || (js && wasm) || netbsd || openbsd || ios
+//go:build aix || (js && wasm) || netbsd || openbsd || ios || wasip1
 
 package net
 
index 969c022b00eb6f632421d9109c7c6a6ebf5eb1d5..44a87a1d203cd7025136cd2e138dbb821843c753 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build !js
+//go:build !js && !wasip1
 
 package net
 
index 6796d7993e9c5bf8ca372995782be0b2474aebfa..2ff0689067fd173696b7a135992eb7300428ba14 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build !js
+//go:build !js && !wasip1
 
 package net
 
index 4b73e575fe3a3fd7a7e9dcb7f232ecd02cf57651..e16375556818d4738de50f89d5a2a241393c952b 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build aix || (js && wasm) || solaris
+//go:build aix || (js && wasm) || solaris || wasip1
 
 package net
 
index 76c3233b29845c70310e38a908084414b09de6b4..e44fc76f4b6500938fb6e49774ddfd7c443f354f 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build unix || (js && wasm) || windows
+//go:build unix || (js && wasm) || wasip1 || windows
 
 package net
 
index 98e23714d9a267060dca78a2551110d6d57fd218..186d8912cb0723710cfbc864e92a2ca21c47cb92 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build js && wasm
+//go:build (js && wasm) || wasip1
 
 package net
 
index 2c993eb71953f67ff37fff0521140e06c42602e0..a37c31223dee5516ee494aec58ef0a3bf31e5da1 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build js && wasm
+//go:build (js && wasm) || wasip1
 
 package net
 
index ed144a6ddc2b85b1f70e5271ab88192103ea10da..e6f425b1cd0d44f6aede3ee9c3f16f2f9c478bff 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build unix || (js && wasm) || windows
+//go:build unix || (js && wasm) || wasip1 || windows
 
 package net
 
index 35a93d1f385ced9304294f7dadfcd1fb8786a1db..f720a225198634176a2287e463390830ef269c61 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build !js
+//go:build !js && !wasip1
 
 package net
 
index b14670bc6728bef8c3cd2b63589a1f280fd0234d..35fd937e0717b92cae3df8d69a40ea9a1d5d3f9c 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build !js && !plan9 && !windows
+//go:build !js && !plan9 && !wasip1 && !windows
 
 package net
 
index 0fe91829c0e05a91b7d1442c459abb90b247078c..f778143d3b3d934b91865f019a4d17d96f2efc41 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build js && wasm
+//go:build (js && wasm) || wasip1
 
 package net
 
index a2bc81982936b79d6e1512fcadbc6e66d7293e18..6b3554ed7987e71be6e269456611612084ad7fd9 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build !js
+//go:build !js && !wasip1
 
 package net
 
index ffeec81cffdf13657b43045457a29e5603db5c5c..f3dbcfec00b771e6bfac79747cac6f2cb3e9f9b6 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build unix || (js && wasm) || windows
+//go:build unix || (js && wasm) || wasip1 || windows
 
 package net
 
index 0ed2ff98c1a2c87f7e441bb20724eb43fd7046a6..2afd4ac2aea4afb15fe1c9d78bbcf00dca00b423 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build !js
+//go:build !js && !wasip1
 
 package net
 
index b38438c11a82b0fb439b025d9430c1912926e9d4..14fbac0932da857825087e5eb8463e101a9e5d3a 100644 (file)
@@ -12,7 +12,7 @@ import (
        "time"
 )
 
-// BUG(mikio): On JS and Plan 9, methods and functions related
+// BUG(mikio): On JS, WASIP1 and Plan 9, methods and functions related
 // to UnixConn and UnixListener are not implemented.
 
 // BUG(mikio): On Windows, methods and functions related to UnixConn
index c16b483603f6ccecd3d34a4c640679667252ca11..c501b499ed39c42010b493cc65b55caa748c6193 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build unix || (js && wasm) || windows
+//go:build unix || (js && wasm) || wasip1 || windows
 
 package net
 
index b3d19fe73dda2891f8261d691a82e9f29eba80b8..0899a6d3d3e80c9c63ba372a922a3debf9a90ecb 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build (js && wasm) || windows
+//go:build (js && wasm) || wasip1 || windows
 
 package net
 
index 2fc9580cafb68f88108cf287443f563c7d94519b..8402519a0df713b1961034549d281e31c4fbe650 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build !js && !plan9 && !windows
+//go:build !js && !plan9 && !wasip1 && !windows
 
 package net
 
index c4efe9d2ae80d5acff887e7bbb435aadd3102165..8722c0f92035410de83064dd6073bd6ae4a3dd02 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build !js
+//go:build !js && !wasip1
 
 package net