aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorStefan Majewsky <majewsky@gmx.net>2026-07-21 14:28:15 +0200
committerStefan Majewsky <majewsky@gmx.net>2026-07-21 14:42:45 +0200
commite3179558f05e9bb2c8c57fe9d0e916cb829df11c (patch)
treef2c5eb52ded19b870f075bed25e26e524701b2bc /internal
parent9bcfd4733a7ae7d12129b024e93536f7136e4a8e (diff)
downloadgo-schwift-e3179558f05e9bb2c8c57fe9d0e916cb829df11c.tar.gz
bump Go to 1.26, replace errext.As with errors.AsType
Diffstat (limited to 'internal')
-rw-r--r--internal/errext/errext.go26
1 files changed, 0 insertions, 26 deletions
diff --git a/internal/errext/errext.go b/internal/errext/errext.go
deleted file mode 100644
index 3655ba7..0000000
--- a/internal/errext/errext.go
+++ /dev/null
@@ -1,26 +0,0 @@
-package errext
-
-import "errors"
-
-// vendored from https://github.com/sapcc/go-bits/blob/master/errext/errext.go (also licensed Apache 2.0) to prevent go.mod go bump to 1.21
-
-// As is a variant of errors.As() that leverages generics to present a nicer interface.
-//
-// //this code:
-// var perr os.PathError
-// if errors.As(err, &perr) {
-// handle(perr)
-// }
-// //can be rewritten as:
-// if perr, ok := errext.As[os.PathError](err); ok {
-// handle(perr)
-// }
-//
-// This is sometimes more verbose (like in this example), but allows to scope
-// the specific error variable to the condition's then-branch, and also looks
-// more idiomatic to developers already familiar with type casts.
-func As[T error](err error) (T, bool) {
- var result T
- ok := errors.As(err, &result)
- return result, ok
-}