In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "how to configure Gitlab CI in golang language project". The content of the explanation in this article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to configure Gitlab CI in golang language project.
Golang project configuration Gitlab CIpipeline process
Check the code using golangci-lint
Compiled code
Deploy binary
Before_script sets environment variables
Primary GOPROXY settin
Before_script:-echo "before_script"-git version-go env-w GOPRIVATE=code.haiziwang.com-mkdir-p. Go-go version-go env-w GO111MODULE=on-go env-w GOPROXY= "https://goproxy.io,direct"golangci-lint
Many out-of-the-box linter are integrated by default.
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 indicates that if you fail, you can continue to run the subsequent job.
Compile compile: stage: build extends: .go-cache script:-go mod download-go build-race-o $OUTPUT_NAME artifacts: paths:-$OUTPUT_NAME cache go mod.go-cache: variables: GOPATH: $CI_PROJECT_DIR/.go cache: paths:-.go / pkg/mod/full example# This file is a template And might need editing before it works on your project.image: hub-mirror.c.163.com/library/golang:latest.go-cache: variables: GOPATH: $CI_PROJECT_DIR/.go cache: paths:-.go / pkg/mod/variables: OUTPUT_NAME: helloworld-appstages:-lint-build-deploybefore_script:-echo "before_script"-git version-go env-w GOPRIVATE=code.haiziwang. Com-mkdir-p. Go-go version-go env-w GO111MODULE=on-go env-w GOPROXY= "https://goproxy.io, Direct "golangci-lint: image: golangci/golangci-lint:v1.27.0 stage: lint extends: .go-cache allow_failure: true script:-golangci-lint run-vcompile: stage: build extends: .go-cache script:-go mod download-go build-race-o $OUTPUT_NAME artifacts: paths:-$OUTPUT_NAMEdeploy-dev: stage: deploy script:- Echo "deploy dev environment" Thank you for your reading The above is the content of "how to configure Gitlab CI in golang language project". After the study of this article, I believe you have a deeper understanding of how to configure Gitlab CI in golang language project, and the specific usage needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.