Repository navigation
docs: document the pre-commit tool overrides and the Go-upgrade trap - #43
Merged
Merged
Conversation
.githooks/pre-commit already honours PRETTIER and GOLANGCI_LINT ahead of its PATH and GOPATH lookups (lines 4-5), but CLAUDE.md never said so; it only described the hook exiting when a tool is missing. The common way to hit that exit is a Go upgrade under a version manager that keeps one GOPATH per Go version: go env GOPATH moves to the new version's directory, the tools stay behind in the old one, and every commit fails. The new paragraph names the overrides and says to reinstall at the version the old binary reports, because make setup installs @latest and can format the tree differently.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
한 줄 요약
CLAUDE.md의 Pre-commit Hooks 절에 한 문단을 더합니다. 훅은 이미
PRETTIER와GOLANGCI_LINT환경 변수를 도구 위치보다 먼저 보지만, 문서에는 그 사실이 없었습니다. Go 버전 관리자가 Go 버전마다 GOPATH를 따로 두면, Go를 올린 뒤 훅이 도구를 못 찾아 모든 커밋이 막힙니다. 문단은 그 상황과 복구 방법을 적습니다. 코드 변경이 없고 제품 변화도 없습니다.이 PR을 읽는 데 필요한 배경 지식
1. pre-commit 훅의 도구 찾기
.githooks/pre-commit4–5행은 golangci-lint와 prettier를 이 순서로 찾습니다.GOLANGCI_LINT,PRETTIER환경 변수가 비어 있지 않으면 그 경로PATH에서 찾은 명령$(go env GOPATH)/bin아래 파일셋 다 실패하면 훅은 검사 전에 종료하고 커밋은 만들어지지 않습니다.
2. GOPATH를 Go 버전마다 나누는 도구
goenv 같은 버전 관리자는 GOPATH를 Go 버전별 폴더로 둘 수 있습니다. 예를 들어 Go를 1.27.1에서 1.27.3으로 올리면
go env GOPATH가~/go/1.27.1에서~/go/1.27.3으로 바뀝니다.go install로 받은 prettier는 옛 폴더에 남습니다.무엇이 문제였나
make setup은prettier@latest를 받으므로, 옛 버전과 서식 결과가 달라질 수 있음어떻게 고쳤나
Pre-commit Hooks 절의 도구 누락 설명 바로 아래에 문단 하나를 넣었습니다.
PRETTIER·GOLANGCI_LINT가 두 찾기 단계보다 먼저 쓰인다는 것과 사용 예go version -m으로 읽어 같은 버전으로 다시 설치하라는 권고.go version -m은 바이너리를 실행하지 않고 빌드 정보만 읽습니다.기각한 대안
make setup을 버전 고정 설치로 바꾸기: 리포가 prettier 버전을 어디에도 고정하지 않으므로 고정할 버전을 먼저 정해야 합니다. 이 PR 범위 밖입니다.기대되는 효과
make setup(@latest)docs:커밋이라 머지해도 릴리스는 나오지 않습니다.검증
.githooks/pre-commit4–5행:${PRETTIER:-…},${GOLANGCI_LINT:-…}git grep -n 'PRETTIER|GOLANGCI_LINT' eece1a0 -- CLAUDE.md결과 0줄make setup의 설치 버전Makefile47행prettier@latest범위 밖 (후속 추적)
make setup, CI): 고정할 버전과 위치를 먼저 정해야 합니다. 미이슈화.