Thanks to visit codestin.com
Credit goes to github.com

Skip to content

chore: add goheader linter for dev-time SPDX header enforcement#332

Merged
clangenb merged 2 commits into
mainfrom
chore/goheader-linter
Apr 15, 2026
Merged

chore: add goheader linter for dev-time SPDX header enforcement#332
clangenb merged 2 commits into
mainfrom
chore/goheader-linter

Conversation

@eldara-cruncher
Copy link
Copy Markdown
Collaborator

@eldara-cruncher eldara-cruncher commented Apr 15, 2026

Summary

  • Add `goheader` linter to `.golangci.yml` — `golangci-lint run` now catches missing SPDX headers locally, complementing the CI `check-spdx.sh` check
  • Add `SPDX-License-Identifier: Apache-2.0` + `Copyright © 2026 Eldara Tech` headers to 54 `.go` files that were added to `main` after the original SPDX pass and slipped through undetected
  • Fix `scripts/check-spdx.sh`: had a POSIX pipe-subshell bug where `fail=1` inside `while read | pipe` ran in a subshell, so `exit "$fail"` always exited 0 — rewrote to feed `find` output via a temp file so `fail` propagates correctly

Test plan

  • `./scripts/check-spdx.sh` exits 0
  • `golangci-lint run ./...` passes with goheader enabled
  • CI green

🤖 Generated with Claude Code

eldara-cruncher and others added 2 commits April 15, 2026 15:48
Enforce SPDX headers at lint time — `golangci-lint run` now catches missing
headers locally, complementing the existing CI-only `scripts/check-spdx.sh`
check. All existing .go files already carry the required header.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
54 .go files added to main after the original SPDX pass were missing
headers. The gap went undetected because check-spdx.sh had a pipe-subshell
bug: `fail=1` inside `while read` runs in a subshell (POSIX pipe semantics),
so the outer `exit "$fail"` always exited 0.

Fix check-spdx.sh to avoid the pipe by writing find output to a temp file
and reading from it, so `fail` propagates correctly.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@clangenb clangenb requested a review from aigents999 April 15, 2026 15:52
@clangenb clangenb merged commit d5360e0 into main Apr 15, 2026
11 checks passed
@eldara-cruncher eldara-cruncher deleted the chore/goheader-linter branch June 5, 2026 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants