Skip to content

feat(cli): mcc --version command 보완 - #80

Merged
MZC-CSC merged 1 commit into
developfrom
fix-mcc-version-flag
Sep 3, 2026
Merged

MZC-CSC merged 1 commit into
developfrom
fix-mcc-version-flag

Conversation

@dogfootman

@dogfootman dogfootman commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

변경 내용

root command에 Version 필드를 설정. 빌드 시스템에 ldflags 기반 버전 주입 패턴이 없어서(순수 go build/make 뿐), 별도 빌드 스크립트 변경 없이 Go 1.18+가 git 체크아웃 내부에서 빌드할 때 자동으로 심어주는 VCS 정보(runtime/debug.ReadBuildInfo())를 런타임에 읽어 사용 — 커밋 해시 12자리 + 워킹트리에 미커밋 변경이 있으면 -dirty 접미사. 빌드 정보를 못 읽는 환경(go run 등)에서는 "dev"로 폴백.

./mcc --version has never worked - Cobra only registers --version
when the root command's Version field is set, and it wasn't, so the
flag simply didn't exist (docs telling users to run it as a smoke
test always failed with "unknown flag").

Pull the version from the VCS info Go embeds automatically for any
build done inside a git checkout (default since Go 1.18, no ldflags
or build script changes needed) - the short commit hash, plus
"-dirty" if the working tree had uncommitted changes at build time.
Falls back to "dev" when build info isn't available (e.g. go run).
@MZC-CSC MZC-CSC changed the title feat(cli): register a Version flag on the root command feat(cli): mcc --version command 보완 Sep 3, 2026
@MZC-CSC
MZC-CSC merged commit c0d360e into develop Sep 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants