make: build-go: add trimpath for non-dev, and debug-friendly flags for dev (#120264)

This commit is contained in:
Gábor Farkas 2026-03-13 10:40:45 +01:00 committed by GitHub
parent 264fd28b64
commit 30777ae15a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

@ -1,7 +1,7 @@
[build]
bin = "./bin/grafana-air"
args_bin = ["server", "-profile", "-profile-addr=127.0.0.1", "-profile-port=6000", "-profile-block-rate=1", "-profile-mutex-rate=5", "-packaging=dev", "cfg:app_mode=development"]
cmd = "make CGO_ENABLED=0 GO_BUILD_GCFLAGS='all=-N -l' SOURCE_DATE_EPOCH=1767222000 GO_BUILD_DEV=1 build-air"
cmd = "make CGO_ENABLED=0 SOURCE_DATE_EPOCH=1767222000 GO_BUILD_DEV=1 build-air"
exclude_regex = ["_test.go", "_gen.go"]
exclude_unchanged = true
follow_symlink = true

View file

@ -287,7 +287,7 @@ update-workspace: gen-go
.PHONY: build-go
build-go: gen-themes ## Build all Go binaries (grafana, grafana-server, grafana-cli).
@echo "build go binaries"
$(if $(CGO_ENABLED),CGO_ENABLED=$(CGO_ENABLED)) $(if $(GO_BUILD_OS),GOOS=$(GO_BUILD_OS)) $(if $(GO_BUILD_ARCH),GOARCH=$(GO_BUILD_ARCH)) $(GO) build -buildvcs=false -trimpath $(GO_RACE_FLAG) $(if $(GO_BUILD_TAGS),-tags $(GO_BUILD_TAGS)) $(if $(GO_BUILD_GCFLAGS),-gcflags "$(GO_BUILD_GCFLAGS)") -ldflags "$(GO_LDFLAGS)" -o ./bin/grafana ./pkg/cmd/grafana
$(if $(CGO_ENABLED),CGO_ENABLED=$(CGO_ENABLED)) $(if $(GO_BUILD_OS),GOOS=$(GO_BUILD_OS)) $(if $(GO_BUILD_ARCH),GOARCH=$(GO_BUILD_ARCH)) $(GO) build -buildvcs=false $(if $(GO_BUILD_DEV),-gcflags "all=-N -l",-trimpath) $(GO_RACE_FLAG) $(if $(GO_BUILD_TAGS),-tags $(GO_BUILD_TAGS)) $(if $(GO_BUILD_GCFLAGS),-gcflags "$(GO_BUILD_GCFLAGS)") -ldflags "$(GO_LDFLAGS)" -o ./bin/grafana ./pkg/cmd/grafana
.PHONY: build-backend
build-backend: build-go