ARTICLES

Go Build Error - Too Many Open Files

I received the following go build error on my Mac. However, the same code ran fine on a linux server.

ERROR build.go:386: Failed to parse build errors error=“go tool compile: fork/exec /usr/local/go/pkg/tool/darwin_amd64/compile: too many open files\n”
ERROR harness.go:219: Build detected an error error=“Go Compilation Error: See console for build error.”

The problem was the mac os open files limit was set too low at 256. To solve the problem I modified the .bashrc file to increase the amount of open files allowed to over a million. I added the following line to the .bashrc file:

launchctl limit maxfiles 1048576 1048576