🚨 Make linter happy

This commit is contained in:
makeworld 2020-11-04 18:47:27 -05:00
parent 72e38e8b8d
commit 5adb676a68
2 changed files with 9 additions and 9 deletions

View File

@ -39,7 +39,7 @@ var bkmkPath string
var DownloadsDir string
// Command for opening HTTP(S) URLs in the browser, from "a-general.http" in config.
var HttpCommand []string
var HTTPCommand []string
//nolint:golint,goerr113
func Init() error {
@ -241,12 +241,12 @@ func Init() error {
} // Otherwise it's black by default
// Parse HTTP command
HttpCommand = viper.GetStringSlice("a-general.http")
if len(HttpCommand) == 0 {
HTTPCommand = viper.GetStringSlice("a-general.http")
if len(HTTPCommand) == 0 {
// Not a string array, interpret as a string instead
// Split on spaces to maintain compatibility with old versions
// The new better way to is to just define a string array in config
HttpCommand = strings.Fields(viper.GetString("a-general.http"))
HTTPCommand = strings.Fields(viper.GetString("a-general.http"))
}
return nil

View File

@ -146,10 +146,10 @@ func setPage(t *tab, p *structs.Page) {
// handleHTTP is used by handleURL.
// It opens HTTP links and displays Info and Error modals.
func handleHTTP(u string, showInfo bool) {
if len(config.HttpCommand) == 1 {
if len(config.HTTPCommand) == 1 {
// Possibly a non-command
switch strings.TrimSpace(config.HttpCommand[0]) {
switch strings.TrimSpace(config.HTTPCommand[0]) {
case "", "off":
Error("HTTP Error", "Opening HTTP URLs is turned off.")
case "default":
@ -163,10 +163,10 @@ func handleHTTP(u string, showInfo bool) {
} else {
// Custom command
var err error = nil
if len(config.HttpCommand) > 1 {
err = exec.Command(config.HttpCommand[0], append(config.HttpCommand[1:], u)...).Start()
if len(config.HTTPCommand) > 1 {
err = exec.Command(config.HTTPCommand[0], append(config.HTTPCommand[1:], u)...).Start()
} else {
err = exec.Command(config.HttpCommand[0], u).Start()
err = exec.Command(config.HTTPCommand[0], u).Start()
}
if err != nil {
Error("HTTP Error", "Error executing custom browser command: "+err.Error())