From 6e17b5783780b756f764aea4491afb6a656bc79c Mon Sep 17 00:00:00 2001 From: makeworld Date: Wed, 1 Dec 2021 11:18:20 -0500 Subject: [PATCH] Appease linter --- .golangci.yml | 6 ++---- bookmarks/bookmarks.go | 1 - client/tofu.go | 3 +-- config/config.go | 1 + config/keybindings.go | 8 ++++---- display/handlers.go | 2 +- sysopen/open_browser_darwin.go | 1 + sysopen/open_browser_other.go | 1 + sysopen/open_browser_unix.go | 1 + sysopen/open_browser_windows.go | 1 + webbrowser/open_browser_darwin.go | 1 + webbrowser/open_browser_other.go | 1 + webbrowser/open_browser_unix.go | 1 + webbrowser/open_browser_windows.go | 1 + 14 files changed, 17 insertions(+), 12 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 80cc6f1..e5ca3f7 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -19,15 +19,13 @@ linters: - goerr113 - gofmt - goimports - - golint + - revive - goprintffuncname - - interfacer - lll - - maligned - misspell - nolintlint - prealloc - - scopelint + - exportloopref - unconvert - unparam diff --git a/bookmarks/bookmarks.go b/bookmarks/bookmarks.go index a38c548..b7e4771 100644 --- a/bookmarks/bookmarks.go +++ b/bookmarks/bookmarks.go @@ -61,7 +61,6 @@ func Init() error { err = os.Remove(config.OldBkmkPath) if err != nil { - //nolint:goerr113 return fmt.Errorf( "couldn't delete old bookmarks file (%s), you must delete it yourself to prevent duplicate bookmarks: %w", config.OldBkmkPath, diff --git a/client/tofu.go b/client/tofu.go index 479be52..d5a6bf5 100644 --- a/client/tofu.go +++ b/client/tofu.go @@ -62,7 +62,6 @@ func loadTofuEntry(domain string, port string) (string, time.Time, error) { return id, expiry, nil } -//nolint:errcheck // certID returns a generic string representing a cert or domain. func certID(cert *x509.Certificate) string { h := sha256.New() @@ -73,7 +72,7 @@ func certID(cert *x509.Certificate) string { // origCertID uses cert.Raw, which was used in v1.0.0 of the app. func origCertID(cert *x509.Certificate) string { h := sha256.New() - h.Write(cert.Raw) //nolint:errcheck + h.Write(cert.Raw) return fmt.Sprintf("%X", h.Sum(nil)) } diff --git a/config/config.go b/config/config.go index 882edac..54fbb89 100644 --- a/config/config.go +++ b/config/config.go @@ -119,6 +119,7 @@ func Init() error { // In APPDATA beside other Amfora files subscriptionDir = amforaAppData } else { + //nolint:revive // XDG data dir on POSIX systems xdg_data, ok := os.LookupEnv("XDG_DATA_HOME") if ok && strings.TrimSpace(xdg_data) != "" { diff --git a/config/keybindings.go b/config/keybindings.go index f5e048a..0645cc8 100644 --- a/config/keybindings.go +++ b/config/keybindings.go @@ -80,7 +80,7 @@ var tcellKeys map[string]tcell.Key // a string in the format used by the configuration file. Support // function for GetKeyBinding(), used to make the help panel helpful. func keyBindingToString(kb keyBinding) (string, bool) { - var prefix string = "" + var prefix string if kb.mod&tcell.ModAlt == tcell.ModAlt { prefix = "Alt-" @@ -103,7 +103,7 @@ func keyBindingToString(kb keyBinding) (string, bool) { // Used by the help panel so bindable keys display with their // bound values rather than hardcoded defaults. func GetKeyBinding(cmd Command) string { - var s string = "" + var s string for kb, c := range bindings { if c == cmd { t, ok := keyBindingToString(kb) @@ -122,8 +122,8 @@ func GetKeyBinding(cmd Command) string { // Parse a single keybinding string and add it to the binding map func parseBinding(cmd Command, binding string) { var k tcell.Key - var m tcell.ModMask = 0 - var r rune = 0 + var m tcell.ModMask + var r rune if strings.HasPrefix(binding, "Alt-") { m = tcell.ModAlt diff --git a/display/handlers.go b/display/handlers.go index 8deaf90..bee5da0 100644 --- a/display/handlers.go +++ b/display/handlers.go @@ -46,7 +46,7 @@ func handleHTTP(u string, showInfo bool) bool { } // Custom command - var err error = nil + var err error if len(config.HTTPCommand) > 1 { err = exec.Command(config.HTTPCommand[0], append(config.HTTPCommand[1:], u)...).Start() } else { diff --git a/sysopen/open_browser_darwin.go b/sysopen/open_browser_darwin.go index 49bd171..cf4320d 100644 --- a/sysopen/open_browser_darwin.go +++ b/sysopen/open_browser_darwin.go @@ -1,3 +1,4 @@ +//go:build darwin // +build darwin package sysopen diff --git a/sysopen/open_browser_other.go b/sysopen/open_browser_other.go index 7644a0e..3be7235 100644 --- a/sysopen/open_browser_other.go +++ b/sysopen/open_browser_other.go @@ -1,3 +1,4 @@ +//go:build !linux && !darwin && !windows && !freebsd && !netbsd && !openbsd // +build !linux,!darwin,!windows,!freebsd,!netbsd,!openbsd package sysopen diff --git a/sysopen/open_browser_unix.go b/sysopen/open_browser_unix.go index 88a215b..229c2ea 100644 --- a/sysopen/open_browser_unix.go +++ b/sysopen/open_browser_unix.go @@ -1,3 +1,4 @@ +//go:build linux || freebsd || netbsd || openbsd // +build linux freebsd netbsd openbsd //nolint:goerr113 diff --git a/sysopen/open_browser_windows.go b/sysopen/open_browser_windows.go index 4924ea8..ecadd01 100644 --- a/sysopen/open_browser_windows.go +++ b/sysopen/open_browser_windows.go @@ -1,3 +1,4 @@ +//go:build windows && (!linux || !darwin || !freebsd || !netbsd || !openbsd) // +build windows // +build !linux !darwin !freebsd !netbsd !openbsd diff --git a/webbrowser/open_browser_darwin.go b/webbrowser/open_browser_darwin.go index 44c522e..29ffb3d 100644 --- a/webbrowser/open_browser_darwin.go +++ b/webbrowser/open_browser_darwin.go @@ -1,3 +1,4 @@ +//go:build darwin // +build darwin package webbrowser diff --git a/webbrowser/open_browser_other.go b/webbrowser/open_browser_other.go index 9501034..580e2de 100644 --- a/webbrowser/open_browser_other.go +++ b/webbrowser/open_browser_other.go @@ -1,3 +1,4 @@ +//go:build !linux && !darwin && !windows && !freebsd && !netbsd && !openbsd // +build !linux,!darwin,!windows,!freebsd,!netbsd,!openbsd package webbrowser diff --git a/webbrowser/open_browser_unix.go b/webbrowser/open_browser_unix.go index 4d265be..71fcf7d 100644 --- a/webbrowser/open_browser_unix.go +++ b/webbrowser/open_browser_unix.go @@ -1,3 +1,4 @@ +//go:build linux || freebsd || netbsd || openbsd // +build linux freebsd netbsd openbsd //nolint:goerr113 diff --git a/webbrowser/open_browser_windows.go b/webbrowser/open_browser_windows.go index 66b8c46..8137c0d 100644 --- a/webbrowser/open_browser_windows.go +++ b/webbrowser/open_browser_windows.go @@ -1,3 +1,4 @@ +//go:build windows && (!linux || !darwin || !freebsd || !netbsd || !openbsd) // +build windows // +build !linux !darwin !freebsd !netbsd !openbsd