File tree Expand file tree Collapse file tree 4 files changed +10
-6
lines changed Expand file tree Collapse file tree 4 files changed +10
-6
lines changed Original file line number Diff line number Diff line change 3535 - name : Go Generate
3636 run : |
3737 go generate ./...
38- cat tracing/commit.txt
3938
4039 - name : Validate Docs Data
4140 run : |
Original file line number Diff line number Diff line change 77Gopkg.lock
88build /compiled
99.idea
10- commit.txt
1110.envrc
1211.golangci.yml
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ COPY . .
2323RUN --mount=type=cache,target=/go/pkg \
2424 --mount=type=cache,target=/root/.cache/go-build \
2525 go generate ./... \
26- && GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-s -w" -trimpath -o source main.go
26+ && GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-s -w -X github.com/overmindtech/aws-source/tracing.ServiceVersion=$(git describe --tags --exact-match 2>/dev/null || git rev-parse --short HEAD) " -trimpath -o source main.go
2727
2828FROM alpine:3.21
2929WORKDIR /
Original file line number Diff line number Diff line change @@ -22,9 +22,15 @@ import (
2222 semconv "go.opentelemetry.io/otel/semconv/v1.26.0"
2323)
2424
25- //go:generate sh -c "echo -n $(git describe --tags --exact-match 2>/dev/null || git rev-parse --short HEAD) > commit.txt"
26- //go:embed commit.txt
27- var ServiceVersion string
25+ // ServiceVersion is the version of the service. This will be overridden by the
26+ // build system, using:
27+ // go build -ldflags "-X github.com/overmindtech/api-server/tracing.ServiceVersion=$(git describe --tags --exact-match 2>/dev/null || git rev-parse --short HEAD)" -o your-app
28+ //
29+ // This allows our change detection workflow to work correctly. If we were
30+ // embedding the version here each time we would always produce a slightly
31+ // different compiled binary, and therefore it would look like there was a
32+ // change each time
33+ var ServiceVersion = "dev"
2834
2935func tracingResource () * resource.Resource {
3036 // Identify your application using resource detection
You can’t perform that action at this time.
0 commit comments