Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/skipper: fix version and commit for go install #2954

Merged
merged 1 commit into from
Feb 23, 2024

Commits on Feb 23, 2024

  1. cmd/skipper: fix version and commit for go install

    When skipper is installed via `go install` it has empty version and
    commit values:
    ```
    ~$ go install github.com/zalando/skipper/cmd/skipper@latest
    go: downloading github.com/zalando/skipper v0.21.2
    ~$ skipper -version
    Skipper version  (commit: , runtime: go1.22.0)
    ```
    
    Current build process of binaries specifies version and commit via `-ldflags`.
    
    This change uses debug buildinfo to get version and commit if they are
    not specified by `-ldflags` which is compatible with the current build process
    but should also work for `go install` case.
    
    If this change fixes `go install` case (which can only be tested after
    package version is published) then we can add the same snippet
    to other binaries and get rid of COMMIT_HASH ldflag.
    
    We can not get rid of `-ldflags` fully though because `go build` does
    not stamp version (see golang/go#50603).
    
    Signed-off-by: Alexander Yastrebov <alexander.yastrebov@zalando.de>
    AlexanderYastrebov committed Feb 23, 2024
    Configuration menu
    Copy the full SHA
    d2b9927 View commit details
    Browse the repository at this point in the history