If you’re a Golang developer and you’re using Mac OSX as your daily programming battle-station with IDEA IntelliJ editor, then for sure you’ve noticed this annoying popup for incoming connection when you compile your go app (if you by default blocking all unwanted connections).

Do you want the application "__go_build_main_go" to accept incoming network connections?

There is only one word for this if you see this 100 times a day and even when adding it to the Firewall exceptions didn’t work - it’s called “frustration”.

But Hey! - there is a really simple way to get rid off this annoying popup each time you build your app.

The only thing you have to do is to set localhost to your server’s hostname. This is important because otherwise, OSX treats any connection as a hostile connection (especially when you up intentionally).

So in summary, for local development, you have to set host and give a port. E.g.: localhost:8000.

To have a simple example where you can easily get where to apply it in to your program:

http.ListenAndServe("localhost:" + strconv.Itoa(port), router))

So, finally, you can say an ultimate “bye, bye” to this annoying notification 🙂

Do you want the application "__go_build_main_go" to accept incoming network connections?
Clicking Deny may limit the application's behavior. This setting can be changed in the Firewall pane of Security & Privacy preferences.