Skip to content

Commit

Permalink
Run go-makefile-maker
Browse files Browse the repository at this point in the history
  • Loading branch information
sapcc-bot committed Jan 8, 2024
1 parent 38bc3c8 commit c963b48
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,13 @@ comma := ,
check: FORCE static-check build/cover.html build-all
@printf "\e[1;32m>> All checks successful.\e[0m\n"

run-golangci-lint: FORCE
@printf "\e[1;36m>> golangci-lint\e[0m\n"
prepare-static-check: FORCE
@if ! hash golangci-lint 2>/dev/null; then printf "\e[1;36m>> Installing golangci-lint (this may take a while)...\e[0m\n"; go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest; fi
@if ! hash go-licence-detector 2>/dev/null; then printf "\e[1;36m>> Installing go-licence-detector...\e[0m\n"; go install go.elastic.co/go-licence-detector@latest; fi
@if ! hash addlicense 2>/dev/null; then printf "\e[1;36m>> Installing addlicense...\e[0m\n"; go install github.com/google/addlicense@latest; fi

run-golangci-lint: FORCE prepare-static-check
@printf "\e[1;36m>> golangci-lint\e[0m\n"
@golangci-lint run

build/cover.out: FORCE | build
Expand All @@ -65,7 +69,7 @@ build/cover.html: build/cover.out
@printf "\e[1;36m>> go tool cover > build/cover.html\e[0m\n"
@go tool cover -html $< -o $@

static-check: FORCE run-golangci-lint check-license-headers
static-check: FORCE run-golangci-lint check-dependency-licenses check-license-headers

build:
@mkdir $@
Expand All @@ -80,19 +84,15 @@ vendor-compat: FORCE
go mod vendor
go mod verify

prepare-addlicense: FORCE
@if ! hash addlicense 2>/dev/null; then printf "\e[1;36m>> Installing addlicense...\e[0m\n"; go install github.com/google/addlicense@latest; fi

license-headers: FORCE prepare-addlicense
license-headers: FORCE prepare-static-check
@printf "\e[1;36m>> addlicense\e[0m\n"
@addlicense -c "SAP SE" -ignore "vendor/**" -- **/*.go

check-license-headers: FORCE prepare-addlicense
check-license-headers: FORCE prepare-static-check
@printf "\e[1;36m>> addlicense\e[0m\n"
@bash -c 'shopt -s globstar; addlicense --check -ignore "vendor/**" -- **/*.go'

check-dependency-licenses: FORCE
@if ! hash go-licence-detector 2>/dev/null; then printf "\e[1;36m>> Installing go-licence-detector...\e[0m\n"; go install go.elastic.co/go-licence-detector@latest; fi
check-dependency-licenses: FORCE prepare-static-check
@printf "\e[1;36m>> go-licence-detector\e[0m\n"
@go list -m -mod=readonly -json all | go-licence-detector -includeIndirect -rules .license-scan-rules.json -overrides .license-scan-overrides.jsonl

Expand Down Expand Up @@ -126,6 +126,7 @@ help: FORCE
@printf "\n"
@printf "\e[1mTest\e[0m\n"
@printf " \e[36mcheck\e[0m Run the test suite (unit tests and golangci-lint).\n"
@printf " \e[36mprepare-static-check\e[0m Install any tools required by static-check. This is used in CI before dropping privileges, you should probably install all the tools using your package manager\n"
@printf " \e[36mrun-golangci-lint\e[0m Install and run golangci-lint. Installing is used in CI, but you should probably install golangci-lint using your package manager.\n"
@printf " \e[36mbuild/cover.out\e[0m Run tests and generate coverage report.\n"
@printf " \e[36mbuild/cover.html\e[0m Generate an HTML file with source code annotations from the coverage report.\n"
Expand All @@ -134,7 +135,6 @@ help: FORCE
@printf "\e[1mDevelopment\e[0m\n"
@printf " \e[36mvendor\e[0m Run go mod tidy, go mod verify, and go mod vendor.\n"
@printf " \e[36mvendor-compat\e[0m Same as 'make vendor' but go mod tidy will use '-compat' flag with the Go version from go.mod file as value.\n"
@printf " \e[36mprepare-addlicense\e[0m Install addlicense\n"
@printf " \e[36mlicense-headers\e[0m Add license headers to all .go files excluding the vendor directory.\n"
@printf " \e[36mcheck-license-headers\e[0m Check license headers in all .go files excluding the vendor directory.\n"
@printf " \e[36mcheck-dependency-licenses\e[0m Check all dependency licenses using go-licence-detector.\n"
Expand Down

0 comments on commit c963b48

Please sign in to comment.