-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathTaskfile.dist.yml
54 lines (45 loc) · 1.26 KB
/
Taskfile.dist.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
version: "3"
vars:
COMMIT:
sh: |-
git rev-parse HEAD
NOW:
sh: |-
date -u +%FT%TZ
LD_FLAGS: >-
-ldflags '-X github.com/sharat87/httpbun/server/spec.Commit={{.COMMIT}} -X github.com/sharat87/httpbun/server/spec.Date={{.NOW}}'
tasks:
run:
deps:
- fmt
cmds:
- go mod tidy
- go run {{.LD_FLAGS}} . --bind localhost:3090
docker:
env:
CGO_ENABLED: 0
GOOS: linux
cmds:
- task: patch
- defer:
task: unpatch
- GOARCH=amd64 go build {{.LD_FLAGS}} -a -installsuffix cgo -o bin/httpbun-docker-amd64 .
- GOARCH=arm64 go build {{.LD_FLAGS}} -a -installsuffix cgo -o bin/httpbun-docker-arm64 .
fmt:
cmds:
- go fmt ./...
- goimports -w -local github.com/sharat87/httpbun .
sources:
- "**/*.go"
test:
cmds:
# The `-count=1` is to disable test caching.
- go test -cover -count=1 -vet=all ./...
patch:
cmds:
- sed 's:\(delete(req.Header, "Host")\)$://\1:' "$(go env GOROOT)/src/net/http/server.go" > x
- mv x "$(go env GOROOT)/src/net/http/server.go"
unpatch:
cmds:
- sed 's://\(delete(req.Header, "Host")\)$:\1:' "$(go env GOROOT)/src/net/http/server.go" > x
- mv x "$(go env GOROOT)/src/net/http/server.go"