Skip to content

chore: don't override Version if set via ldflags - #286

Merged
zeroshade merged 1 commit into
columnar-tech:mainfrom
amoeba:chore/allow-set-version-from-ldflags
Feb 4, 2026
Merged

chore: don't override Version if set via ldflags#286
zeroshade merged 1 commit into
columnar-tech:mainfrom
amoeba:chore/allow-set-version-from-ldflags

Conversation

@amoeba

@amoeba amoeba commented Feb 2, 2026

Copy link
Copy Markdown
Member

This fixes a minor issue that prevents us from overriding Version with ldflags when we build from a source tarball. Right now, this is only useful for someone who might want to create a Homebrew formula for dbc because Homebrew builds from tarballs by default not from git.

This change makes the usual invocation of a build in a Brew formula work as expected,

    ldflags = %W[
      -s -w
      -X github.com/columnar-tech/dbc.Version=v#{version}
    ]
    system "go", "build", *std_go_args(ldflags:), "./cmd/dbc"

Without this, dbc built with Homebrew would report,

$ /opt/homebrew/Cellar/dbc/0.1.0/bin/dbc --version
(devel)

@amoeba
amoeba requested a review from zeroshade February 2, 2026 23:10
@zeroshade
zeroshade merged commit c961fff into columnar-tech:main Feb 4, 2026
17 of 24 checks passed
zeroshade pushed a commit that referenced this pull request Apr 17, 2026
This fixes a minor issue that prevents us from overriding `Version` with
`ldflags` when we build from a source tarball. Right now, this is only
useful for someone who might want to create a Homebrew formula for dbc
because Homebrew builds from tarballs by default not from git.

This change makes the usual invocation of a build in a Brew formula work
as expected,

```ruby
    ldflags = %W[
      -s -w
      -X github.com/columnar-tech/dbc.Version=v#{version}
    ]
    system "go", "build", *std_go_args(ldflags:), "./cmd/dbc"
```

Without this, dbc built with Homebrew would report,

```sh
$ /opt/homebrew/Cellar/dbc/0.1.0/bin/dbc --version
(devel)
```
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