I have a little problem, where every time I run 'go run >filename<' after making changes to my problem, it takes many seconds to start executing.
I tried it with a simple program like this:
package main
import "fmt"
func main() {
fmt.Println("Output")
}
And it took about 18 seconds to print out the result.
And ideas on what could cause this problem?
I am on windows by the way.
Thanks in Advance
Found this while experiencing an identical issue with freshly-compiled golang binaries on MacOS (OSX) Catalina.
In short, the OS now scans a new (to it) binary for malware, it usually does it on first start, but I found that it was doing it 3-5 times in a row, after which the binary got whitelisted and started as normal. Obviously, once you make changes to the code and re-compile the scans start happening again. The scan would take upwards of 20 seconds which ruined golangs fast iteration cycle.
Solution for me was as follows:
sudo spctl developer-mode enable-terminal
Then go to Preferences -> Security & Privacy -> Privacy
In the list to the left you will now have "Developer Tools" section, which will have OSX built-in Terminal listed. Check the box to enable it, and/or add anything else you may be using to develop (iTerm, VS Code, etc)
When running binaries from those applications the scans stop and things go back to normal.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With