Skip to content

Commit

Permalink
Keep symbols by default (#20519)
Browse files Browse the repository at this point in the history
By reversing the logic and adding a `REMOVE_SYMBOLS` environment
variable that, when set, will remove symbols.

This has been requested to re-enable Dynatrace support, which
requires symbols are intact.

Sadly this increases the size (on my mac) from 192,609,682 bytes
to 236,696,722 bytes (+23% increase).

I confirmed that this adds symbols back, and that `dlv` will load
the Vault binary.
  • Loading branch information
Christopher Swenson authored May 4, 2023
1 parent 2d7efae commit fd26fd5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 3 additions & 0 deletions changelog/20519.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:improvement
Add debug symbols back to builds to fix Dynatrace support
```
7 changes: 3 additions & 4 deletions scripts/ci-helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -154,17 +154,16 @@ function build() {
prerelease=$(version_pre)
build_date=$(build_date)
: "${GO_TAGS:=""}"
: "${KEEP_SYMBOLS:=""}"
: "${REMOVE_SYMBOLS:=""}"

# Build our ldflags
msg="--> Building Vault v$version, revision $revision, built $build_date"

# Keep the symbol and dwarf information by default
# TODO: maybe add REMOVE_SYMBOLS?
if [ -n "$KEEP_SYMBOLS" ]; then
if [ -n "$REMOVE_SYMBOLS" ]; then
ldflags="-s -w "
else
ldflags="-s -w "
ldflags=""
fi

ldflags="${ldflags}-X github.com/hashicorp/vault/version.Version=$version -X github.com/hashicorp/vault/version.GitCommit=$revision -X github.com/hashicorp/vault/version.BuildDate=$build_date"
Expand Down

0 comments on commit fd26fd5

Please sign in to comment.