aboutsummaryrefslogtreecommitdiff
path: root/src/net/http
diff options
context:
space:
mode:
authorJulien Cretel <jub0bsinthecloud@gmail.com>2025-10-01 20:08:18 +0000
committerGopher Robot <gobot@golang.org>2025-10-13 10:12:48 -0700
commit6bcd97d9f4386528aa85eb3cc27da0ed902de870 (patch)
tree54acec806440b95e7afc493d42b0b095fdaee1a5 /src/net/http
parent1cd71689f2ed8f07031a0cc58fc3586ca501839f (diff)
downloadgo-6bcd97d9f4386528aa85eb3cc27da0ed902de870.tar.xz
all: replace calls to errors.As with errors.AsType
This change replaces most occurrences (in code as well as in comments) of errors.As with errors.AsType. It leaves the errors package and vendored code untouched. Change-Id: I3bde73f318a0b408bdb8f5a251494af15a13118a GitHub-Last-Rev: 8aaaa36a5a12d2a6a90c6d51680464e1a3115139 GitHub-Pull-Request: golang/go#75698 Reviewed-on: https://go-review.googlesource.com/c/go/+/708495 Auto-Submit: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Alan Donovan <adonovan@google.com> Reviewed-by: Michael Pratt <mpratt@google.com>
Diffstat (limited to 'src/net/http')
-rw-r--r--src/net/http/h2_error_test.go17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/net/http/h2_error_test.go b/src/net/http/h2_error_test.go
index 5e400683b4..e71825451a 100644
--- a/src/net/http/h2_error_test.go
+++ b/src/net/http/h2_error_test.go
@@ -25,19 +25,18 @@ func (e externalStreamError) Error() string {
}
func TestStreamError(t *testing.T) {
- var target externalStreamError
streamErr := http2streamError(42, http2ErrCodeProtocol)
- ok := errors.As(streamErr, &target)
+ extStreamErr, ok := errors.AsType[externalStreamError](streamErr)
if !ok {
- t.Fatalf("errors.As failed")
+ t.Fatalf("errors.AsType failed")
}
- if target.StreamID != streamErr.StreamID {
- t.Errorf("got StreamID %v, expected %v", target.StreamID, streamErr.StreamID)
+ if extStreamErr.StreamID != streamErr.StreamID {
+ t.Errorf("got StreamID %v, expected %v", extStreamErr.StreamID, streamErr.StreamID)
}
- if target.Cause != streamErr.Cause {
- t.Errorf("got Cause %v, expected %v", target.Cause, streamErr.Cause)
+ if extStreamErr.Cause != streamErr.Cause {
+ t.Errorf("got Cause %v, expected %v", extStreamErr.Cause, streamErr.Cause)
}
- if uint32(target.Code) != uint32(streamErr.Code) {
- t.Errorf("got Code %v, expected %v", target.Code, streamErr.Code)
+ if uint32(extStreamErr.Code) != uint32(streamErr.Code) {
+ t.Errorf("got Code %v, expected %v", extStreamErr.Code, streamErr.Code)
}
}