My latest attempt:
(devenv) bash-5.2$ bazel run //:gazelle --sandbox_debug
Starting local Bazel server and connecting to it...
DEBUG: /private/var/tmp/_bazel_brmay/97218223d142e1e57c833f3d7b357552/external/bazel_gazelle/internal/go_repository.bzl:189:18: org_golang_x_mod: gaz
elle: finding module path for import golang.org/x/xerrors: finding module path for import golang.org/x/xerrors: //go:build comment without // +build
comment
INFO: Analyzed target //:gazelle (90 packages loaded, 7652 targets configured).
INFO: Found 1 target...
ERROR: /private/var/tmp/_bazel_brmay/97218223d142e1e57c833f3d7b357552/external/org_golang_x_mod/module/BUILD.bazel:3:11: GoCompilePkg external/org_go
lang_x_mod/module/module.a [for tool] failed: (Exit 1): process-wrapper failed: error executing command
(cd /private/var/tmp/_bazel_brmay/97218223d142e1e57c833f3d7b357552/sandbox/processwrapper-sandbox/16/execroot/__main__ && \
exec env - \
APPLE_SDK_PLATFORM=MacOSX \
APPLE_SDK_VERSION_OVERRIDE=14.5 \
CGO_ENABLED=1 \
DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer \
GOARCH=arm64 \
GOOS=darwin \
GOPATH='' \
GOROOT=external/go_sdk \
GOROOT_FINAL=GOROOT \
PATH=external/local_config_cc:/bin:/usr/bin \
SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk \
TMPDIR=/tmp/brmay/nix-shell.fg2zct \
XCODE_VERSION_OVERRIDE=15.4.0.15F31d \
ZERO_AR_DATE=1 \
/var/tmp/_bazel_brmay/install/ea5ec5be56ce8b5a215d22d37e0d49d6/process-wrapper '--timeout=0' '--kill_delay=15' '--stats=/private/var/tmp/_bazel_brmay/97218223d142e1e57c833f3d7b357552/sandbox/processwrapper-sandbox/16/stats.out' bazel-out/darwin_arm64-opt-exec-2B5CBBC6/bin/external/go_sdk/builder compilepkg -sdk external/go_sdk -installsuffix darwin_arm64 -src external/org_golang_x_mod/module/module.go -arc 'golang.org/x/mod/semver=golang.org/x/mod/semver=bazel-out/darwin_arm64-opt-exec-2B5CBBC6/bin/external/org_golang_x_mod/semver/semver.x' -importpath golang.org/x/mod/module -p golang.org/x/mod/module -package_list bazel-out/darwin_arm64-opt-exec-2B5CBBC6/bin/external/go_sdk/packages.txt -o bazel-out/darwin_arm64-opt-exec-2B5CBBC6/bin/external/org_golang_x_mod/module/module.a -x bazel-out/darwin_arm64-opt-exec-2B5CBBC6/bin/external/org_golang_x_mod/module/module.x -gcflags '' -asmflags '')
compilepkg: missing strict dependencies:
/private/var/tmp/_bazel_brmay/97218223d142e1e57c833f3d7b357552/sandbox/processwrapper-sandbox/16/execroot/__main__/external/org_golang_x_mod/module/module.go: import of "golang.org/x/xerrors"
No dependencies were provided.
Check that imports in Go sources match importpath attributes in deps.
Target //:gazelle failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 127.869s, Critical Path: 2.23s
INFO: 31 processes: 19 internal, 12 processwrapper-sandbox.
FAILED: Build did NOT complete successfully
ERROR: Build failed. Not running target
That makes no sense to me. I might end up just doing this in a Linux VM or something.