cache/golangci-lint 自定义一些变量,在流水线执行过程中以环境变量的形式存在。 GOPATH:指定GOPATH为项目目录下的.go,原因是流水线缓存只能缓存项目目录下的文件。 GOMODCACHE:Go依赖缓存。 GOCACHE:go build 产生的缓存。 GOLANGCI_LINT_CACHE:golangci-lint 代码质量检查工具,也会产生缓存。 公共模板 job...
lint: clean golangci-lint run --timeout 10m ./... 执行make lint,可以看到运行成功 Gitlab CI配置 Gilab CI运行需要runner运行环境+流水线配置。其中runner公司内支持共享的runner,流水线配置则根据项目需要来定,在代码根目录下增加.gitlab-ci.yaml文件,并且该项目需要上传vendor目录到库里 ...
- go env -w GOPROXY="https://goproxy.io,direct" golangci-lint 默认集成了很多开箱即用的linter https://golangci-lint.run/ golangci-lint: image: golangci/golangci-lint:v1.27.0 stage: lint extends: .go-cache allow_failure: true script: - golangci-lint run -v allow_failure 表示失...
尤其是在gitlab ci的时候, 可能ci过程中需要执行代码质量检查等, 需要用到golint等工具, 如果只使用基础镜像, 则每次ci任务都需要在去下载, 这样费时费力, 不如将这些工具打包在builder镜像中, 然后在yaml文件的image中指定该builder镜像即可。 reference
1# Base image:https://hub.docker.com/_/golang/2FROM golang:1.9.23USER root4# Install golint 5ENVGOPATH/go 6ENVPATH${GOPATH}/bin:$PATH7RUN mkdir-p/go/src/golang.org/x 8RUN mkdir-p/go/src/github.com/golang 9COPY source/golang.org/go/src/golang.org/x/10COPY source/github....
GitLab Code Quality 支持集成已经运行的工具,还提供运行CodeClimate扫描系统的CI/CD 模板。16.1版本中发布了基于CodeClimate的分析器的以下更新:将CodeClimate更新至版本0.96.0。该版本包括:一个新的插件golangci-lint。该插件的新可用版本bundler-audit。添加了对Docker API套接字的可配置路径的支持。备份增加了...
其中golint是用于golang代码风格检查的工具。 docker是由于需要在容器里面使用宿主的docker命令,这里就需要安装一个docker的可执行文件,然后在启动容器的时候,将宿主的 /var/run/docker.sock 文件挂载到容器内的同样位置。 expect是用于ssh自动登录远程服务器的工具,这里安装改工具是为了可以实现远程服务器端部署应用 ...
否则lint阶段可能因go mod兼容问题导致下载依赖失败 - export GO111MODULE=on && go mod tidy -v && go mod download # 定义流水线阶段 stages: - qa - build # 执行代码静态检查 lint: stage: qa script: - golangci-lint run # 执行UT ut: stage: qa script: - go test -race -coverprofile ...
When we use the registry.gitlab.com/gitlab-org/gitlab-build-images:golangci-lint-alpine for the linter task, we got some error related to using go 1.18 but when we use the latest version of golangci-lint (v1.46.2) the error is gone. also, some depreciation warning related to go...
client/httpclient_test.go:114:22: response body must be closed (bodyclose) client/httpclient_test.go:118:21: response body must be closed...