Appease linter

This commit is contained in:
makeworld 2021-12-01 11:18:20 -05:00
parent 9a2c2ec1f8
commit 6e17b57837
14 changed files with 17 additions and 12 deletions

View File

@ -19,15 +19,13 @@ linters:
- goerr113 - goerr113
- gofmt - gofmt
- goimports - goimports
- golint - revive
- goprintffuncname - goprintffuncname
- interfacer
- lll - lll
- maligned
- misspell - misspell
- nolintlint - nolintlint
- prealloc - prealloc
- scopelint - exportloopref
- unconvert - unconvert
- unparam - unparam

View File

@ -61,7 +61,6 @@ func Init() error {
err = os.Remove(config.OldBkmkPath) err = os.Remove(config.OldBkmkPath)
if err != nil { if err != nil {
//nolint:goerr113
return fmt.Errorf( return fmt.Errorf(
"couldn't delete old bookmarks file (%s), you must delete it yourself to prevent duplicate bookmarks: %w", "couldn't delete old bookmarks file (%s), you must delete it yourself to prevent duplicate bookmarks: %w",
config.OldBkmkPath, config.OldBkmkPath,

View File

@ -62,7 +62,6 @@ func loadTofuEntry(domain string, port string) (string, time.Time, error) {
return id, expiry, nil return id, expiry, nil
} }
//nolint:errcheck
// certID returns a generic string representing a cert or domain. // certID returns a generic string representing a cert or domain.
func certID(cert *x509.Certificate) string { func certID(cert *x509.Certificate) string {
h := sha256.New() 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. // origCertID uses cert.Raw, which was used in v1.0.0 of the app.
func origCertID(cert *x509.Certificate) string { func origCertID(cert *x509.Certificate) string {
h := sha256.New() h := sha256.New()
h.Write(cert.Raw) //nolint:errcheck h.Write(cert.Raw)
return fmt.Sprintf("%X", h.Sum(nil)) return fmt.Sprintf("%X", h.Sum(nil))
} }

View File

@ -119,6 +119,7 @@ func Init() error {
// In APPDATA beside other Amfora files // In APPDATA beside other Amfora files
subscriptionDir = amforaAppData subscriptionDir = amforaAppData
} else { } else {
//nolint:revive
// XDG data dir on POSIX systems // XDG data dir on POSIX systems
xdg_data, ok := os.LookupEnv("XDG_DATA_HOME") xdg_data, ok := os.LookupEnv("XDG_DATA_HOME")
if ok && strings.TrimSpace(xdg_data) != "" { if ok && strings.TrimSpace(xdg_data) != "" {

View File

@ -80,7 +80,7 @@ var tcellKeys map[string]tcell.Key
// a string in the format used by the configuration file. Support // a string in the format used by the configuration file. Support
// function for GetKeyBinding(), used to make the help panel helpful. // function for GetKeyBinding(), used to make the help panel helpful.
func keyBindingToString(kb keyBinding) (string, bool) { func keyBindingToString(kb keyBinding) (string, bool) {
var prefix string = "" var prefix string
if kb.mod&tcell.ModAlt == tcell.ModAlt { if kb.mod&tcell.ModAlt == tcell.ModAlt {
prefix = "Alt-" prefix = "Alt-"
@ -103,7 +103,7 @@ func keyBindingToString(kb keyBinding) (string, bool) {
// Used by the help panel so bindable keys display with their // Used by the help panel so bindable keys display with their
// bound values rather than hardcoded defaults. // bound values rather than hardcoded defaults.
func GetKeyBinding(cmd Command) string { func GetKeyBinding(cmd Command) string {
var s string = "" var s string
for kb, c := range bindings { for kb, c := range bindings {
if c == cmd { if c == cmd {
t, ok := keyBindingToString(kb) 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 // Parse a single keybinding string and add it to the binding map
func parseBinding(cmd Command, binding string) { func parseBinding(cmd Command, binding string) {
var k tcell.Key var k tcell.Key
var m tcell.ModMask = 0 var m tcell.ModMask
var r rune = 0 var r rune
if strings.HasPrefix(binding, "Alt-") { if strings.HasPrefix(binding, "Alt-") {
m = tcell.ModAlt m = tcell.ModAlt

View File

@ -46,7 +46,7 @@ func handleHTTP(u string, showInfo bool) bool {
} }
// Custom command // Custom command
var err error = nil var err error
if len(config.HTTPCommand) > 1 { if len(config.HTTPCommand) > 1 {
err = exec.Command(config.HTTPCommand[0], append(config.HTTPCommand[1:], u)...).Start() err = exec.Command(config.HTTPCommand[0], append(config.HTTPCommand[1:], u)...).Start()
} else { } else {

View File

@ -1,3 +1,4 @@
//go:build darwin
// +build darwin // +build darwin
package sysopen package sysopen

View File

@ -1,3 +1,4 @@
//go:build !linux && !darwin && !windows && !freebsd && !netbsd && !openbsd
// +build !linux,!darwin,!windows,!freebsd,!netbsd,!openbsd // +build !linux,!darwin,!windows,!freebsd,!netbsd,!openbsd
package sysopen package sysopen

View File

@ -1,3 +1,4 @@
//go:build linux || freebsd || netbsd || openbsd
// +build linux freebsd netbsd openbsd // +build linux freebsd netbsd openbsd
//nolint:goerr113 //nolint:goerr113

View File

@ -1,3 +1,4 @@
//go:build windows && (!linux || !darwin || !freebsd || !netbsd || !openbsd)
// +build windows // +build windows
// +build !linux !darwin !freebsd !netbsd !openbsd // +build !linux !darwin !freebsd !netbsd !openbsd

View File

@ -1,3 +1,4 @@
//go:build darwin
// +build darwin // +build darwin
package webbrowser package webbrowser

View File

@ -1,3 +1,4 @@
//go:build !linux && !darwin && !windows && !freebsd && !netbsd && !openbsd
// +build !linux,!darwin,!windows,!freebsd,!netbsd,!openbsd // +build !linux,!darwin,!windows,!freebsd,!netbsd,!openbsd
package webbrowser package webbrowser

View File

@ -1,3 +1,4 @@
//go:build linux || freebsd || netbsd || openbsd
// +build linux freebsd netbsd openbsd // +build linux freebsd netbsd openbsd
//nolint:goerr113 //nolint:goerr113

View File

@ -1,3 +1,4 @@
//go:build windows && (!linux || !darwin || !freebsd || !netbsd || !openbsd)
// +build windows // +build windows
// +build !linux !darwin !freebsd !netbsd !openbsd // +build !linux !darwin !freebsd !netbsd !openbsd