Fix the easy golint warnings

Reported by https://goreportcard.com/report/github.com/rfjakob/gocryptfs
This commit is contained in:
Jakob Unterwurzacher 2018-04-08 20:24:29 +02:00
parent cab0cda449
commit bcc8378a2c
4 changed files with 7 additions and 6 deletions

View File

@ -23,7 +23,7 @@ const (
tagLen = 16 tagLen = 16
) )
// stupidGCM implements the cipher.AEAD interface // StupidGCM implements the cipher.AEAD interface
type StupidGCM struct { type StupidGCM struct {
key []byte key []byte
forceDecode bool forceDecode bool
@ -42,10 +42,12 @@ func New(keyIn []byte, forceDecode bool) cipher.AEAD {
return &StupidGCM{key: key, forceDecode: forceDecode} return &StupidGCM{key: key, forceDecode: forceDecode}
} }
// NonceSize returns the required size of the nonce / IV.
func (g *StupidGCM) NonceSize() int { func (g *StupidGCM) NonceSize() int {
return ivLen return ivLen
} }
// Overhead returns the number of bytes that are added for authentication.
func (g *StupidGCM) Overhead() int { func (g *StupidGCM) Overhead() int {
return tagLen return tagLen
} }

View File

@ -78,9 +78,8 @@ func emulateUnlinkat(dirfd int, path string, flags int) (err error) {
} }
if (flags & unix.AT_REMOVEDIR) != 0 { if (flags & unix.AT_REMOVEDIR) != 0 {
return syscall.Rmdir(path) return syscall.Rmdir(path)
} else {
return syscall.Unlink(path)
} }
return syscall.Unlink(path)
} }
// emulateMknodat emulates the syscall for platforms that don't have it // emulateMknodat emulates the syscall for platforms that don't have it

View File

@ -284,7 +284,7 @@ func initGoFuse(fs pathfs.FileSystem, args *argContainer) *fuse.Server {
// sync.Pool buffer pools are sized acc. to the default. Users may set // sync.Pool buffer pools are sized acc. to the default. Users may set
// the kernel constant higher, and Synology NAS kernels are known to // the kernel constant higher, and Synology NAS kernels are known to
// have it >128kiB. We cannot handle more than 128kiB, so we tell // have it >128kiB. We cannot handle more than 128kiB, so we tell
// the kernel to limit the size explicitely. // the kernel to limit the size explicitly.
MaxWrite: fuse.MAX_KERNEL_WRITE, MaxWrite: fuse.MAX_KERNEL_WRITE,
Options: []string{fmt.Sprintf("max_read=%d", fuse.MAX_KERNEL_WRITE)}, Options: []string{fmt.Sprintf("max_read=%d", fuse.MAX_KERNEL_WRITE)},
} }

View File

@ -422,8 +422,8 @@ func QueryCtlSock(t *testing.T, socketPath string, req ctlsock.RequestStruct) (r
return response return response
} }
// Extract the exit code from an error value that was returned from // ExtractCmdExitCode extracts the exit code from an error value that was
// exec / cmd.Run() // returned from exec / cmd.Run()
func ExtractCmdExitCode(err error) int { func ExtractCmdExitCode(err error) int {
if err == nil { if err == nil {
return 0 return 0