linux系统;
当我运行
import (
//_ "myproject/routers"
"fmt"
"net/http"
)
func IndexHandler(w http.ResponseWriter,req *http.Request){
fmt.Fprintln(w, "hello world")
}
func main() {
//beego.Run()
http.HandleFunc("/hello",IndexHandler)
err:=http.ListenAndServe("127.0.0.1:8080",nil)
if err!=nil{
panic(err)
}
}
报错listen tcp :8080: socket: operation not permitted
看看是不是端口占用或者防火墙造成的。
systemctl stop firewallld
关闭防火墙应该就OK了