Skip to content

Commit 275e868

Browse files
authored
Finish up the container-based linting. (#17404)
- `make lint` now runs through the build tools container - Clean up several scripts - Add lint check to ensure all generated code is up to date. - Make the generated pilot type file generated through the normal go:generate model, and rename the output file to have .gen in the name. - Updated common files.
1 parent fd29fd3 commit 275e868

File tree

10 files changed

+15
-268
lines changed

10 files changed

+15
-268
lines changed

Makefile.core.mk

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -368,19 +368,13 @@ $(foreach bin,$(BINARIES),$(ISTIO_OUT_LINUX)/$(shell basename $(bin))): build-li
368368
# As an optimization, these still build everything
369369
$(foreach bin,$(BINARIES),$(shell basename $(bin))): build
370370

371-
# Existence of build cache .a files actually affects the results of
372-
# some linters; they need to exist.
373-
lint: buildcache
374-
SKIP_INIT=1 bin/linters.sh
375-
376371
MARKDOWN_LINT_WHITELIST=localhost:8080,storage.googleapis.com/istio-artifacts/pilot/,http://ratings.default.svc.cluster.local:9080/ratings
377372

378-
lint_modern: lint-python lint-copyright-banner lint-scripts lint-dockerfiles lint-markdown lint-yaml
373+
lint: lint-python lint-copyright-banner lint-scripts lint-dockerfiles lint-markdown lint-yaml gen check-clean
379374
@bin/check_helm.sh
380375
@bin/check_samples.sh
381376
@bin/check_dashboards.sh
382377
@go run mixer/tools/adapterlinter/main.go ./mixer/adapter/...
383-
@bin/check_pilot_codegen.sh
384378
@golangci-lint run -c ./common/config/.golangci.yml ./galley/...
385379
@golangci-lint run -c ./common/config/.golangci.yml ./istioctl/...
386380
@golangci-lint run -c ./common/config/.golangci.yml ./mixer/...
@@ -399,6 +393,15 @@ gen:
399393
@go build -o /tmp/bin/mixgen "${REPO_ROOT}/mixer/tools/mixgen/main.go"
400394
@PATH=${PATH}:/tmp/bin go generate ./...
401395

396+
CHANGES=$(shell git status --porcelain)
397+
398+
check-clean:
399+
ifneq ($(CHANGES),)
400+
@git diff
401+
@echo "Please run 'make gen' and include any changed files in your PR"
402+
@exit 1
403+
endif
404+
402405
#-----------------------------------------------------------------------------
403406
# Target: go build
404407
#-----------------------------------------------------------------------------

bin/check_pilot_codegen.sh

Lines changed: 0 additions & 35 deletions
This file was deleted.

bin/linters.sh

Lines changed: 0 additions & 108 deletions
This file was deleted.

bin/yaml_lint.sh

Lines changed: 0 additions & 26 deletions
This file was deleted.

mixer/pkg/adapter/test/fixtures.gen.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pilot/pkg/config/kube/crd/config.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
// nolint: lll
16+
//go:generate go run $REPO_ROOT/pilot/tools/generate_config_crd_types.go --template $REPO_ROOT/pilot/tools/types.go.tmpl --output $REPO_ROOT/pilot/pkg/config/kube/crd/types.gen.go
17+
1518
package crd
1619

1720
import (

pilot/tools/generate_config_crd_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
// Tool to generate pilot/pkg/config/kube/types.go
1616
// Example run command:
17-
// go run pilot/tools/generate_config_crd_types.go --template pilot/tools/types.go.tmpl --output pilot/pkg/config/kube/crd/types.go
17+
// go run pilot/tools/generate_config_crd_types.go --template pilot/tools/types.go.tmpl --output pilot/pkg/config/kube/crd/types.gen.go
1818
package main
1919

2020
import (

scripts/check_dockerfiles.sh

Lines changed: 0 additions & 50 deletions
This file was deleted.

scripts/run_golangci.sh

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)