-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Description
What version of Go are you using (go version
)?
$ go version go version go1.19.3 darwin/arm64
(But the issue apparently started in 1.18)
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env
)?
Darwin arm64
go env
Output
$ go envGO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="/Users/wneessen/Library/Caches/go-build"
GOENV="/Users/wneessen/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/wneessen/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/wneessen/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/homebrew/Cellar/go/1.19.3/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/homebrew/Cellar/go/1.19.3/libexec/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.19.3"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/wneessen/go/src/dev-to-example/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/lw/f2psdp2s5fg4z_jw0q58rdgm0000gn/T/go-build119423787=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
package main
import (
"crypto/x509"
"errors"
"fmt"
"net/http"
"net/url"
"reflect"
)
func main() {
_, err := http.Get("https://expired.badssl.com/")
if err != nil {
switch {
case errors.As(err, &x509.CertificateInvalidError{Reason: x509.Expired}):
fmt.Printf("Certificate is expired...\n")
default:
if ue, ok := err.(*url.Error); ok {
fmt.Printf("Unwrapped error is type: %s\n", reflect.TypeOf(ue.Err))
}
}
}
}
What did you expect to see?
I expect to see the "Certificate is expired..." output
What did you see instead?
I received this: Unwrapped error is type: *errors.errorString
Metadata
Metadata
Assignees
Labels
Type
Projects
Status