一只放羊的 2020-03-26 14:46 采纳率: 0%
浏览 784
已结题

goland开启服务器报错socket: operation not permitted

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

  • 写回答

2条回答 默认 最新

  • threenewbee 2020-03-26 16:42
    关注

    看看是不是端口占用或者防火墙造成的。

    评论

报告相同问题?