this repo has no description
1shell := /bin/bash -euo pipefail
2
3VERSION := $(shell git describe --tags --abbrev=4 2>/dev/null || echo dev)
4BUILD_TIME := $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
5LDFLAGS := -ldflags "-s -w -X main.version=$(VERSION) -X main.buildTime=$(BUILD_TIME)"
6
7.PHONY: build run clean
8
9build:
10 @mkdir -p bin
11 go build $(LDFLAGS) -trimpath -o bin/proxycon .
12
13run: build
14 ./bin/proxycon --verbose
15
16version:
17 go run -- *.go --version
18
19test: # naive local requests for naive outputs
20 @echo "> /list"
21 @curl -sS --http2 http://127.1:8080/list | jq .
22 @echo "\n> /price"
23 @curl -sS --http2 http://127.1:8080/price?at=2021-11-19T12:22:51Z | jq . # 6471285
24 @curl -sS --http2 http://127.1:8080/price?at=2021-11-19T12:23:51Z | jq . # undefined 404
25 @echo "\n> /average"
26 @curl -sS --http2 'http://127.1:8080/average?start=2021-11-19T00:00:00Z&end=2021-11-20T00:00:00Z' | jq '{start, end, avg}'
27
28clean:
29 rm -f bin/proxycon