mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 15:51:43 +00:00
This fixes #28354 by using `CGO_ENABLED=1` when building `sg` binaries. We didn't do that in the past because we didn't know it was that easy to run on `macos-latest` in GitHub workflows. And using `CGO_ENABLED=0` caused the file-watching library we're using - github.com/rjeczalik/notify - to fallback to `kqueue` to watch files on macOS. That in turn is not performant when watching files in large folders. It seems to open/stat every file in our repository which then lead to a "too many open files" error. (You can see this in action if you compile `sg` with `CGO_ENABLED=0 go build -o sg .` and then run `sudo dtruss ./sg run github-proxy` on macOS. You'll see _ton_ of `open` and `stat` syscalls.) With CGO enabled though, `notify` uses `FSEvents` on macOS which handles our repository much better. And that also explains why building `sg` locally fixed the issue: locally we didn't turn CGO off. |
||
|---|---|---|
| .. | ||
| ISSUE_TEMPLATE | ||
| PULL_REQUEST_TEMPLATE | ||
| workflows | ||
| CODEOWNERS | ||
| PULL_REQUEST_TEMPLATE.md | ||
| teams.yml | ||