1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2024-12-21 23:33:03 +00:00

build: Preserve debug symbols in debug and profile build

Signed-off-by: Ben Wiederhake <BenWiederhake.GitHub@gmx.de>
This commit is contained in:
Ben Wiederhake 2019-06-03 02:37:36 +02:00 committed by Alexander Neumann
parent 2b5a6d255a
commit fab626a3df

View file

@ -395,8 +395,12 @@ func main() {
verbosePrintf("detected Go version %v\n", goVersion)
preserveSymbols := false
for i := range buildTags {
buildTags[i] = strings.TrimSpace(buildTags[i])
if buildTags[i] == "debug" || buildTags[i] == "profile" {
preserveSymbols = true
}
}
verbosePrintf("build tags: %s\n", buildTags)
@ -423,7 +427,11 @@ func main() {
if version != "" {
constants["main.version"] = version
}
ldflags := "-s -w " + constants.LDFlags()
ldflags := constants.LDFlags()
if !preserveSymbols {
// Strip debug symbols.
ldflags = "-s -w " + ldflags
}
verbosePrintf("ldflags: %s\n", ldflags)
var (