Loading main.go +7 −1 Original line number Diff line number Diff line Loading @@ -4,6 +4,8 @@ import ( "fmt" "log" "net/http" "github.com/pkg/browser" ) func main() { Loading @@ -14,8 +16,12 @@ func main() { http.HandleFunc("/", handlerIndex) // http://localhost:8080/s/test.html sp := "/s/" fs := http.FileServer(http.Dir("static")) http.Handle("/s/", http.StripPrefix("/s/", fs)) http.Handle(sp, http.StripPrefix(sp, fs)) // open browser... works... but it should be run after ListenAndServe browser.OpenURL("http://" + srv + "/s/test.html") err := http.ListenAndServe(srv, nil) if err != nil { Loading Loading
main.go +7 −1 Original line number Diff line number Diff line Loading @@ -4,6 +4,8 @@ import ( "fmt" "log" "net/http" "github.com/pkg/browser" ) func main() { Loading @@ -14,8 +16,12 @@ func main() { http.HandleFunc("/", handlerIndex) // http://localhost:8080/s/test.html sp := "/s/" fs := http.FileServer(http.Dir("static")) http.Handle("/s/", http.StripPrefix("/s/", fs)) http.Handle(sp, http.StripPrefix(sp, fs)) // open browser... works... but it should be run after ListenAndServe browser.OpenURL("http://" + srv + "/s/test.html") err := http.ListenAndServe(srv, nil) if err != nil { Loading