From: Edd Barrett Subject: Re: ports setting GOMAXPROCS To: Theo Buehler Cc: ports@openbsd.org, claudio@openbsd.org, edd@openbsd.org, kn@openbsd.org, lraab@openbsd.org, jsing@openbsd.org, stu@spacehopper.org Date: Sun, 25 Jan 2026 11:36:20 +0000 No objections from me. 25 Jan 2026 10:50:19 Theo Buehler : > Several go ports set GOMAXPROCs to MAKE_JOBS in MAKE_ENV. I think this > is more brutal than intended and hinders more than it helps because per > https://pkg.go.dev/runtime: > >   The GOMAXPROCS variable limits the number of operating system threads >   that can execute user-level Go code simultaneously > > In my test bulk builds with go 1.26rc2, grafana takes more than half > an hour to do its one slow compile/link/whatever step. I had one > pathological bulk where it took 4000s. > > jsing points out that it would be better to pass -p ${MAKE_JOBS} to > the build/run/install commands, which the go module already adds to > the MODGO_FLAGS. > > -p n >     the number of programs, such as build commands or >     test binaries, that can be run in parallel. >     The default is GOMAXPROCS, normally the number of CPUs available. > > Now this doesn't seem entirely true in practice since I see the builds > spawning a few processes more than one but I think this is acceptable > given that it's only for a rather short time. > > The below is my suggestion for reposurgeon, syncthing and grafana. > syncthing might want to do the same in its hand-rolled test command. > > There's another one in prometheus, but it looks slightly different. > > Index: devel/reposurgeon/Makefile > =================================================================== > RCS file: /cvs/ports/devel/reposurgeon/Makefile,v > diff -u -p -r1.20 Makefile > --- devel/reposurgeon/Makefile  28 Jun 2025 00:36:32 -0000  1.20 > +++ devel/reposurgeon/Makefile  24 Jan 2026 22:52:33 -0000 > @@ -26,7 +26,7 @@ MODRUBY_RUNDEP=   No > WRKSRC=        ${WRKDIST} > WRKBUILD=  ${WRKDIST} > MODGO_GOPATH=  ${MODGO_WORKSPACE}:${MODGO_PACKAGE_PATH}:${WRKSRC}/vendor > -MAKE_ENV=  GOFLAGS=-v GOMAXPROCS=${MAKE_JOBS} > +MAKE_ENV=  GOFLAGS=-v > > FAKE_FLAGS=    mandir=man > > Index: net/syncthing/Makefile > =================================================================== > RCS file: /cvs/ports/net/syncthing/Makefile,v > diff -u -p -r1.76 Makefile > --- net/syncthing/Makefile  17 Jan 2026 00:37:56 -0000  1.76 > +++ net/syncthing/Makefile  25 Jan 2026 10:16:37 -0000 > @@ -27,8 +27,6 @@ MODULES =     lang/go > # so we package only these binaries. > ST_CMDS =  syncthing stdiscosrv strelaysrv > > -MAKE_ENV = GOMAXPROCS=${MAKE_JOBS} > - > pre-build: >     ${SUBST_CMD} ${WRKSRC}/cmd/syncthing/main.go > > @@ -37,7 +35,7 @@ pre-build: > # without quic support obviously). When you do that, some more tests will fail. > do-build: > .for cmd in ${ST_CMDS} > -   cd ${WRKSRC} && ${MODGO_CMD} run build.go -version v${V} \ > +   cd ${WRKSRC} && ${MODGO_CMD} run ${MODGO_FLAGS} build.go -version v${V} \ >         -no-upgrade install ${cmd} > .endfor > > Index: sysutils/grafana/Makefile > =================================================================== > RCS file: /cvs/ports/sysutils/grafana/Makefile,v > diff -u -p -r1.56 Makefile > --- sysutils/grafana/Makefile   19 Dec 2025 02:30:03 -0000  1.56 > +++ sysutils/grafana/Makefile   25 Jan 2026 10:06:46 -0000 > @@ -35,7 +35,6 @@ WANTLIB +=    c pthread > > MODGO_GO111MODULE = on > MODGO_FLAGS += -ldflags="-w -X main.version=$V" > -MAKE_ENV = GOMAXPROCS=${MAKE_JOBS} > > do-build: >     mkdir -p ${WRKDIR}/go/src/github.com/grafana