From c84b54010ae81e5a762f92002dd26471dae317ac Mon Sep 17 00:00:00 2001
From: Will McCutchen <will@mccutch.org>
Date: Thu, 16 Apr 2020 11:51:39 -0700
Subject: [PATCH] make: add buildtests target to output test binary

---
 Makefile | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 2ab6c8b..f9c9c5a 100644
--- a/Makefile
+++ b/Makefile
@@ -33,10 +33,13 @@ build: $(DIST_PATH)/go-httpbin
 
 $(DIST_PATH)/go-httpbin: assets $(GO_SOURCES)
 	mkdir -p $(DIST_PATH)
-	go build -o $(DIST_PATH)/go-httpbin ./cmd/go-httpbin
+	CGO_ENABLED=0 go build -ldflags="-s -w" -o $(DIST_PATH)/go-httpbin ./cmd/go-httpbin
 
 assets: $(GENERATED_ASSETS_PATH)
 
+buildtests:
+	CGO_ENABLED=0 go test -ldflags="-s -w" -v -c -o $(DIST_PATH)/go-httpbin.test ./httpbin
+
 clean:
 	rm -rf $(DIST_PATH) $(COVERAGE_PATH)
 
@@ -88,7 +91,7 @@ run: build
 # =============================================================================
 # docker images
 # =============================================================================
-image: build
+image:
 	docker build -t mccutchen/go-httpbin:$(VERSION) .
 
 imagepush: image
-- 
GitLab