aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDan Kegel <[email protected]>2022-04-18 13:12:54 -0700
committerRon Evans <[email protected]>2022-04-19 09:22:27 +0200
commit69d7ed5cda49a3744324e7486ccfc6f655cfafb4 (patch)
tree046809c17df2ec4d74f8bce4a07dcc0489f0d676
parent111661658bfbf85fd188663046f31421e9821913 (diff)
downloadtinygo-69d7ed5cda49a3744324e7486ccfc6f655cfafb4.tar.gz
tinygo-69d7ed5cda49a3744324e7486ccfc6f655cfafb4.zip
os: define ErrDeadlineExceeded; fixes go 1.18 compile error in net/http, #2782
-rw-r--r--src/os/errors.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/os/errors.go b/src/os/errors.go
index fc8693ebd..36e3c55e2 100644
--- a/src/os/errors.go
+++ b/src/os/errors.go
@@ -19,6 +19,24 @@ var (
)
// The following code is copied from the official implementation.
+// src/internal/poll/fd.go
+
+// ErrDeadlineExceeded is returned for an expired deadline.
+// This is exported by the os package as os.ErrDeadlineExceeded.
+var ErrDeadlineExceeded error = &DeadlineExceededError{}
+
+// DeadlineExceededError is returned for an expired deadline.
+type DeadlineExceededError struct{}
+
+// Implement the net.Error interface.
+// The string is "i/o timeout" because that is what was returned
+// by earlier Go versions. Changing it may break programs that
+// match on error strings.
+func (e *DeadlineExceededError) Error() string { return "i/o timeout" }
+func (e *DeadlineExceededError) Timeout() bool { return true }
+func (e *DeadlineExceededError) Temporary() bool { return true }
+
+// The following code is copied from the official implementation.
// https://github.com/golang/go/blob/4ce6a8e89668b87dce67e2f55802903d6eb9110a/src/os/error.go#L65-L104
func NewSyscallError(syscall string, err error) error {