If you are calling go run main.go
the following is happening:
- your program is compiled inside a temporary folder
- the compiled binary is executed
But the temporary folder is just for one execution. So the next time when you run your program via go run
another folder is used.
The Windows firewall always gives you the path your server has and if you remember the paths after each time you will see that there is always a different path.
The Windows firewall is configured so that it remembers the path of each program. So when the path is changed you will always need to confirm that the new path is allowed to run on that port.
To fix this you should compile your server. Just run go build
and execute the binaries inside your project folder. Then you will just have to accept once.