-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJustfile
56 lines (43 loc) · 2.09 KB
/
Justfile
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
tool-golangci:
@hash golangci-lint > /dev/null 2>&1; if [ $? -ne 0 ]; then \
GOBIN="$(pwd)/tools/bin" go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest; \
fi
tool-gofumpt:
@hash gofumpt > /dev/null 2>&1; if [ $? -ne 0 ]; then \
GOBIN="$(pwd)/tools/bin" go install mvdan.cc/gofumpt@latest; \
fi
tool-gci:
@hash gci > /dev/null 2>&1; if [ $? -ne 0 ]; then \
GOBIN="$(pwd)/tools/bin" go install github.com/daixiang0/gci@latest; \
fi
tool-docbuild:
@hash docbuild > /dev/null 2>&1; if [ $? -ne 0 ]; then \
GOBIN="$(pwd)/tools/bin" go install github.com/DataDog/go-secure-sdk/internal/tools/docbuild; \
fi
tool-licenses:
@hash go-licenses > /dev/null 2>&1; if [ $? -ne 0 ]; then \
GOBIN="$(pwd)/tools/bin" go install github.com/google/[email protected]; \
fi
tool-cyclonedx-gomod:
@hash cyclonedx-gomod > /dev/null 2>&1; if [ $? -ne 0 ]; then \
GOBIN="$(pwd)/tools/bin" go install github.com/CycloneDX/cyclonedx-gomod/cmd/[email protected]; \
fi
lint: tool-golangci tool-gofumpt tool-gci
[ $($(pwd)/tools/bin/gofumpt -extra -l . | wc -l) != 0 ] && { echo 'code not formated'; exit 1; }; \
[ $($(pwd)/tools/bin/gci diff -s standard -s "prefix(golang.org/x/)" -s default -s "prefix(github.com/DataDog)" . | wc -l) != 0 ] && { echo 'imports not sorted'; exit 1; }; \
$(pwd)/tools/bin/golangci-lint run --timeout 5m
fmt: tool-gofumpt tool-gci
$(pwd)/tools/bin/gofumpt -w --extra . && \
$(pwd)/tools/bin/gci write -s standard -s "prefix(golang.org/x/)" -s default -s "prefix(github.com/DataDog)" .
dist:
mkdir dist
test:
gotestsum ./... -- -cover -race
check-licenses: tool-licenses
$(pwd)/tools/bin/go-licenses check --disallowed_types=forbidden,restricted,reciprocal,permissive,unknown .
update-3rdparty-licenses: tool-licenses
$(pwd)/tools/bin/go-licenses report --include_tests ./... > LICENSE-3rdparty.csv
bom: dist tool-cyclonedx-gomod
$(pwd)/tools/bin/cyclonedx-gomod mod -licenses -type library -std -json -output dist/bom.json .
update-readme: tool-docbuild
$(pwd)/tools/bin/docbuild