Skip to content

feature: binary versioning#24

Merged
dkorunic merged 2 commits intodkorunic:mainfrom
thushan:feature/versioning
Oct 27, 2025
Merged

feature: binary versioning#24
dkorunic merged 2 commits intodkorunic:mainfrom
thushan:feature/versioning

Conversation

@thushan
Copy link
Copy Markdown
Contributor

@thushan thushan commented Oct 27, 2025

Thanks for building betteralign!

This PR adds versioning to betteralign to... better align 😄 with other tools (but also, because we'd love to know what version this is we're running). We have to have strict versioning in our pipelines (SBOM etc).

I've targeted -V and --version for now, but let me know if you want something else.

Faking a build locally:

go build -ldflags "-s -w -X main.Version=1.2.3 -X main.Commit=$commit -X main.Date=$date -X main.Timestamp=$date" -o betteralign.exe .\cmd\betteralign

gives us:

betteralign version 1.2.3 (commit 30cf829) built on 2025-10-27

I've also got a makefile if you want me to put that in this so it's easier in the future.

NOTE: Tests are broken in main currently - unrelated to this PR.

@dkorunic dkorunic merged commit 8ed4c07 into dkorunic:main Oct 27, 2025
@dkorunic
Copy link
Copy Markdown
Owner

@thushan Thanks! Note that some of tests are architecture-dependant, so they are not broken, but results on amd64 and arm64 will work differently:

TMPDIR=/var/tmp go test -v ./...
=== RUN   TestSuggestions
--- PASS: TestSuggestions (1.14s)
=== RUN   TestApply
--- PASS: TestApply (1.00s)
=== RUN   TestFlagExcludeDirs
=== RUN   TestFlagExcludeDirs/exclude_none
=== RUN   TestFlagExcludeDirs/exclude_all
=== RUN   TestFlagExcludeDirs/exclude_a
--- PASS: TestFlagExcludeDirs (0.04s)
    --- PASS: TestFlagExcludeDirs/exclude_none (0.01s)
    --- PASS: TestFlagExcludeDirs/exclude_all (0.01s)
    --- PASS: TestFlagExcludeDirs/exclude_a (0.01s)
=== RUN   TestFlagExcludeFiles
=== RUN   TestFlagExcludeFiles/exclude_b
--- PASS: TestFlagExcludeFiles (0.01s)
    --- PASS: TestFlagExcludeFiles/exclude_b (0.01s)
=== RUN   TestFlagOptInMode
=== RUN   TestFlagOptInMode/opt-in_enabled,_one_bad_struct_opted_in_and_another_bad_struct_not_opted_in
--- PASS: TestFlagOptInMode (0.01s)
    --- PASS: TestFlagOptInMode/opt-in_enabled,_one_bad_struct_opted_in_and_another_bad_struct_not_opted_in (0.01s)
PASS
ok      github.com/dkorunic/betteralign 2.228s
?       github.com/dkorunic/betteralign/cmd/betteralign [no test files]

@thushan thushan deleted the feature/versioning branch October 27, 2025 07:12
@thushan
Copy link
Copy Markdown
Contributor Author

thushan commented Oct 27, 2025

ah thanks, they are too, I was just trying on a temporary laptop, didn't look deep.

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.

2 participants