summaryrefslogtreecommitdiffstats
path: root/services/auth
diff options
context:
space:
mode:
authordelvh <leon@kske.dev>2022-10-24 21:29:17 +0200
committerGitHub <noreply@github.com>2022-10-24 20:29:17 +0100
commit0ebb45cfe7606adf021ad359d6fbfcefc54360a5 (patch)
tree541b75d083213e93bbbfadbdc5d560c739543903 /services/auth
parent7c11a73833f3aa9783015e5e13871d3c298d3ef6 (diff)
downloadgitea-0ebb45cfe7606adf021ad359d6fbfcefc54360a5.tar.gz
gitea-0ebb45cfe7606adf021ad359d6fbfcefc54360a5.zip
Replace all instances of fmt.Errorf(%v) with fmt.Errorf(%w) (#21551)
Found using `find . -type f -name '*.go' -print -exec vim {} -c ':%s/fmt\.Errorf(\(.*\)%v\(.*\)err/fmt.Errorf(\1%w\2err/g' -c ':wq' \;` Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Andrew Thornton <art27@cantab.net> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'services/auth')
-rw-r--r--services/auth/source/ldap/source_search.go4
-rw-r--r--services/auth/source/oauth2/jwtsigningkey.go2
-rw-r--r--services/auth/source/smtp/auth.go2
3 files changed, 4 insertions, 4 deletions
diff --git a/services/auth/source/ldap/source_search.go b/services/auth/source/ldap/source_search.go
index a97a1179d9..6ea84ec288 100644
--- a/services/auth/source/ldap/source_search.go
+++ b/services/auth/source/ldap/source_search.go
@@ -125,13 +125,13 @@ func dial(source *Source) (*ldap.Conn, error) {
conn, err := ldap.Dial("tcp", net.JoinHostPort(source.Host, strconv.Itoa(source.Port)))
if err != nil {
- return nil, fmt.Errorf("error during Dial: %v", err)
+ return nil, fmt.Errorf("error during Dial: %w", err)
}
if source.SecurityProtocol == SecurityProtocolStartTLS {
if err = conn.StartTLS(tlsConfig); err != nil {
conn.Close()
- return nil, fmt.Errorf("error during StartTLS: %v", err)
+ return nil, fmt.Errorf("error during StartTLS: %w", err)
}
}
diff --git a/services/auth/source/oauth2/jwtsigningkey.go b/services/auth/source/oauth2/jwtsigningkey.go
index d9312ee820..352f932746 100644
--- a/services/auth/source/oauth2/jwtsigningkey.go
+++ b/services/auth/source/oauth2/jwtsigningkey.go
@@ -339,7 +339,7 @@ func InitSigningKey() error {
}
if err != nil {
- return fmt.Errorf("Error while loading or creating JWT key: %v", err)
+ return fmt.Errorf("Error while loading or creating JWT key: %w", err)
}
signingKey, err := CreateJWTSigningKey(setting.OAuth2.JWTSigningAlgorithm, key)
diff --git a/services/auth/source/smtp/auth.go b/services/auth/source/smtp/auth.go
index a9e4b0e5f4..487c049722 100644
--- a/services/auth/source/smtp/auth.go
+++ b/services/auth/source/smtp/auth.go
@@ -95,7 +95,7 @@ func Authenticate(a smtp.Auth, source *Source) error {
hasStartTLS, _ := client.Extension("STARTTLS")
if !source.UseTLS() && hasStartTLS {
if err = client.StartTLS(tlsConfig); err != nil {
- return fmt.Errorf("failed to start StartTLS: %v", err)
+ return fmt.Errorf("failed to start StartTLS: %w", err)
}
}