From be2bd4eec7de3836da56a3532ecbcf45a127ece2 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Thu, 19 Aug 2021 08:31:53 +0200 Subject: golangci-lint: fix issues found by "unused" and "deadcode" Except xattrSupported, this is a false positive. $ golangci-lint run --disable-all --enable unused --enable deadcode gocryptfs-xray/xray_main.go:24:5: `GitVersionFuse` is unused (deadcode) var GitVersionFuse = "[GitVersionFuse not set - please compile using ./build.bash]" ^ tests/symlink_race/main.go:47:6: `chmodLoop` is unused (deadcode) func chmodLoop() { ^ internal/readpassword/extpass_test.go:11:5: `testPw` is unused (deadcode) var testPw = []byte("test") ^ tests/reverse/xattr_test.go:13:6: func `xattrSupported` is unused (unused) func xattrSupported(path string) bool { ^ internal/fusefrontend_reverse/rpath.go:20:22: func `(*RootNode).abs` is unused (unused) func (rfs *RootNode) abs(relPath string, err error) (string, error) { ^ tests/matrix/matrix_test.go:310:6: `sContains` is unused (deadcode) func sContains(haystack []string, needle string) bool { --- internal/fusefrontend_reverse/rpath.go | 12 ------------ internal/readpassword/extpass_test.go | 2 -- 2 files changed, 14 deletions(-) (limited to 'internal') diff --git a/internal/fusefrontend_reverse/rpath.go b/internal/fusefrontend_reverse/rpath.go index f29bbf5..199473b 100644 --- a/internal/fusefrontend_reverse/rpath.go +++ b/internal/fusefrontend_reverse/rpath.go @@ -12,18 +12,6 @@ import ( "github.com/rfjakob/gocryptfs/internal/tlog" ) -// abs basically returns storage dir + "/" + relPath. -// It takes an error parameter so it can directly wrap decryptPath like this: -// a, err := rfs.abs(rfs.decryptPath(relPath)) -// abs never generates an error on its own. In other words, abs(p, nil) never -// fails. -func (rfs *RootNode) abs(relPath string, err error) (string, error) { - if err != nil { - return "", err - } - return filepath.Join(rfs.args.Cipherdir, relPath), nil -} - // rDecryptName decrypts the ciphertext name "cName", given the dirIV of the // directory "cName" lies in. The relative plaintext path to the directory // "pDir" is used if a "gocryptfs.longname.XYZ.name" must be resolved. diff --git a/internal/readpassword/extpass_test.go b/internal/readpassword/extpass_test.go index 9a643a5..ea05893 100644 --- a/internal/readpassword/extpass_test.go +++ b/internal/readpassword/extpass_test.go @@ -8,8 +8,6 @@ import ( "github.com/rfjakob/gocryptfs/internal/tlog" ) -var testPw = []byte("test") - func TestMain(m *testing.M) { // Shut up info output tlog.Info.Enabled = false -- cgit v1.2.3