mirror of
				https://github.com/siderolabs/talos.git
				synced 2025-11-04 02:11:12 +01:00 
			
		
		
		
	chore: integrate importvet
This integrates [importvet](https://github.com/talos-systems/importvet) into `lint` target. First rule file was added for public packages `pkg/` which shouldn't depend on other parts of Talos tree (except for the API definitions). Only one change: `internal/cis` was moved under single user - `pkg/config/internal/cis` to satisfy the rules. Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
This commit is contained in:
		
							parent
							
								
									c07ce17b7a
								
							
						
					
					
						commit
						050d34275a
					
				@ -3,9 +3,12 @@
 | 
				
			|||||||
# Meta args applied to stage base names.
 | 
					# Meta args applied to stage base names.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ARG TOOLS
 | 
					ARG TOOLS
 | 
				
			||||||
 | 
					ARG IMPORTVET
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# The tools target provides base toolchain for the build.
 | 
					# The tools target provides base toolchain for the build.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					FROM $IMPORTVET as importvet
 | 
				
			||||||
 | 
					
 | 
				
			||||||
FROM $TOOLS AS tools
 | 
					FROM $TOOLS AS tools
 | 
				
			||||||
ENV PATH /toolchain/bin:/toolchain/go/bin
 | 
					ENV PATH /toolchain/bin:/toolchain/go/bin
 | 
				
			||||||
RUN ["/toolchain/bin/mkdir", "/bin", "/tmp"]
 | 
					RUN ["/toolchain/bin/mkdir", "/bin", "/tmp"]
 | 
				
			||||||
@ -22,6 +25,7 @@ COPY ./hack/docgen /go/src/github.com/talos-systems/docgen
 | 
				
			|||||||
RUN cd /go/src/github.com/talos-systems/docgen \
 | 
					RUN cd /go/src/github.com/talos-systems/docgen \
 | 
				
			||||||
    && go build . \
 | 
					    && go build . \
 | 
				
			||||||
    && mv docgen /toolchain/go/bin/
 | 
					    && mv docgen /toolchain/go/bin/
 | 
				
			||||||
 | 
					COPY --from=importvet /importvet /toolchain/go/bin/importvet
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# The build target creates a container that will be used to build Talos source
 | 
					# The build target creates a container that will be used to build Talos source
 | 
				
			||||||
# code.
 | 
					# code.
 | 
				
			||||||
@ -468,7 +472,8 @@ COPY --from=integration-test-provision-linux-build /src/integration.test /integr
 | 
				
			|||||||
FROM base AS lint-go
 | 
					FROM base AS lint-go
 | 
				
			||||||
COPY .golangci.yml .
 | 
					COPY .golangci.yml .
 | 
				
			||||||
ENV GOGC=50
 | 
					ENV GOGC=50
 | 
				
			||||||
RUN --mount=type=cache,target=/.cache/go-build golangci-lint run --config .golangci.yml
 | 
					RUN --mount=type=cache,target=/.cache/go-build --mount=type=cache,target=/.cache/golangci-lint golangci-lint run --config .golangci.yml
 | 
				
			||||||
 | 
					RUN --mount=type=cache,target=/.cache/go-build importvet ./...
 | 
				
			||||||
RUN find . -name '*.pb.go' | xargs rm
 | 
					RUN find . -name '*.pb.go' | xargs rm
 | 
				
			||||||
RUN FILES="$(gofumports -l -local github.com/talos-systems/talos .)" && test -z "${FILES}" || (echo -e "Source code is not formatted with 'gofumports -w -local github.com/talos-systems/talos .':\n${FILES}"; exit 1)
 | 
					RUN FILES="$(gofumports -l -local github.com/talos-systems/talos .)" && test -z "${FILES}" || (echo -e "Source code is not formatted with 'gofumports -w -local github.com/talos-systems/talos .':\n${FILES}"; exit 1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										2
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								Makefile
									
									
									
									
									
								
							@ -10,6 +10,7 @@ ARTIFACTS := _out
 | 
				
			|||||||
TOOLS ?= autonomy/tools:v0.2.0-8-g7e14b0a
 | 
					TOOLS ?= autonomy/tools:v0.2.0-8-g7e14b0a
 | 
				
			||||||
GO_VERSION ?= 1.14
 | 
					GO_VERSION ?= 1.14
 | 
				
			||||||
GOFUMPT_VERSION ?= abc0db2c416aca0f60ea33c23c76665f6e7ba0b6
 | 
					GOFUMPT_VERSION ?= abc0db2c416aca0f60ea33c23c76665f6e7ba0b6
 | 
				
			||||||
 | 
					IMPORTVET ?= autonomy/importvet:f6b07d9
 | 
				
			||||||
OPERATING_SYSTEM := $(shell uname -s | tr "[:upper:]" "[:lower:]")
 | 
					OPERATING_SYSTEM := $(shell uname -s | tr "[:upper:]" "[:lower:]")
 | 
				
			||||||
TALOSCTL_DEFAULT_TARGET := talosctl-$(OPERATING_SYSTEM)
 | 
					TALOSCTL_DEFAULT_TARGET := talosctl-$(OPERATING_SYSTEM)
 | 
				
			||||||
INTEGRATION_TEST_DEFAULT_TARGET := integration-test-$(OPERATING_SYSTEM)
 | 
					INTEGRATION_TEST_DEFAULT_TARGET := integration-test-$(OPERATING_SYSTEM)
 | 
				
			||||||
@ -37,6 +38,7 @@ COMMON_ARGS += --build-arg=GOFUMPT_VERSION=$(GOFUMPT_VERSION)
 | 
				
			|||||||
COMMON_ARGS += --build-arg=SHA=$(SHA)
 | 
					COMMON_ARGS += --build-arg=SHA=$(SHA)
 | 
				
			||||||
COMMON_ARGS += --build-arg=TAG=$(TAG)
 | 
					COMMON_ARGS += --build-arg=TAG=$(TAG)
 | 
				
			||||||
COMMON_ARGS += --build-arg=ARTIFACTS=$(ARTIFACTS)
 | 
					COMMON_ARGS += --build-arg=ARTIFACTS=$(ARTIFACTS)
 | 
				
			||||||
 | 
					COMMON_ARGS += --build-arg=IMPORTVET=$(IMPORTVET)
 | 
				
			||||||
COMMON_ARGS += --build-arg=TESTPKGS=$(TESTPKGS)
 | 
					COMMON_ARGS += --build-arg=TESTPKGS=$(TESTPKGS)
 | 
				
			||||||
COMMON_ARGS += --build-arg=USERNAME=$(USERNAME)
 | 
					COMMON_ARGS += --build-arg=USERNAME=$(USERNAME)
 | 
				
			||||||
COMMON_ARGS += --build-arg=http_proxy=$(http_proxy)
 | 
					COMMON_ARGS += --build-arg=http_proxy=$(http_proxy)
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										8
									
								
								pkg/.importvet.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								pkg/.importvet.yaml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,8 @@
 | 
				
			|||||||
 | 
					---
 | 
				
			||||||
 | 
					rules:
 | 
				
			||||||
 | 
					  - regexp: ^github.com/talos-systems/talos/
 | 
				
			||||||
 | 
					    action: deny
 | 
				
			||||||
 | 
					  - regexp: ^github.com/talos-systems/talos/pkg
 | 
				
			||||||
 | 
					    action: allow
 | 
				
			||||||
 | 
					  - regexp: ^github.com/talos-systems/talos/api
 | 
				
			||||||
 | 
					    action: allow
 | 
				
			||||||
@ -15,7 +15,7 @@ import (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	stdlibx509 "crypto/x509"
 | 
						stdlibx509 "crypto/x509"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/talos-systems/talos/internal/pkg/cis"
 | 
						"github.com/talos-systems/talos/pkg/config/internal/cis"
 | 
				
			||||||
	v1alpha1 "github.com/talos-systems/talos/pkg/config/types/v1alpha1"
 | 
						v1alpha1 "github.com/talos-systems/talos/pkg/config/types/v1alpha1"
 | 
				
			||||||
	"github.com/talos-systems/talos/pkg/config/types/v1alpha1/machine"
 | 
						"github.com/talos-systems/talos/pkg/config/types/v1alpha1/machine"
 | 
				
			||||||
	"github.com/talos-systems/talos/pkg/constants"
 | 
						"github.com/talos-systems/talos/pkg/constants"
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user