diff options
author | delvh <leon@kske.dev> | 2022-10-24 21:29:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-24 20:29:17 +0100 |
commit | 0ebb45cfe7606adf021ad359d6fbfcefc54360a5 (patch) | |
tree | 541b75d083213e93bbbfadbdc5d560c739543903 /modules/graceful/net_unix.go | |
parent | 7c11a73833f3aa9783015e5e13871d3c298d3ef6 (diff) | |
download | gitea-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 'modules/graceful/net_unix.go')
-rw-r--r-- | modules/graceful/net_unix.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/modules/graceful/net_unix.go b/modules/graceful/net_unix.go index c7524a79db..0bb589e231 100644 --- a/modules/graceful/net_unix.go +++ b/modules/graceful/net_unix.go @@ -52,7 +52,7 @@ func getProvidedFDs() (savedErr error) { } n, err := strconv.Atoi(numFDs) if err != nil { - savedErr = fmt.Errorf("%s is not a number: %s. Err: %v", listenFDs, numFDs, err) + savedErr = fmt.Errorf("%s is not a number: %s. Err: %w", listenFDs, numFDs, err) return } @@ -81,7 +81,7 @@ func getProvidedFDs() (savedErr error) { } // If needed we can handle packetconns here. - savedErr = fmt.Errorf("Error getting provided socket fd %d: %v", i, err) + savedErr = fmt.Errorf("Error getting provided socket fd %d: %w", i, err) return } }) @@ -98,7 +98,7 @@ func CloseProvidedListeners() error { if err != nil { log.Error("Error in closing unused provided listener: %v", err) if returnableError != nil { - returnableError = fmt.Errorf("%v & %v", returnableError, err) + returnableError = fmt.Errorf("%v & %w", returnableError, err) } else { returnableError = err } @@ -198,7 +198,7 @@ func GetListenerUnix(network string, address *net.UnixAddr) (*net.UnixListener, // make a fresh listener if err := util.Remove(address.Name); err != nil && !os.IsNotExist(err) { - return nil, fmt.Errorf("Failed to remove unix socket %s: %v", address.Name, err) + return nil, fmt.Errorf("Failed to remove unix socket %s: %w", address.Name, err) } l, err := net.ListenUnix(network, address) @@ -208,7 +208,7 @@ func GetListenerUnix(network string, address *net.UnixAddr) (*net.UnixListener, fileMode := os.FileMode(setting.UnixSocketPermission) if err = os.Chmod(address.Name, fileMode); err != nil { - return nil, fmt.Errorf("Failed to set permission of unix socket to %s: %v", fileMode.String(), err) + return nil, fmt.Errorf("Failed to set permission of unix socket to %s: %w", fileMode.String(), err) } activeListeners = append(activeListeners, l) |