Skip to content

Commit ca8fdd2

Browse files
move syscall to internal/syscall
Signed-off-by: Achille Roussel <[email protected]>
1 parent 8382db0 commit ca8fdd2

File tree

5 files changed

+16
-10
lines changed

5 files changed

+16
-10
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.

wasip1/dial_wasip1.go

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"net/http"
88
"os"
99

10-
"github.com/stealthrocket/net/syscall"
10+
"github.com/stealthrocket/net/internal/syscall"
1111
)
1212

1313
func init() {
@@ -29,20 +29,26 @@ func Dial(network, address string) (net.Conn, error) {
2929
func DialContext(ctx context.Context, network, address string) (net.Conn, error) {
3030
select {
3131
case <-ctx.Done():
32-
return nil, &net.OpError{
33-
Op: "dial",
34-
Net: network,
35-
Addr: &networkAddress{
36-
network: network,
37-
address: address,
38-
},
39-
Err: context.Cause(ctx),
32+
addr := &networkAddress{
33+
network: network,
34+
address: address,
4035
}
36+
return nil, dialErr(nil, addr, context.Cause(err))
4137
default:
4238
return Dial(network, address)
4339
}
4440
}
4541

42+
func dialErr(source, addr net.Addr, err error) error {
43+
return &net.OpError{
44+
Op: "dial",
45+
Net: addr.Network(),
46+
Source: source,
47+
Addr: addr,
48+
Err: err,
49+
}
50+
}
51+
4652
type networkAddress struct {
4753
network string
4854
address string

wasip1/listen_wasip1.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"net"
66
"os"
77

8-
"github.com/stealthrocket/net/syscall"
8+
"github.com/stealthrocket/net/internal/syscall"
99
)
1010

1111
// Listen announces on the local network address.

0 commit comments

Comments
 (0)