From bcc8378a2c07476a43c1fe316b79590177ded3d3 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sun, 8 Apr 2018 20:24:29 +0200 Subject: [PATCH] Fix the easy golint warnings Reported by https://goreportcard.com/report/github.com/rfjakob/gocryptfs --- internal/stupidgcm/stupidgcm.go | 4 +++- internal/syscallcompat/emulate.go | 3 +-- mount.go | 2 +- tests/test_helpers/helpers.go | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/internal/stupidgcm/stupidgcm.go b/internal/stupidgcm/stupidgcm.go index c8aecca..59636c0 100644 --- a/internal/stupidgcm/stupidgcm.go +++ b/internal/stupidgcm/stupidgcm.go @@ -23,7 +23,7 @@ const ( tagLen = 16 ) -// stupidGCM implements the cipher.AEAD interface +// StupidGCM implements the cipher.AEAD interface type StupidGCM struct { key []byte forceDecode bool @@ -42,10 +42,12 @@ func New(keyIn []byte, forceDecode bool) cipher.AEAD { return &StupidGCM{key: key, forceDecode: forceDecode} } +// NonceSize returns the required size of the nonce / IV. func (g *StupidGCM) NonceSize() int { return ivLen } +// Overhead returns the number of bytes that are added for authentication. func (g *StupidGCM) Overhead() int { return tagLen } diff --git a/internal/syscallcompat/emulate.go b/internal/syscallcompat/emulate.go index e5aeae7..c0a0d09 100644 --- a/internal/syscallcompat/emulate.go +++ b/internal/syscallcompat/emulate.go @@ -78,9 +78,8 @@ func emulateUnlinkat(dirfd int, path string, flags int) (err error) { } if (flags & unix.AT_REMOVEDIR) != 0 { return syscall.Rmdir(path) - } else { - return syscall.Unlink(path) } + return syscall.Unlink(path) } // emulateMknodat emulates the syscall for platforms that don't have it diff --git a/mount.go b/mount.go index 4bac80e..54ceedc 100644 --- a/mount.go +++ b/mount.go @@ -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 // the kernel constant higher, and Synology NAS kernels are known to // 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, Options: []string{fmt.Sprintf("max_read=%d", fuse.MAX_KERNEL_WRITE)}, } diff --git a/tests/test_helpers/helpers.go b/tests/test_helpers/helpers.go index a859129..4c704d4 100644 --- a/tests/test_helpers/helpers.go +++ b/tests/test_helpers/helpers.go @@ -422,8 +422,8 @@ func QueryCtlSock(t *testing.T, socketPath string, req ctlsock.RequestStruct) (r return response } -// Extract the exit code from an error value that was returned from -// exec / cmd.Run() +// ExtractCmdExitCode extracts the exit code from an error value that was +// returned from exec / cmd.Run() func ExtractCmdExitCode(err error) int { if err == nil { return 0