-
-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathjustfile
More file actions
90 lines (67 loc) · 2.21 KB
/
Copy pathjustfile
File metadata and controls
90 lines (67 loc) · 2.21 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
set dotenv-load
APP := "f2"
REPO_OWNER := env_var_or_default("REPO_OWNER", "ayoisaiah")
REPO_BINARY_NAME := env_var_or_default("REPO_BINARY_NAME", "f2")
toolprefix := "go tool -modfile=" + justfile_directory() + "/tools.mod"
toolsmod := "-modfile=" + justfile_directory() + "/tools.mod"
# Run all tests
test filter='.*':
@go test ./... -race -coverprofile=coverage.out -coverpkg=. -json -run={{filter}} 2>&1 | {{toolprefix}} gotestfmt -hide 'empty-packages'
[no-cd]
test-pkg filter='.*':
@go test ./... -race -json -coverprofile=coverage.out -coverpkg=. -run={{filter}} 2>&1 | {{toolprefix}} gotestfmt -hide 'empty-packages'
# Release commands
release-snapshot:
@{{toolprefix}} goreleaser release --clean --snapshot
release:
@{{toolprefix}} goreleaser release --clean
docker:
@docker build \
--build-arg GO_VERSION={{env_var("GO_VERSION")}} \
--build-arg REPO_OWNER={{REPO_OWNER}} \
--build-arg REPO_BINARY_NAME={{REPO_BINARY_NAME}} \
--build-arg REPO_DESCRIPTION="{{env_var("REPO_DESCRIPTION")}}" \
-t {{REPO_OWNER}}/{{REPO_BINARY_NAME}}:latest .
[no-cd]
update-golden filter='.*':
@go test ./... -update -json -run={{filter}} | {{toolprefix}} gotestfmt
alias i := install
install:
@go mod download
@go mod download {{toolsmod}}
add pkg:
@go get -u {{pkg}}
add-tool tool:
@go get {{toolsmod}} -tool {{tool}}
show-updates:
@echo "# Main dependencies"
@go list -u -f '{{"{{if (and (not (or .Main .Indirect)) .Update)}}{{.Path}}: {{.Version}} -> {{.Update.Version}}{{end}}"}}' -m all
@echo ""
@echo "# Tool dependencies"
@go list {{toolsmod}} -u -f '{{"{{if (and (not (or .Main .Indirect)) .Update)}}{{.Path}}: {{.Version}} -> {{.Update.Version}}{{end}}"}}' -m all
update-deps:
@go get -u ./...
update-tools:
@go get {{toolsmod}} -u ./...
update: && update-deps update-tools
tools:
@go tool {{toolsmod}}
build:
@go build -o bin/{{APP}} ./cmd...
build-win:
@go build -o bin/{{APP}}.exe ./cmd...
lint:
@{{toolprefix}} golangci-lint run ./...
fmt:
@{{toolprefix}} gofumpt -l -w .
@{{toolprefix}} goimports -w .
@{{toolprefix}} golines -w .
vulncheck:
@go tool -modfile=tools.mod govulncheck ./...
pre-commit:
@pre-commit run
clean:
@rm -r bin
@go clean
scc:
@{{toolprefix}} scc