shell := /bin/bash -euo pipefail VERSION := $(shell git describe --tags --abbrev=4 2>/dev/null || echo dev) BUILD_TIME := $(shell date -u +%Y-%m-%dT%H:%M:%SZ) LDFLAGS := -ldflags "-s -w -X main.version=$(VERSION) -X main.buildTime=$(BUILD_TIME)" .PHONY: build run clean build: @mkdir -p bin go build $(LDFLAGS) -trimpath -o bin/proxycon . run: build ./bin/proxycon --verbose version: go run -- *.go --version test: # naive local requests for naive outputs @echo "> /list" @curl -sS --http2 http://127.1:8080/list | jq . @echo "\n> /price" @curl -sS --http2 http://127.1:8080/price?at=2021-11-19T12:22:51Z | jq . # 6471285 @curl -sS --http2 http://127.1:8080/price?at=2021-11-19T12:23:51Z | jq . # undefined 404 @echo "\n> /average" @curl -sS --http2 'http://127.1:8080/average?start=2021-11-19T00:00:00Z&end=2021-11-20T00:00:00Z' | jq '{start, end, avg}' clean: rm -f bin/proxycon