Fix lint errors
This commit is contained in:
parent
795b7250ed
commit
4b6686cde6
@ -156,7 +156,9 @@ func main() {
|
|||||||
case "webserver":
|
case "webserver":
|
||||||
fs := flag.NewFlagSet("", flag.ExitOnError)
|
fs := flag.NewFlagSet("", flag.ExitOnError)
|
||||||
should_auto_open := fs.Bool("auto-open", false, "")
|
should_auto_open := fs.Bool("auto-open", false, "")
|
||||||
fs.Parse(args[1:])
|
if err := fs.Parse(args[1:]); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
start_webserver(*addr, *should_auto_open)
|
start_webserver(*addr, *should_auto_open)
|
||||||
case "fetch_inbox":
|
case "fetch_inbox":
|
||||||
fetch_inbox(*how_many)
|
fetch_inbox(*how_many)
|
||||||
|
@ -9,8 +9,8 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"runtime"
|
|
||||||
"path"
|
"path"
|
||||||
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@ -156,14 +156,18 @@ func (app *Application) Run(address string, should_auto_open bool) {
|
|||||||
app.ErrorLog.Fatal(err)
|
app.ErrorLog.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
func openWebPage(url string) error {
|
func openWebPage(url string) {
|
||||||
|
var cmd *exec.Cmd
|
||||||
switch runtime.GOOS {
|
switch runtime.GOOS {
|
||||||
case "darwin": // macOS
|
case "darwin": // macOS
|
||||||
return exec.Command("open", url).Run()
|
cmd = exec.Command("open", url)
|
||||||
case "windows":
|
case "windows":
|
||||||
return exec.Command("cmd", "/c", "start", url).Run()
|
cmd = exec.Command("cmd", "/c", "start", url)
|
||||||
default: // Linux and others
|
default: // Linux and others
|
||||||
return exec.Command("xdg-open", url).Run()
|
cmd = exec.Command("xdg-open", url)
|
||||||
|
}
|
||||||
|
if err := cmd.Run(); err != nil {
|
||||||
|
log.Printf("Failed to open homepage: %s", err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user