Gofmt and refactor openPage
This commit is contained in:
7
main.go
7
main.go
@@ -21,7 +21,7 @@ var options struct {
|
|||||||
User string `long:"user" description:"Database user" default:"postgres"`
|
User string `long:"user" description:"Database user" default:"postgres"`
|
||||||
DbName string `long:"db" description:"Database name" default:"postgres"`
|
DbName string `long:"db" description:"Database name" default:"postgres"`
|
||||||
Ssl string `long:"ssl" description:"SSL option" default:"disable"`
|
Ssl string `long:"ssl" description:"SSL option" default:"disable"`
|
||||||
HttpPort string `long:"httpPort" description:"http port option" default:"8080"`
|
HttpPort string `long:"httpPort" description:"HTTP server listen port" default:"8080"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var dbClient *Client
|
var dbClient *Client
|
||||||
@@ -109,14 +109,15 @@ func handleSignals() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func openPage() {
|
func openPage() {
|
||||||
fmt.Println("To view database open http://localhost:" + options.HttpPort + " in browser")
|
url := "http://localhost:" + options.HttpPort
|
||||||
|
fmt.Println("To view database open", url, "in browser")
|
||||||
|
|
||||||
_, err := exec.Command("which", "open").Output()
|
_, err := exec.Command("which", "open").Output()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
exec.Command("open", "http://localhost:" + options.HttpPort).Output()
|
exec.Command("open", url).Output()
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|||||||
Reference in New Issue
Block a user