33# Must be set
44$(call _assert_var,MAKEGO)
55$(call _conditional_include,$(MAKEGO)/base.mk)
6+ $(call _conditional_include,$(MAKEGO)/dep_bandeps.mk)
7+ $(call _conditional_include,$(MAKEGO)/dep_bufstyle.mk)
8+ $(call _conditional_include,$(MAKEGO)/dep_bufprivateusage.mk)
9+ $(call _conditional_include,$(MAKEGO)/dep_godoclint.mk)
610$(call _conditional_include,$(MAKEGO)/dep_golangci_lint.mk)
11+ $(call _conditional_include,$(MAKEGO)/dep_govulncheck.mk)
712$(call _conditional_include,$(MAKEGO)/dep_yq.mk)
813# Must be set
914$(call _assert_var,GO_MODULE)
@@ -26,9 +31,19 @@ GO_MOD_TOOLCHAIN ?=
2631# Settable
2732GO_ALL_REPO_PKGS ?= ./cmd/... ./internal/...
2833# Settable
34+ SKIP_BUFSTYLE ?=
35+ # Settable
36+ SKIP_GODOCLINT ?=
37+ # Settable
2938SKIP_GOLANGCI_LINT ?=
3039# Settable
40+ SKIP_GOVULNCHECK ?=
41+ # Settable
3142DISALLOW_NOLINT ?=
43+ # Settable
44+ BUFPRIVATEUSAGE_PKGS ?=
45+ # Settable
46+ BANDEPS_CONFIG ?=
3247
3348# Runtime
3449GOPKGS ?= $(GO_ALL_REPO_PKGS )
@@ -103,6 +118,14 @@ endif
103118
104119format :: gofmtmodtidy
105120
121+ ifneq ($(BUFPRIVATEUSAGE_PKGS ) ,)
122+ .PHONY : bufprivateusage
123+ bufprivateusage : $(BUFPRIVATEUSAGE )
124+ bufprivateusage $(BUFPRIVATEUSAGE_PKGS )
125+
126+ postprepostgenerate :: bufprivateusage
127+ endif
128+
106129.PHONY : checknolintlint
107130checknolintlint : $(YQ )
108131ifneq ($(DISALLOW_NOLINT ) ,)
@@ -114,6 +137,24 @@ else
114137 bash $(MAKEGO)/scripts/checknolintlint.bash
115138endif
116139
140+ .PHONY : bufstyle
141+ bufstyle : $(BUFSTYLE )
142+ ifneq ($(SKIP_BUFSTYLE ) ,)
143+ @echo Skipping bufstyle...
144+ else
145+ @echo bufstyle GOPKGS
146+ @bufstyle $(GOPKGS)
147+ endif
148+
149+ .PHONY : godoclint
150+ godoclint : $(GODOCLINT )
151+ ifneq ($(SKIP_GODOCLINT ) ,)
152+ @echo Skipping godoclint...
153+ else
154+ @echo godoclint GOPKGS
155+ @godoclint $(GOPKGS)
156+ endif
157+
117158.PHONY : golangcilint
118159golangcilint : $(GOLANGCI_LINT )
119160ifneq ($(SKIP_GOLANGCI_LINT ) ,)
@@ -123,16 +164,29 @@ else
123164 golangci-lint run --timeout $(GOLANGCILINTTIMEOUT)
124165endif
125166
167+ .PHONY : govulncheck
168+ govulncheck : $(GOVULNCHECK )
169+ @echo govulncheck GOPKGS
170+ @govulncheck $(GOPKGS )
171+
126172.PHONY : postlint
127173postlint ::
128174
129175.PHONY : postlonglint
130176postlonglint ::
131177
178+ ifneq ($(BANDEPS_CONFIG ) ,)
179+ .PHONY : bandeps
180+ bandeps : $(BANDEPS )
181+ bandeps -f $(BANDEPS_CONFIG )
182+
183+ postlonglint :: bandeps
184+ endif
185+
132186.PHONY : shortlint
133187shortlint : # # Run all linters but exclude long-running linters.
134188 @$(MAKE ) checknodiffgenerated
135- @$(MAKE ) checknolintlint golangcilint postlint
189+ @$(MAKE ) checknolintlint bufstyle godoclint golangcilint govulncheck postlint
136190
137191.PHONY : lint
138192lint : # # Run all linters.
0 commit comments