Go will try to optimize for the number of cores reported on the system. For Docker executor jobs the environment will report the number of cores on the VM rather than the available cores for the container. This can cause go to spawn too many workers and use all your jobs memory. set GOMAXPROCS to the number of cores available to your job. The default resource class (medium) for docker executor jobs has 2 cores available.
jobs: build: docker: - image: circleci/golang:1.12
GOMAXPROCS: 2 steps: - run: