LoginSignup
8
4

More than 5 years have passed since last update.

macでGo echoサーバーを再起動する度にファイアウォールのアラートが出るのを回避する

Posted at

echoに限らない話かもしれませんが、ずっと悩んでいたのでメモ。
echoのドキュメントどおりにサーバーを作成すると、再起動の度にmacのファイアウォールのアラートが表示される。
スクリーンショット 2017-08-31 16.47.31.png
ファイアウォールパネルから設定せよと書いてあるのだが、ファイアウォールオプションから許可にしても出続ける。

echoのドキュメントに書いてあるサンプルはこんな感じ。

func main() {
    e := echo.New()
    e.GET("/", func(c echo.Context) error {
        return c.String(http.StatusOK, "Hello, World!")
    })
    e.Logger.Fatal(e.Start(":1323"))
}

e.Startの引数を変えてあげると、アラートは出なくなった。

func main() {
    e := echo.New()
    e.GET("/", func(c echo.Context) error {
        return c.String(http.StatusOK, "Hello, World!")
    })
    e.Logger.Fatal(e.Start("localhost:1323"))
}

ずっとイライラしていたので解決方法が見つかって嬉しい。

8
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
4