1
0
mirror of https://github.com/makew0rld/amfora.git synced 2024-12-04 14:46:29 -05:00

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
- gofmt
- goimports
- golint
- revive
- goprintffuncname
- interfacer
- lll
- maligned
- misspell
- nolintlint
- prealloc
- scopelint
- exportloopref
- unconvert
- unparam

View File

@ -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,

View File

@ -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))
}

View File

@ -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) != "" {

View File

@ -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

View File

@ -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 {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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