I spent an hour debugging a failed deployment on Coolify. The Go build was dying at go build ./cmd/server with exit code 1 — no useful error, just silence.
The code compiled perfectly locally. Cross-compilation to linux/amd64 worked fine. No platform-specific files. Clean go mod verify.
Then I ran git check-ignore -v cmd/server/main.go and saw this:
.gitignore:7:server cmd/server/main.go
My .gitignore had:
# Compiled binary
server
That single word server — without a leading / — matches any path segment named server. It was silently excluding my entire cmd/server/ directory from git. The entrypoint was never pushed. Coolify cloned an empty cmd/server/ folder and go build had nothing to compile.
The fix is one character:
/server
A leading / anchors the pattern to the repo root, so it only ignores the compiled binary and leaves cmd/server/ alone.
The lesson: gitignore patterns without a leading slash are recursive. server means “anything named server, anywhere in the tree.” /server means “only the thing named server at the root.” When you’re ignoring a compiled binary that shares a name with a source directory, always anchor it.
Run git check-ignore -v <path> when something that should be tracked isn’t showing up. It tells you exactly which rule is responsible.