File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : build
2+ on : [push, pull_request]
3+ jobs :
4+ build-bscp :
5+ name : build-bscp
6+ runs-on : ubuntu-latest
7+ steps :
8+ # 拉取代码
9+ - name : checkout
10+ uses : actions/checkout@v4
11+
12+ # 设置 Go 环境
13+ - name : setup go
14+ uses : actions/setup-go@v3
15+ with :
16+ go-version-file : go.mod
17+
18+ # 编译项目
19+ - name : build go project
20+ run : |
21+ make build_bscp
22+
23+ build-ui :
24+ name : build-ui
25+ runs-on : ubuntu-latest
26+ steps :
27+ # 拉取代码
28+ - name : checkout
29+ uses : actions/checkout@v4
30+
31+ # 设置 Go 环境
32+ - name : setup go
33+ uses : actions/setup-go@v3
34+ with :
35+ go-version-file : go.mod
36+
37+ # 编译项目
38+ - name : build ui project
39+ run : |
40+ make build_frontend
Original file line number Diff line number Diff line change 11name : lint
22on : [push, pull_request]
33jobs :
4- bcs-bscp :
5- name : bcs-bscp
4+ golang-lint :
5+ name : golang-lint
66 runs-on : ubuntu-latest
77 steps :
88 # 拉取代码
99 - name : checkout
10- uses : actions/checkout@v3
10+ uses : actions/checkout@v4
1111
1212 # 设置 Go 环境
1313 - name : setup go
1414 uses : actions/setup-go@v3
1515 with :
1616 go-version-file : go.mod
17-
17+
1818 # 检查 Go 模块依赖是否整理
1919 - name : go mod tidy check
2020 uses : katexochen/go-tidy-check@v2
2121 with :
2222 modules : .
23-
23+
2424 # 运行代码风格检查 (golangci-lint)
2525 - name : golangci-lint
26- uses : golangci/golangci-lint-action@v3
26+ uses : golangci/golangci-lint-action@v6
2727 with :
2828 version : v1.62.0
29- args : --timeout=30m
29+ args : --timeout=5m
3030 working-directory : .
31-
32- # 编译项目
33- - name : build go project
34- run : |
35- make build_bscp && make build_frontend
Original file line number Diff line number Diff line change 1- name : pr-lint
1+ name : pr-style-check
22on : [pull_request]
33jobs :
44 PR-format-check :
Original file line number Diff line number Diff line change @@ -70,6 +70,8 @@ linters-settings:
7070 - shadow
7171 disable :
7272 - printf
73+ goconst :
74+ min-occurrences : 5
7375 goimports :
7476 local-prefixes : github.com/TencentBlueKing/bk-bscp
7577 gci :
Original file line number Diff line number Diff line change 22ifdef HASTAG
33 GITTAG=${HASTAG}
44else
5- GITTAG=$(shell git describe --always)
5+ GITTAG=$(shell git describe --tags -- always)
66endif
77
88# version
Original file line number Diff line number Diff line change @@ -127,7 +127,7 @@ func (fs *feedServer) prepare(opt *options.Option) error {
127127}
128128
129129// listenAndServe listen the grpc serve and set up the shutdown gracefully job.
130- func (fs * feedServer ) listenAndServe () error {
130+ func (fs * feedServer ) listenAndServe () error { // nolint
131131 // generate standard grpc server grpcMetrics.
132132 grpcMetrics := grpc_prometheus .NewServerMetrics ()
133133 grpcMetrics .EnableHandlingTimeHistogram (metrics .GrpcBuckets )
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import (
2121 "strings"
2222 "time"
2323
24+ "github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/realip"
2425 "google.golang.org/grpc"
2526 "google.golang.org/grpc/codes"
2627 "google.golang.org/grpc/status"
@@ -29,7 +30,6 @@ import (
2930 "github.com/TencentBlueKing/bk-bscp/pkg/kit"
3031 "github.com/TencentBlueKing/bk-bscp/pkg/logs"
3132 "github.com/TencentBlueKing/bk-bscp/pkg/metrics"
32- "github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/realip"
3333)
3434
3535// RecoveryHandlerFuncContext 异常日志输出
You can’t perform that action at this time.
0 commit comments