1
0
Эх сурвалжийг харах

Lint packages behind feature flag : local, e2e

Signed-off-by: Guillaume Tardif <[email protected]>
Guillaume Tardif 4 жил өмнө
parent
commit
3940b98da5
3 өөрчлөгдсөн 5 нэмэгдсэн , 1 устгасан
  1. 2 0
      Dockerfile
  2. 1 0
      Makefile
  3. 2 1
      builder.Makefile

+ 2 - 0
Dockerfile

@@ -43,11 +43,13 @@ FROM golangci/golangci-lint:${GOLANGCI_LINT_VERSION} AS lint-base
 FROM base AS lint
 ENV CGO_ENABLED=0
 COPY --from=lint-base /usr/bin/golangci-lint /usr/bin/golangci-lint
+ARG BUILD_TAGS
 ARG GIT_TAG
 RUN --mount=target=. \
     --mount=type=cache,target=/go/pkg/mod \
     --mount=type=cache,target=/root/.cache/go-build \
     --mount=type=cache,target=/root/.cache/golangci-lint \
+    BUILD_TAGS=${BUILD_TAGS} \
     GIT_TAG=${GIT_TAG} \
     make -f builder.Makefile lint
 

+ 1 - 0
Makefile

@@ -72,6 +72,7 @@ cache-clear: ## Clear the builder cache
 
 lint: ## run linter(s)
 	@docker build . \
+	--build-arg BUILD_TAGS=example,local,e2e \
 	--build-arg GIT_TAG=$(GIT_TAG) \
 	--target lint
 

+ 2 - 1
builder.Makefile

@@ -39,6 +39,7 @@ WORK_DIR:=$(shell mktemp -d)
 TAGS:=
 ifdef BUILD_TAGS
   TAGS=-tags $(BUILD_TAGS)
+  LINT_TAGS=--build-tags $(BUILD_TAGS)
 endif
 
 TAR_TRANSFORM:=--transform s/packaging/docker/ --transform s/bin/docker/ --transform s/docker-linux-amd64/docker/ --transform s/docker-darwin-amd64/docker/
@@ -68,7 +69,7 @@ test:
 
 .PHONY: lint
 lint:
-	golangci-lint run --timeout 10m0s ./...
+	golangci-lint run $(LINT_TAGS) --timeout 10m0s ./...
 
 .PHONY: import-restrictions
 import-restrictions: