*: partial staticcheck fix

This commit is contained in:
wpedrak
2021-03-10 13:07:36 +01:00
committed by Wojtek Pędrak
parent cb0e58942f
commit 2c2456bf3d
23 changed files with 39 additions and 40 deletions

View File

@@ -121,7 +121,7 @@ func ZeroToEnd(f *os.File) error {
// Returns error if dir is empty or exist with a different permission than specified.
func CheckDirPermission(dir string, perm os.FileMode) error {
if !Exist(dir) {
return fmt.Errorf("directory %q empty, cannot check permission.", dir)
return fmt.Errorf("directory %q empty, cannot check permission", dir)
}
//check the existing permission on the directory
dirInfo, err := os.Stat(dir)
@@ -130,7 +130,7 @@ func CheckDirPermission(dir string, perm os.FileMode) error {
}
dirMode := dirInfo.Mode().Perm()
if dirMode != perm {
err = fmt.Errorf("directory %q exist, but the permission is %q. The recommended permission is %q to prevent possible unprivileged access to the data.", dir, dirInfo.Mode(), os.FileMode(PrivateDirMode))
err = fmt.Errorf("directory %q exist, but the permission is %q. The recommended permission is %q to prevent possible unprivileged access to the data", dir, dirInfo.Mode(), os.FileMode(PrivateDirMode))
return err
}
return nil

View File

@@ -41,10 +41,10 @@ func NewTransport(info TLSInfo, dialtimeoutd time.Duration) (*http.Transport, er
TLSClientConfig: cfg,
}
dialer := (&net.Dialer{
dialer := &net.Dialer{
Timeout: dialtimeoutd,
KeepAlive: 30 * time.Second,
})
}
dial := func(net, addr string) (net.Conn, error) {
return dialer.Dial("unix", addr)
}