From cf828f544db5efaee1c3ed007dfe7b1502aa5ebd Mon Sep 17 00:00:00 2001 From: Alex Luong Date: Sun, 16 Aug 2026 13:49:49 +0700 Subject: [PATCH] build: drop gin's unused msgpack binding Outpost never uses msgpack request binding, but gin links its codec unconditionally. gin guards it behind the nomsgpack build tag, so setting the tag drops github.com/ugorji/go from the binary. Reduces outpost-server from 72.8 MB to 66.5 MB (-8.7%), measured by building both ways with release ldflags. Applied to every build path so release, make and Docker binaries stay consistent. Co-Authored-By: Claude Opus 5 (1M context) --- Makefile | 12 ++++++------ build/.goreleaser.yaml | 8 ++++++++ build/Dockerfile.example | 4 ++-- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index a71f226dd..337767da2 100644 --- a/Makefile +++ b/Makefile @@ -12,23 +12,23 @@ build: exit 1; \ fi @echo "Building all binaries..." - go build -o bin/outpost ./cmd/outpost - go build -o bin/outpost-server ./cmd/outpost-server + go build -tags nomsgpack -o bin/outpost ./cmd/outpost + go build -tags nomsgpack -o bin/outpost-server ./cmd/outpost-server @echo "Binaries built in ./bin/" build/goreleaser: goreleaser release -f ./build/.goreleaser.yaml --snapshot --clean build/outpost: - go build -o bin/outpost ./cmd/outpost + go build -tags nomsgpack -o bin/outpost ./cmd/outpost build/server: - go build -o bin/outpost-server ./cmd/outpost-server + go build -tags nomsgpack -o bin/outpost-server ./cmd/outpost-server install: @echo "Installing binaries to GOPATH/bin..." - go install ./cmd/outpost - go install ./cmd/outpost-server + go install -tags nomsgpack ./cmd/outpost + go install -tags nomsgpack ./cmd/outpost-server @echo "Installation complete" clean: diff --git a/build/.goreleaser.yaml b/build/.goreleaser.yaml index 82ac9cdcf..f3420b98f 100644 --- a/build/.goreleaser.yaml +++ b/build/.goreleaser.yaml @@ -19,6 +19,8 @@ builds: - -s -w - -X github.com/hookdeck/outpost/internal/version.version={{.Version}} - -X github.com/hookdeck/outpost/internal/version.commit={{.FullCommit}} + flags: + - -tags=nomsgpack binary: outpost env: - CGO_ENABLED=0 @@ -32,6 +34,8 @@ builds: - -s -w - -X github.com/hookdeck/outpost/internal/version.version={{.Version}} - -X github.com/hookdeck/outpost/internal/version.commit={{.FullCommit}} + flags: + - -tags=nomsgpack binary: outpost env: - CGO_ENABLED=0 @@ -47,6 +51,8 @@ builds: - -s -w - -X github.com/hookdeck/outpost/internal/version.version={{.Version}} - -X github.com/hookdeck/outpost/internal/version.commit={{.FullCommit}} + flags: + - -tags=nomsgpack binary: outpost-server env: - CGO_ENABLED=0 @@ -60,6 +66,8 @@ builds: - -s -w - -X github.com/hookdeck/outpost/internal/version.version={{.Version}} - -X github.com/hookdeck/outpost/internal/version.commit={{.FullCommit}} + flags: + - -tags=nomsgpack binary: outpost-server env: - CGO_ENABLED=0 diff --git a/build/Dockerfile.example b/build/Dockerfile.example index 8190d73b1..0a357df9a 100644 --- a/build/Dockerfile.example +++ b/build/Dockerfile.example @@ -19,8 +19,8 @@ RUN go mod download COPY . . # Build all binaries -RUN go build -o ./bin/outpost ./cmd/outpost && \ - go build -o ./bin/outpost-server ./cmd/outpost-server +RUN go build -tags nomsgpack -o ./bin/outpost ./cmd/outpost && \ + go build -tags nomsgpack -o ./bin/outpost-server ./cmd/outpost-server # Stage 1 # Get busybox shell for entrypoint script