go run app.go always run in the background -
go1.8
how come following rund in background? have named file server.go , doing "go run server.go
"
package main import ( "fmt" "net/http" ) func handler(w http.responsewriter, r *http.request) { fmt.fprintf(w, "hi there x, love %s!", r.url.path[1:]) } func main() { http.handlefunc("/", handler) http.listenandserve(":8080", nil) }
vs code launch.json
{ "version": "0.2.0", "configurations": [ { "name": "launch", "type": "go", "request": "launch", "mode": "debug", "remotepath": "", "port": 2345, "host": "127.0.0.1", "program": "${workspaceroot}", "env": {}, "args": [], "showlog": true } ] }
update: error in vs code terminal:
2017/04/07 16:41:41 debugger.go:257: created breakpoint: &api.breakpoint{id:1, name:"", addr:0x12063ef, file:"/users/x/documents/x/play/go/server.go", line:9, functionname:"main.handler", cond:"", tracepoint:false, goroutine:false, stacktrace:0, variables:[]string(nil), loadargs:(*api.loadconfig)(nil), loadlocals:(*api.loadconfig)(nil), hitcount:map[string]uint64{}, totalhitcount:0x0} 2017/04/07 16:41:41 debugger.go:412: continuing
did tried running server using nohup?
nohup go run server.go &
Comments
Post a Comment