Skip to content

go build ldflags not working as expected #5710

Discussion options

You must be logged in to vote

@phanirithvij Try:

build = build.WithExec([]string{
    "go", "build",
    "-buildmode=pie", "-trimpath", "-ldflags=-s -extldflags='-static'",
    "-o", path,
})

Output:

█ [13.6s] exec go build -buildmode=pie -trimpath -ldflags=-s -extldflags='-static' -o build/linux/amd64/
┃ go: downloading dagger.io/dagger v0.8.4                                                                                                                                                                  
┃ go: downloading github.com/vektah/gqlparser/v2 v2.5.6                                                                                                                                                    
┃ go: download…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by marcosnils
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants