Support debug builds with TELEPORT_DEBUG (#18317)

For debug builds, we don't want to strip the symbol table of
DWARF debug information. Additionally, disable inlining and
other optimizations that may interfere with debugging.

See https://go.googlesource.com/vscode-go/+/HEAD/docs/debugging.md
This commit is contained in:
Zac Bergquist 2022-11-16 11:33:50 -07:00 committed by GitHub
parent 4cdee9ae68
commit 4046b65632
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -28,9 +28,16 @@ ADDFLAGS ?=
PWD ?= `pwd`
TELEPORT_DEBUG ?= false
GITTAG=v$(VERSION)
BUILDFLAGS ?= $(ADDFLAGS) -ldflags '-w -s' -trimpath
CGOFLAG ?= CGO_ENABLED=1
# When TELEPORT_DEBUG is true, set flags to produce
# debugger-friendly builds.
ifeq ("$(TELEPORT_DEBUG)","true")
BUILDFLAGS ?= $(ADDFLAGS) -gcflags=all="-N -l"
else
BUILDFLAGS ?= $(ADDFLAGS) -ldflags '-w -s' -trimpath
endif
OS ?= $(shell go env GOOS)
ARCH ?= $(shell go env GOARCH)
FIPS ?=