github.com/vanstinator/golangci-lint@v0.0.0-20240223191551-cc572f00d9d1/Makefile (about) 1 .DEFAULT_GOAL = test 2 .PHONY: FORCE 3 4 # enable consistent Go 1.12/1.13 GOPROXY behavior. 5 export GOPROXY = https://proxy.golang.org 6 7 BINARY = golangci-lint 8 ifeq ($(OS),Windows_NT) 9 BINARY := $(BINARY).exe 10 endif 11 12 # Build 13 14 build: $(BINARY) 15 .PHONY: build 16 17 build_race: 18 go build -race -o $(BINARY) ./cmd/golangci-lint 19 .PHONY: build_race 20 21 clean: 22 rm -f $(BINARY) 23 rm -f test/path 24 rm -f tools/Dracula.itermcolors 25 rm -f tools/goreleaser 26 rm -f tools/svg-term 27 rm -rf tools/node_modules 28 .PHONY: clean 29 30 # Test 31 test: export GOLANGCI_LINT_INSTALLED = true 32 test: build 33 GL_TEST_RUN=1 ./$(BINARY) run -v 34 GL_TEST_RUN=1 go test -v -parallel 2 ./... 35 .PHONY: test 36 37 # ex: T=gofmt.go make test_fix 38 # the value of `T` is the name of a file from `test/testdata/fix` 39 test_fix: build 40 GL_TEST_RUN=1 go test -v ./test -count 1 -run TestFix/$T 41 .PHONY: test_fix 42 43 test_race: build_race 44 GL_TEST_RUN=1 ./$(BINARY) run -v --timeout=5m 45 .PHONY: test_race 46 47 test_linters: 48 GL_TEST_RUN=1 go test -v ./test -count 1 -run TestSourcesFromTestdata/$T 49 .PHONY: test_linters 50 51 test_linters_sub: 52 GL_TEST_RUN=1 go test -v ./test -count 1 -run TestSourcesFromTestdataSubDir/$T 53 .PHONY: test_linters_sub 54 55 # Maintenance 56 57 fast_generate: assets/github-action-config.json 58 .PHONY: fast_generate 59 60 fast_check_generated: 61 $(MAKE) --always-make fast_generate 62 git checkout -- go.mod go.sum # can differ between go1.16 and go1.17 63 git diff --exit-code # check no changes 64 65 release: .goreleaser.yml tools/goreleaser 66 ./tools/goreleaser 67 .PHONY: release 68 69 snapshot: .goreleaser.yml tools/goreleaser 70 ./tools/goreleaser --snapshot --rm-dist 71 .PHONY: snapshot 72 73 # Non-PHONY targets (real files) 74 75 $(BINARY): FORCE 76 go build -o $@ ./cmd/golangci-lint 77 78 tools/goreleaser: export GOFLAGS = -mod=readonly 79 tools/goreleaser: tools/go.mod tools/go.sum 80 cd tools && go build github.com/goreleaser/goreleaser 81 82 # TODO: migrate to docs/ 83 tools/svg-term: tools/package.json tools/package-lock.json 84 cd tools && npm ci 85 ln -sf node_modules/.bin/svg-term $@ 86 87 # TODO: migrate to docs/ 88 tools/Dracula.itermcolors: 89 curl -fL -o $@ https://raw.githubusercontent.com/dracula/iterm/master/Dracula.itermcolors 90 91 # TODO: migrate to docs/ 92 assets/demo.svg: tools/svg-term tools/Dracula.itermcolors 93 ./tools/svg-term --cast=183662 --out assets/demo.svg --window --width 110 --height 30 --from 2000 --to 20000 --profile ./tools/Dracula.itermcolors --term iterm2 94 95 assets/github-action-config.json: FORCE $(BINARY) 96 # go run ./scripts/gen_github_action_config/main.go $@ 97 cd ./scripts/gen_github_action_config/; go run ./main.go ../../$@ 98 99 go.mod: FORCE 100 go mod tidy 101 go mod verify 102 go.sum: go.mod 103 104 expand_website_templates: 105 go run ./scripts/expand_website_templates/main.go 106 .PHONY: expand_website_templates 107 108 update_contributors_list: 109 cd .github/contributors && npm run all 110