From 04c091c0b7a5ffa2684c251463fba03345a2df12 Mon Sep 17 00:00:00 2001 From: ifooth Date: Mon, 18 Sep 2023 10:34:20 +0800 Subject: [PATCH 01/10] Update: add bcs-webconsole-lint.yml --- .github/workflows/bcs-webconsole-lint.yml | 21 ++++++ .golangci.yaml | 35 --------- .golangci.yml | 79 ++++++++++++++++++++ bcs-services/bcs-webconsole/.golangci.yml | 89 +++++++++++++++++++++++ 4 files changed, 189 insertions(+), 35 deletions(-) create mode 100644 .github/workflows/bcs-webconsole-lint.yml delete mode 100644 .golangci.yaml create mode 100644 .golangci.yml create mode 100644 bcs-services/bcs-webconsole/.golangci.yml diff --git a/.github/workflows/bcs-webconsole-lint.yml b/.github/workflows/bcs-webconsole-lint.yml new file mode 100644 index 0000000000..b4ae12825a --- /dev/null +++ b/.github/workflows/bcs-webconsole-lint.yml @@ -0,0 +1,21 @@ +name: lint +on: [push, pull_request] +jobs: + lint: + name: lint + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v3 + - name: setup go + uses: actions/setup-go@v3 + with: + go-version-file: go.mod + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + version: v1.54.2 + args: --timeout=30m --issues-exit-code=0 + working-directory: ./bcs-services/bcs-webconsole + - name: go mod tidy check + uses: katexochen/go-tidy-check@v2 diff --git a/.golangci.yaml b/.golangci.yaml deleted file mode 100644 index 30b5344091..0000000000 --- a/.golangci.yaml +++ /dev/null @@ -1,35 +0,0 @@ -run: - timeout: 1m - -issues: - exclude-use-default: false - # Excluding configuration per-path, per-linter, per-text and per-source - exclude-rules: - # 仅保留 should have comment or be unexported - - linters: - - revive - text: "should be of the form|consider calling this" - -linters: - disable-all: true - enable: - # enable by default - - errcheck - - gosimple - - govet - - ineffassign - - staticcheck - - typecheck - - unused - # custom - - revive - -linters-settings: - revive: - rules: - - name: exported - severity: warning - disabled: false - arguments: - - checkPrivateReceivers - - sayRepetitiveInsteadOfStutters diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000000..cc7c19caea --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,79 @@ +run: + timeout: 5m + +issues: + # 显示所有 issue + max-issues-per-linter: 0 + max-same-issues: 0 + exclude-use-default: false + +linters: + disable-all: true + enable: + # enable by default + - errcheck + - gosimple + - govet + - ineffassign + - staticcheck + - unused + + # custom + - goconst + - gocyclo + - gofmt + - goheader + - goimports + - gosec + - misspell + - nakedret + - revive + - unconvert + - unparam + +linters-settings: + # 只开启特定的规则 + errcheck: + exclude-functions: + - (*os.File).Close + - (io.Closer).Close + - os.RemoveAll + govet: + check-shadowing: true + gocyclo: + min-complexity: 30 + gosec: + includes: + - G201 # SQL query construction using format string + - G202 # SQL query construction using string concatenation + - G101 # Look for hard coded credentials + - G401 # Detect the usage of DES, RC4, MD5 or SHA1 + - G402 # Look for bad TLS connection settings + - G403 # Ensure minimum RSA key length of 2048 bits + - G404 # Insecure random number source (rand) + - G504 # Import blocklist: net/http/cgi + goheader: + template: |- + * Tencent is pleased to support the open source community by making Blueking Container Service available. + * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. + * Licensed under the MIT License (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * http://opensource.org/licenses/MIT + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language governing permissions and + * limitations under the License. + * + misspell: + locale: US + revive: + rules: + - name: exported + severity: warning + disabled: false + arguments: + - checkPrivateReceivers + - sayRepetitiveInsteadOfStutters + - name: package-comments + severity: warning + disabled: false diff --git a/bcs-services/bcs-webconsole/.golangci.yml b/bcs-services/bcs-webconsole/.golangci.yml new file mode 100644 index 0000000000..fb35b121ea --- /dev/null +++ b/bcs-services/bcs-webconsole/.golangci.yml @@ -0,0 +1,89 @@ +run: + timeout: 5m + +issues: + # 显示所有 issue + max-issues-per-linter: 0 + max-same-issues: 0 + exclude-use-default: false + +linters: + disable-all: true + enable: + # enable by default + - errcheck + - gosimple + - govet + - ineffassign + - staticcheck + - unused + + # custom + - gci + - goconst + - gocyclo + - gofmt + - goheader + - goimports + - gosec + - misspell + - nakedret + - revive + - unconvert + - unparam + +linters-settings: + # 只开启特定的规则 + errcheck: + exclude-functions: + - (*os.File).Close + - (io.Closer).Close + - (net/http.ResponseWriter).Write + - io.Copy + - os.RemoveAll + govet: + check-shadowing: true + gocyclo: + min-complexity: 30 + goimports: + local-prefixes: github.com/Tencent/bk-bcs/bcs-services/bcs-webconsole + gci: + sections: + - standard + - default + - prefix(github.com/Tencent/bk-bcs/bcs-services/bcs-webconsole) + gosec: + includes: + - G201 # SQL query construction using format string + - G202 # SQL query construction using string concatenation + - G101 # Look for hard coded credentials + - G401 # Detect the usage of DES, RC4, MD5 or SHA1 + - G402 # Look for bad TLS connection settings + - G403 # Ensure minimum RSA key length of 2048 bits + - G404 # Insecure random number source (rand) + - G504 # Import blocklist: net/http/cgi + goheader: + template: |- + * Tencent is pleased to support the open source community by making Blueking Container Service available. + * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. + * Licensed under the MIT License (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * http://opensource.org/licenses/MIT + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language governing permissions and + * limitations under the License. + * + misspell: + locale: US + revive: + rules: + - name: exported + severity: warning + disabled: false + arguments: + - checkPrivateReceivers + - sayRepetitiveInsteadOfStutters + - name: package-comments + severity: warning + disabled: false From 79ddc01052b3f653fad636cb5a97d6c5e3f31221 Mon Sep 17 00:00:00 2001 From: ifooth Date: Mon, 18 Sep 2023 10:38:11 +0800 Subject: [PATCH 02/10] Update: add bcs-webconsole-lint.yml --- .../{bcs-webconsole-lint.yml => bcs-webconsole.yml} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename .github/workflows/{bcs-webconsole-lint.yml => bcs-webconsole.yml} (76%) diff --git a/.github/workflows/bcs-webconsole-lint.yml b/.github/workflows/bcs-webconsole.yml similarity index 76% rename from .github/workflows/bcs-webconsole-lint.yml rename to .github/workflows/bcs-webconsole.yml index b4ae12825a..c87a07def2 100644 --- a/.github/workflows/bcs-webconsole-lint.yml +++ b/.github/workflows/bcs-webconsole.yml @@ -1,4 +1,4 @@ -name: lint +name: bcs-webconsole on: [push, pull_request] jobs: lint: @@ -10,12 +10,12 @@ jobs: - name: setup go uses: actions/setup-go@v3 with: - go-version-file: go.mod + go-version-file: bcs-services/bcs-webconsole/go.mod - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: version: v1.54.2 args: --timeout=30m --issues-exit-code=0 - working-directory: ./bcs-services/bcs-webconsole + working-directory: bcs-services/bcs-webconsole - name: go mod tidy check uses: katexochen/go-tidy-check@v2 From bd7e8fa9e9d41b2c37c90af59fce36eaf4475782 Mon Sep 17 00:00:00 2001 From: ifooth Date: Mon, 18 Sep 2023 10:50:33 +0800 Subject: [PATCH 03/10] Update: add lint.yml --- .github/workflows/bcs-webconsole.yml | 21 ------ .github/workflows/lint.yml | 39 +++++++++++ bcs-services/bcs-monitor/.golangci.yml | 89 ++++++++++++++++++++++++++ 3 files changed, 128 insertions(+), 21 deletions(-) delete mode 100644 .github/workflows/bcs-webconsole.yml create mode 100644 .github/workflows/lint.yml create mode 100644 bcs-services/bcs-monitor/.golangci.yml diff --git a/.github/workflows/bcs-webconsole.yml b/.github/workflows/bcs-webconsole.yml deleted file mode 100644 index c87a07def2..0000000000 --- a/.github/workflows/bcs-webconsole.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: bcs-webconsole -on: [push, pull_request] -jobs: - lint: - name: lint - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@v3 - - name: setup go - uses: actions/setup-go@v3 - with: - go-version-file: bcs-services/bcs-webconsole/go.mod - - name: golangci-lint - uses: golangci/golangci-lint-action@v3 - with: - version: v1.54.2 - args: --timeout=30m --issues-exit-code=0 - working-directory: bcs-services/bcs-webconsole - - name: go mod tidy check - uses: katexochen/go-tidy-check@v2 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000000..00fc99b63a --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,39 @@ +name: lint +on: [push, pull_request] +jobs: + bcs-webconsole: + name: lint + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v3 + - name: setup go + uses: actions/setup-go@v3 + with: + go-version-file: bcs-services/bcs-monitor/go.mod + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + version: v1.54.2 + args: --timeout=30m --issues-exit-code=0 + working-directory: bcs-services/bcs-monitor + - name: go mod tidy check + uses: katexochen/go-tidy-check@v2 + bcs-monitor: + name: lint + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v3 + - name: setup go + uses: actions/setup-go@v3 + with: + go-version-file: bcs-services/bcs-monitor/go.mod + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + version: v1.54.2 + args: --timeout=30m --issues-exit-code=0 + working-directory: bcs-services/bcs-monitor + - name: go mod tidy check + uses: katexochen/go-tidy-check@v2 diff --git a/bcs-services/bcs-monitor/.golangci.yml b/bcs-services/bcs-monitor/.golangci.yml new file mode 100644 index 0000000000..dc69a77b30 --- /dev/null +++ b/bcs-services/bcs-monitor/.golangci.yml @@ -0,0 +1,89 @@ +run: + timeout: 5m + +issues: + # 显示所有 issue + max-issues-per-linter: 0 + max-same-issues: 0 + exclude-use-default: false + +linters: + disable-all: true + enable: + # enable by default + - errcheck + - gosimple + - govet + - ineffassign + - staticcheck + - unused + + # custom + - gci + - goconst + - gocyclo + - gofmt + - goheader + - goimports + - gosec + - misspell + - nakedret + - revive + - unconvert + - unparam + +linters-settings: + # 只开启特定的规则 + errcheck: + exclude-functions: + - (*os.File).Close + - (io.Closer).Close + - (net/http.ResponseWriter).Write + - io.Copy + - os.RemoveAll + govet: + check-shadowing: true + gocyclo: + min-complexity: 30 + goimports: + local-prefixes: github.com/Tencent/bk-bcs/bcs-services/bcs-monitor + gci: + sections: + - standard + - default + - prefix(github.com/Tencent/bk-bcs/bcs-services/bcs-monitor) + gosec: + includes: + - G201 # SQL query construction using format string + - G202 # SQL query construction using string concatenation + - G101 # Look for hard coded credentials + - G401 # Detect the usage of DES, RC4, MD5 or SHA1 + - G402 # Look for bad TLS connection settings + - G403 # Ensure minimum RSA key length of 2048 bits + - G404 # Insecure random number source (rand) + - G504 # Import blocklist: net/http/cgi + goheader: + template: |- + * Tencent is pleased to support the open source community by making Blueking Container Service available. + * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. + * Licensed under the MIT License (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * http://opensource.org/licenses/MIT + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language governing permissions and + * limitations under the License. + * + misspell: + locale: US + revive: + rules: + - name: exported + severity: warning + disabled: false + arguments: + - checkPrivateReceivers + - sayRepetitiveInsteadOfStutters + - name: package-comments + severity: warning + disabled: false From 21ae1d92fec80fc2f529b8be5174f1e5fe3655bf Mon Sep 17 00:00:00 2001 From: ifooth Date: Mon, 18 Sep 2023 10:54:42 +0800 Subject: [PATCH 04/10] Update: add lint.yml --- .github/workflows/lint.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 00fc99b63a..5e02b80c7e 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -2,7 +2,7 @@ name: lint on: [push, pull_request] jobs: bcs-webconsole: - name: lint + name: bcs-webconsole runs-on: ubuntu-latest steps: - name: checkout @@ -10,17 +10,17 @@ jobs: - name: setup go uses: actions/setup-go@v3 with: - go-version-file: bcs-services/bcs-monitor/go.mod + go-version-file: bcs-services/bcs-webconsole/go.mod - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: version: v1.54.2 args: --timeout=30m --issues-exit-code=0 - working-directory: bcs-services/bcs-monitor + working-directory: bcs-services/bcs-webconsole - name: go mod tidy check uses: katexochen/go-tidy-check@v2 bcs-monitor: - name: lint + name: bcs-monitor runs-on: ubuntu-latest steps: - name: checkout From 5e8c60e1a9739c29da450bed60f9658528006519 Mon Sep 17 00:00:00 2001 From: ifooth Date: Mon, 18 Sep 2023 11:01:06 +0800 Subject: [PATCH 05/10] Update: add lint.yml --- .github/workflows/lint.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 5e02b80c7e..5fab451820 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -11,14 +11,17 @@ jobs: uses: actions/setup-go@v3 with: go-version-file: bcs-services/bcs-webconsole/go.mod + - name: go mod tidy check + uses: katexochen/go-tidy-check@v2 + with: + modules: bcs-services/bcs-webconsole - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: version: v1.54.2 args: --timeout=30m --issues-exit-code=0 working-directory: bcs-services/bcs-webconsole - - name: go mod tidy check - uses: katexochen/go-tidy-check@v2 + bcs-monitor: name: bcs-monitor runs-on: ubuntu-latest @@ -29,11 +32,13 @@ jobs: uses: actions/setup-go@v3 with: go-version-file: bcs-services/bcs-monitor/go.mod + - name: go mod tidy check + uses: katexochen/go-tidy-check@v2 + with: + modules: bcs-services/bcs-monitor - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: version: v1.54.2 args: --timeout=30m --issues-exit-code=0 working-directory: bcs-services/bcs-monitor - - name: go mod tidy check - uses: katexochen/go-tidy-check@v2 From 6645f5d79dc2f0ae775796a27a5048f0d91abacf Mon Sep 17 00:00:00 2001 From: ifooth Date: Mon, 18 Sep 2023 11:15:57 +0800 Subject: [PATCH 06/10] Update: add bscp lint.yml --- .github/workflows/lint.yml | 21 ++++++- bcs-services/bcs-bscp/.golangci.yml | 89 +++++++++++++++++++++++++++++ 2 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 bcs-services/bcs-bscp/.golangci.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 5fab451820..69ec2929a0 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -21,7 +21,6 @@ jobs: version: v1.54.2 args: --timeout=30m --issues-exit-code=0 working-directory: bcs-services/bcs-webconsole - bcs-monitor: name: bcs-monitor runs-on: ubuntu-latest @@ -42,3 +41,23 @@ jobs: version: v1.54.2 args: --timeout=30m --issues-exit-code=0 working-directory: bcs-services/bcs-monitor + bcs-bscp: + name: bcs-bscp + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v3 + - name: setup go + uses: actions/setup-go@v3 + with: + go-version-file: bcs-services/bcs-bscp/go.mod + - name: go mod tidy check + uses: katexochen/go-tidy-check@v2 + with: + modules: bcs-services/bcs-bscp + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + version: v1.54.2 + args: --timeout=30m --issues-exit-code=0 + working-directory: bcs-services/bcs-bscp diff --git a/bcs-services/bcs-bscp/.golangci.yml b/bcs-services/bcs-bscp/.golangci.yml new file mode 100644 index 0000000000..a82d78fef7 --- /dev/null +++ b/bcs-services/bcs-bscp/.golangci.yml @@ -0,0 +1,89 @@ +run: + timeout: 5m + +issues: + # 显示所有 issue + max-issues-per-linter: 0 + max-same-issues: 0 + exclude-use-default: false + +linters: + disable-all: true + enable: + # enable by default + - errcheck + - gosimple + - govet + - ineffassign + - staticcheck + - unused + + # custom + - gci + - goconst + - gocyclo + - gofmt + - goheader + - goimports + - gosec + - misspell + - nakedret + - revive + - unconvert + - unparam + +linters-settings: + # 只开启特定的规则 + errcheck: + exclude-functions: + - (*os.File).Close + - (io.Closer).Close + - (net/http.ResponseWriter).Write + - io.Copy + - os.RemoveAll + govet: + check-shadowing: true + gocyclo: + min-complexity: 30 + goimports: + local-prefixes: bscp.io + gci: + sections: + - standard + - default + - prefix(bscp.io) + gosec: + includes: + - G201 # SQL query construction using format string + - G202 # SQL query construction using string concatenation + - G101 # Look for hard coded credentials + - G401 # Detect the usage of DES, RC4, MD5 or SHA1 + - G402 # Look for bad TLS connection settings + - G403 # Ensure minimum RSA key length of 2048 bits + - G404 # Insecure random number source (rand) + - G504 # Import blocklist: net/http/cgi + goheader: + template: |- + * Tencent is pleased to support the open source community by making Blueking Container Service available. + * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. + * Licensed under the MIT License (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * http://opensource.org/licenses/MIT + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language governing permissions and + * limitations under the License. + * + misspell: + locale: US + revive: + rules: + - name: exported + severity: warning + disabled: false + arguments: + - checkPrivateReceivers + - sayRepetitiveInsteadOfStutters + - name: package-comments + severity: warning + disabled: false From 2bc16903c2b0e7fbf634ab2efae5c6cb55a680c1 Mon Sep 17 00:00:00 2001 From: ifooth Date: Mon, 18 Sep 2023 11:30:17 +0800 Subject: [PATCH 07/10] Update: fix --- .github/workflows/lint.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 69ec2929a0..aa5fcbc3bd 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -19,7 +19,7 @@ jobs: uses: golangci/golangci-lint-action@v3 with: version: v1.54.2 - args: --timeout=30m --issues-exit-code=0 + args: --timeout=30m --issues-exit-code=0 --out-format=colored-line-number working-directory: bcs-services/bcs-webconsole bcs-monitor: name: bcs-monitor @@ -39,7 +39,7 @@ jobs: uses: golangci/golangci-lint-action@v3 with: version: v1.54.2 - args: --timeout=30m --issues-exit-code=0 + args: --timeout=30m --issues-exit-code=0 --out-format=colored-line-number working-directory: bcs-services/bcs-monitor bcs-bscp: name: bcs-bscp @@ -59,5 +59,5 @@ jobs: uses: golangci/golangci-lint-action@v3 with: version: v1.54.2 - args: --timeout=30m --issues-exit-code=0 + args: --timeout=30m --issues-exit-code=0 --out-format=colored-line-number working-directory: bcs-services/bcs-bscp From 4ce38f1d7665b7ec10bad5cf899072d9bdb673e8 Mon Sep 17 00:00:00 2001 From: ifooth Date: Mon, 18 Sep 2023 11:39:13 +0800 Subject: [PATCH 08/10] Update: auto fix bcs-monitor lint --- bcs-services/bcs-monitor/.promu.yml | 21 ------------------- bcs-services/bcs-monitor/Makefile | 4 ++++ .../bcs-monitor/cmd/bcs-monitor/api.go | 2 +- .../component/bcs_monitor/bcs_monitor_test.go | 3 ++- .../pkg/component/bcs_monitor/helper.go | 3 ++- .../pkg/component/bk_monitor/bk_monitor.go | 2 +- .../pkg/component/k8sclient/node_test.go | 3 ++- .../pkg/component/k8sclient/pod_raw.go | 3 ++- .../bcs-monitor/pkg/query/discovery_client.go | 3 ++- .../bcs-monitor/pkg/rest/middleware/auth.go | 2 +- bcs-services/bcs-monitor/pkg/storage/redis.go | 4 ++-- .../pkg/storegw/bcs_system/metrics.go | 3 ++- .../storegw/bcs_system/source/base/base.go | 5 +++-- .../bcs_system/source/bk_monitor/container.go | 3 ++- .../bcs_system/source/bk_monitor/node.go | 3 ++- .../bcs_system/source/bk_monitor/pod.go | 3 ++- .../storegw/bcs_system/source/compute/node.go | 3 ++- .../storegw/bcs_system/source/compute/pod.go | 3 ++- .../bcs_system/source/federation/node.go | 3 ++- .../bcs_system/source/prometheus/cluster.go | 3 ++- .../bcs_system/source/prometheus/node.go | 3 ++- .../bcs_system/source/prometheus/pod.go | 3 ++- .../bcs_system/source/vcluster/container.go | 3 ++- .../bcs_system/source/vcluster/node.go | 3 ++- .../storegw/bcs_system/source/vcluster/pod.go | 3 ++- bcs-services/bcs-monitor/pkg/tracing/init.go | 2 +- 26 files changed, 49 insertions(+), 47 deletions(-) delete mode 100644 bcs-services/bcs-monitor/.promu.yml diff --git a/bcs-services/bcs-monitor/.promu.yml b/bcs-services/bcs-monitor/.promu.yml deleted file mode 100644 index 76e4b94b07..0000000000 --- a/bcs-services/bcs-monitor/.promu.yml +++ /dev/null @@ -1,21 +0,0 @@ -go: - version: 1.17 - cgo: false -repository: - path: github.com/Tencent/bk-bcs/bcs-services/bcs-monitor -build: - binaries: - - name: bcs-monitor - path: cmd/bcs-monitor - flags: -tags netgo -trimpath - ldflags: | - -X github.com/prometheus/common/version.Version={{.Version}} - -X github.com/prometheus/common/version.Revision={{.Revision}} - -X github.com/prometheus/common/version.Branch={{.Branch}} - -X github.com/prometheus/common/version.BuildUser={{user}}@{{host}} - -X github.com/prometheus/common/version.BuildDate={{date "20060102-15:04:05"}} -crossbuild: - platforms: - - linux/amd64 - - darwin/amd64 - - windows/amd64 diff --git a/bcs-services/bcs-monitor/Makefile b/bcs-services/bcs-monitor/Makefile index 9f549c15c0..53aa67ba17 100644 --- a/bcs-services/bcs-monitor/Makefile +++ b/bcs-services/bcs-monitor/Makefile @@ -45,6 +45,10 @@ promu: build: ${GOBUILD} ${LDFLAG} -o bin/bcs-monitor ./cmd/bcs-monitor +.PHONY: lint +lint: + @golangci-lint run --issues-exit-code=0 --fix + .PHONY: test test: @echo ">> test not support" diff --git a/bcs-services/bcs-monitor/cmd/bcs-monitor/api.go b/bcs-services/bcs-monitor/cmd/bcs-monitor/api.go index 22e688b5b0..329241919d 100644 --- a/bcs-services/bcs-monitor/cmd/bcs-monitor/api.go +++ b/bcs-services/bcs-monitor/cmd/bcs-monitor/api.go @@ -17,11 +17,11 @@ import ( "context" "fmt" + "github.com/Tencent/bk-bcs/bcs-common/common/version" "github.com/oklog/run" "github.com/pkg/errors" "github.com/spf13/cobra" - "github.com/Tencent/bk-bcs/bcs-common/common/version" "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/api" "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/api/logrule" "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/component/bcs" diff --git a/bcs-services/bcs-monitor/pkg/component/bcs_monitor/bcs_monitor_test.go b/bcs-services/bcs-monitor/pkg/component/bcs_monitor/bcs_monitor_test.go index e46ac33648..b4c2a52d21 100644 --- a/bcs-services/bcs-monitor/pkg/component/bcs_monitor/bcs_monitor_test.go +++ b/bcs-services/bcs-monitor/pkg/component/bcs_monitor/bcs_monitor_test.go @@ -19,8 +19,9 @@ import ( "testing" "time" - bcstesting "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/testing" "github.com/stretchr/testify/assert" + + bcstesting "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/testing" ) func TestQueryInstant(t *testing.T) { diff --git a/bcs-services/bcs-monitor/pkg/component/bcs_monitor/helper.go b/bcs-services/bcs-monitor/pkg/component/bcs_monitor/helper.go index ffa842d652..ee2465f8df 100644 --- a/bcs-services/bcs-monitor/pkg/component/bcs_monitor/helper.go +++ b/bcs-services/bcs-monitor/pkg/component/bcs_monitor/helper.go @@ -15,8 +15,9 @@ package bcsmonitor import ( "net/http" - "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/config" "github.com/prometheus/common/model" + + "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/config" ) func getQueryURL() (string, http.Header) { diff --git a/bcs-services/bcs-monitor/pkg/component/bk_monitor/bk_monitor.go b/bcs-services/bcs-monitor/pkg/component/bk_monitor/bk_monitor.go index 59e18c545c..6fad220dd6 100644 --- a/bcs-services/bcs-monitor/pkg/component/bk_monitor/bk_monitor.go +++ b/bcs-services/bcs-monitor/pkg/component/bk_monitor/bk_monitor.go @@ -24,11 +24,11 @@ import ( "github.com/pkg/errors" "github.com/prometheus/prometheus/prompb" + "github.com/thanos-io/thanos/pkg/store/storepb" "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/component" "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/config" "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/storage" - "github.com/thanos-io/thanos/pkg/store/storepb" ) const ( diff --git a/bcs-services/bcs-monitor/pkg/component/k8sclient/node_test.go b/bcs-services/bcs-monitor/pkg/component/k8sclient/node_test.go index 3db829a4b1..34e33d4f14 100644 --- a/bcs-services/bcs-monitor/pkg/component/k8sclient/node_test.go +++ b/bcs-services/bcs-monitor/pkg/component/k8sclient/node_test.go @@ -16,8 +16,9 @@ import ( "context" "testing" - bcstesting "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/testing" "github.com/stretchr/testify/assert" + + bcstesting "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/testing" ) func TestGetNodeList(t *testing.T) { diff --git a/bcs-services/bcs-monitor/pkg/component/k8sclient/pod_raw.go b/bcs-services/bcs-monitor/pkg/component/k8sclient/pod_raw.go index 4b1c04d29f..a528be91d7 100644 --- a/bcs-services/bcs-monitor/pkg/component/k8sclient/pod_raw.go +++ b/bcs-services/bcs-monitor/pkg/component/k8sclient/pod_raw.go @@ -19,10 +19,11 @@ import ( "fmt" "time" + "github.com/pkg/errors" + "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/component" "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/config" "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/storage" - "github.com/pkg/errors" ) const cacheExpireDuration = time.Hour * 24 // 缓存过期时间, 现在的场景主要是获取不可变的 lowerPodID diff --git a/bcs-services/bcs-monitor/pkg/query/discovery_client.go b/bcs-services/bcs-monitor/pkg/query/discovery_client.go index b04918814c..585969ffe1 100644 --- a/bcs-services/bcs-monitor/pkg/query/discovery_client.go +++ b/bcs-services/bcs-monitor/pkg/query/discovery_client.go @@ -21,7 +21,6 @@ import ( "sync" "time" - "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/config" "github.com/TencentBlueKing/bkmonitor-kits/logger" "github.com/TencentBlueKing/bkmonitor-kits/logger/gokit" grpc_retry "github.com/grpc-ecosystem/go-grpc-middleware/retry" @@ -42,6 +41,8 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "k8s.io/klog/v2" + + "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/config" ) // DiscoveryClient 支持的服务发现, 包含静态配置, http-sd, 命令行和配置文件来源 diff --git a/bcs-services/bcs-monitor/pkg/rest/middleware/auth.go b/bcs-services/bcs-monitor/pkg/rest/middleware/auth.go index 27aea9c3fb..5dd8e72086 100644 --- a/bcs-services/bcs-monitor/pkg/rest/middleware/auth.go +++ b/bcs-services/bcs-monitor/pkg/rest/middleware/auth.go @@ -19,6 +19,7 @@ import ( "os" "strings" + "github.com/Tencent/bk-bcs/bcs-services/pkg/bcs-auth/audit" "github.com/gin-gonic/gin" "github.com/golang-jwt/jwt/v4" "github.com/pkg/errors" @@ -27,7 +28,6 @@ import ( "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/component/iam" "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/config" "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/rest" - "github.com/Tencent/bk-bcs/bcs-services/pkg/bcs-auth/audit" ) // AuthenticationRequired API类型, 兼容多种认证模式 diff --git a/bcs-services/bcs-monitor/pkg/storage/redis.go b/bcs-services/bcs-monitor/pkg/storage/redis.go index 7a189e21b9..de3816840d 100644 --- a/bcs-services/bcs-monitor/pkg/storage/redis.go +++ b/bcs-services/bcs-monitor/pkg/storage/redis.go @@ -17,9 +17,9 @@ import ( "fmt" "time" - "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/config" - redis "github.com/go-redis/redis/v8" + + "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/config" ) // RedisSession : diff --git a/bcs-services/bcs-monitor/pkg/storegw/bcs_system/metrics.go b/bcs-services/bcs-monitor/pkg/storegw/bcs_system/metrics.go index 4ae93b25bc..1aa82b5c19 100644 --- a/bcs-services/bcs-monitor/pkg/storegw/bcs_system/metrics.go +++ b/bcs-services/bcs-monitor/pkg/storegw/bcs_system/metrics.go @@ -18,8 +18,9 @@ import ( "context" "time" - "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/base" "github.com/prometheus/prometheus/prompb" + + "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/base" ) // metricsParams diff --git a/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/base/base.go b/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/base/base.go index 5d9a5fd01b..93d0c97bfa 100644 --- a/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/base/base.go +++ b/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/base/base.go @@ -18,10 +18,11 @@ import ( "strings" "time" - "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/component/k8sclient" - "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/utils" "github.com/prometheus/common/model" "github.com/prometheus/prometheus/prompb" + + "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/component/k8sclient" + "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/utils" ) // NodeInfo 节点信息 diff --git a/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/bk_monitor/container.go b/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/bk_monitor/container.go index 4cd58e25dd..8c49e361aa 100644 --- a/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/bk_monitor/container.go +++ b/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/bk_monitor/container.go @@ -16,10 +16,11 @@ import ( "context" "time" + "github.com/prometheus/prometheus/prompb" + bcsmonitor "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/component/bcs_monitor" "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/base" "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/utils" - "github.com/prometheus/prometheus/prompb" ) // handleContainerMetric 处理公共函数 diff --git a/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/bk_monitor/node.go b/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/bk_monitor/node.go index 56630db918..b6cf29f34d 100644 --- a/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/bk_monitor/node.go +++ b/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/bk_monitor/node.go @@ -16,10 +16,11 @@ import ( "context" "time" + "github.com/prometheus/prometheus/prompb" + bcsmonitor "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/component/bcs_monitor" "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/component/k8sclient" "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/base" - "github.com/prometheus/prometheus/prompb" ) // 和现在规范的名称保持一致 diff --git a/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/bk_monitor/pod.go b/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/bk_monitor/pod.go index 6bcb678006..8698ad73de 100644 --- a/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/bk_monitor/pod.go +++ b/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/bk_monitor/pod.go @@ -16,10 +16,11 @@ import ( "context" "time" + "github.com/prometheus/prometheus/prompb" + bcsmonitor "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/component/bcs_monitor" "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/base" "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/utils" - "github.com/prometheus/prometheus/prompb" ) // handlePodMetric xxx diff --git a/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/compute/node.go b/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/compute/node.go index 724e198847..240969af19 100644 --- a/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/compute/node.go +++ b/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/compute/node.go @@ -16,8 +16,9 @@ import ( "context" "time" - "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/base" "github.com/prometheus/prometheus/prompb" + + "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/base" ) // GetNodeInfo 节点信息 diff --git a/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/compute/pod.go b/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/compute/pod.go index f29ee6c35c..be11993b81 100644 --- a/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/compute/pod.go +++ b/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/compute/pod.go @@ -16,10 +16,11 @@ import ( "context" "time" + "github.com/prometheus/prometheus/prompb" + bcsmonitor "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/component/bcs_monitor" "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/base" "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/utils" - "github.com/prometheus/prometheus/prompb" ) func (m *Compute) handlePodMetric(ctx context.Context, projectID, clusterID, namespace string, podNameList []string, diff --git a/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/federation/node.go b/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/federation/node.go index 99b9e24f61..c45d388b1e 100644 --- a/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/federation/node.go +++ b/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/federation/node.go @@ -16,8 +16,9 @@ import ( "context" "time" - "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/base" "github.com/prometheus/prometheus/prompb" + + "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/base" ) // GetNodeInfo 节点信息 diff --git a/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/prometheus/cluster.go b/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/prometheus/cluster.go index d34d1da8d0..8be85b46ea 100644 --- a/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/prometheus/cluster.go +++ b/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/prometheus/cluster.go @@ -16,10 +16,11 @@ import ( "context" "time" + "github.com/prometheus/prometheus/prompb" + bcsmonitor "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/component/bcs_monitor" "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/component/k8sclient" "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/base" - "github.com/prometheus/prometheus/prompb" ) const ( diff --git a/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/prometheus/node.go b/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/prometheus/node.go index 4087c5dc52..6808d3bea4 100644 --- a/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/prometheus/node.go +++ b/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/prometheus/node.go @@ -16,10 +16,11 @@ import ( "context" "time" + "github.com/prometheus/prometheus/prompb" + bcsmonitor "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/component/bcs_monitor" "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/component/k8sclient" "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/base" - "github.com/prometheus/prometheus/prompb" ) const provider = "Prometheus" diff --git a/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/prometheus/pod.go b/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/prometheus/pod.go index e66c9dd263..ddd961f541 100644 --- a/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/prometheus/pod.go +++ b/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/prometheus/pod.go @@ -16,10 +16,11 @@ import ( "context" "time" + "github.com/prometheus/prometheus/prompb" + bcsmonitor "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/component/bcs_monitor" "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/base" "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/utils" - "github.com/prometheus/prometheus/prompb" ) func (m *Prometheus) handlePodMetric(ctx context.Context, projectID, clusterID, namespace string, podNameList []string, diff --git a/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/vcluster/container.go b/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/vcluster/container.go index 6dceaed529..8be00a64c6 100644 --- a/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/vcluster/container.go +++ b/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/vcluster/container.go @@ -16,10 +16,11 @@ import ( "context" "time" + "github.com/prometheus/prometheus/prompb" + bcsmonitor "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/component/bcs_monitor" "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/base" "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/utils" - "github.com/prometheus/prometheus/prompb" ) // handleContainerMetric 处理公共函数 diff --git a/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/vcluster/node.go b/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/vcluster/node.go index 7bcec2598a..1081166ab5 100644 --- a/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/vcluster/node.go +++ b/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/vcluster/node.go @@ -16,8 +16,9 @@ import ( "context" "time" - "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/base" "github.com/prometheus/prometheus/prompb" + + "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/base" ) // GetNodeInfo 节点信息 diff --git a/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/vcluster/pod.go b/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/vcluster/pod.go index 20dd738e65..08aecfe521 100644 --- a/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/vcluster/pod.go +++ b/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/vcluster/pod.go @@ -16,10 +16,11 @@ import ( "context" "time" + "github.com/prometheus/prometheus/prompb" + bcsmonitor "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/component/bcs_monitor" "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/storegw/bcs_system/source/base" "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/utils" - "github.com/prometheus/prometheus/prompb" ) // handlePodMetric xxx diff --git a/bcs-services/bcs-monitor/pkg/tracing/init.go b/bcs-services/bcs-monitor/pkg/tracing/init.go index a497c03a1d..5945a0e8f8 100644 --- a/bcs-services/bcs-monitor/pkg/tracing/init.go +++ b/bcs-services/bcs-monitor/pkg/tracing/init.go @@ -16,9 +16,9 @@ package tracing import ( "context" + "github.com/Tencent/bk-bcs/bcs-common/pkg/otel/trace" "go.opentelemetry.io/otel/attribute" - "github.com/Tencent/bk-bcs/bcs-common/pkg/otel/trace" "github.com/Tencent/bk-bcs/bcs-services/bcs-monitor/pkg/config" ) From 5916fa7d00ef6d698beec6e4f8a836c55d6ae779 Mon Sep 17 00:00:00 2001 From: ifooth Date: Mon, 18 Sep 2023 11:40:34 +0800 Subject: [PATCH 09/10] Update: auto fix bcs-webconsole lint --- bcs-services/bcs-webconsole/Makefile | 4 ++++ bcs-services/bcs-webconsole/console/api/service.go | 4 ++-- .../console/components/bcs/bcs_test.go | 3 ++- bcs-services/bcs-webconsole/console/manager/conn.go | 2 +- .../bcs-webconsole/console/podmanager/startup.go | 12 ++++++------ bcs-services/bcs-webconsole/console/tracing/init.go | 2 +- bcs-services/bcs-webconsole/console/types/podexec.go | 3 ++- bcs-services/bcs-webconsole/console/web/web.go | 1 + 8 files changed, 19 insertions(+), 12 deletions(-) diff --git a/bcs-services/bcs-webconsole/Makefile b/bcs-services/bcs-webconsole/Makefile index b772394b6c..f24a22c3e9 100644 --- a/bcs-services/bcs-webconsole/Makefile +++ b/bcs-services/bcs-webconsole/Makefile @@ -27,6 +27,10 @@ init: @go install github.com/golang/protobuf/protoc-gen-go@latest @go install github.com/asim/go-micro/cmd/protoc-gen-micro/v4@latest +.PHONY: lint +lint: + @golangci-lint run --issues-exit-code=0 --fix + .PHONY: proto proto: @protoc --proto_path=. --micro_out=. --go_out=:. proto/bcs-webconsole.proto diff --git a/bcs-services/bcs-webconsole/console/api/service.go b/bcs-services/bcs-webconsole/console/api/service.go index 756f07c707..80d02172e2 100644 --- a/bcs-services/bcs-webconsole/console/api/service.go +++ b/bcs-services/bcs-webconsole/console/api/service.go @@ -25,11 +25,11 @@ import ( "strings" "time" + logger "github.com/Tencent/bk-bcs/bcs-common/common/blog" + gintrace "github.com/Tencent/bk-bcs/bcs-common/pkg/otel/trace/gin" "github.com/gin-gonic/gin" "github.com/pkg/errors" - logger "github.com/Tencent/bk-bcs/bcs-common/common/blog" - gintrace "github.com/Tencent/bk-bcs/bcs-common/pkg/otel/trace/gin" "github.com/Tencent/bk-bcs/bcs-services/bcs-webconsole/console/components/bcs" "github.com/Tencent/bk-bcs/bcs-services/bcs-webconsole/console/config" "github.com/Tencent/bk-bcs/bcs-services/bcs-webconsole/console/i18n" diff --git a/bcs-services/bcs-webconsole/console/components/bcs/bcs_test.go b/bcs-services/bcs-webconsole/console/components/bcs/bcs_test.go index ab7acbd578..cdf0addad1 100644 --- a/bcs-services/bcs-webconsole/console/components/bcs/bcs_test.go +++ b/bcs-services/bcs-webconsole/console/components/bcs/bcs_test.go @@ -22,8 +22,9 @@ import ( "runtime" "testing" - "github.com/Tencent/bk-bcs/bcs-services/bcs-webconsole/console/config" "github.com/stretchr/testify/assert" + + "github.com/Tencent/bk-bcs/bcs-services/bcs-webconsole/console/config" ) func initConf() { diff --git a/bcs-services/bcs-webconsole/console/manager/conn.go b/bcs-services/bcs-webconsole/console/manager/conn.go index c5d6f8237b..674e4be89e 100644 --- a/bcs-services/bcs-webconsole/console/manager/conn.go +++ b/bcs-services/bcs-webconsole/console/manager/conn.go @@ -22,6 +22,7 @@ import ( "time" "unicode" + logger "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/gin-gonic/gin" "github.com/gorilla/websocket" "github.com/pkg/errors" @@ -29,7 +30,6 @@ import ( "k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/tools/remotecommand" - logger "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/Tencent/bk-bcs/bcs-services/bcs-webconsole/console/components/k8sclient" "github.com/Tencent/bk-bcs/bcs-services/bcs-webconsole/console/config" "github.com/Tencent/bk-bcs/bcs-services/bcs-webconsole/console/i18n" diff --git a/bcs-services/bcs-webconsole/console/podmanager/startup.go b/bcs-services/bcs-webconsole/console/podmanager/startup.go index bfcad8d4ed..aaaea39170 100644 --- a/bcs-services/bcs-webconsole/console/podmanager/startup.go +++ b/bcs-services/bcs-webconsole/console/podmanager/startup.go @@ -21,13 +21,8 @@ import ( "strings" "time" - "github.com/Tencent/bk-bcs/bcs-services/bcs-webconsole/console/components/bcs" - "github.com/Tencent/bk-bcs/bcs-services/bcs-webconsole/console/components/k8sclient" - "github.com/Tencent/bk-bcs/bcs-services/bcs-webconsole/console/config" - "github.com/Tencent/bk-bcs/bcs-services/bcs-webconsole/console/types" - "github.com/gosimple/slug" - logger "github.com/Tencent/bk-bcs/bcs-common/common/blog" + "github.com/gosimple/slug" "github.com/pkg/errors" v1 "k8s.io/api/core/v1" k8sErr "k8s.io/apimachinery/pkg/api/errors" @@ -35,6 +30,11 @@ import ( "k8s.io/client-go/kubernetes" clientcmdv1 "k8s.io/client-go/tools/clientcmd/api/v1" "sigs.k8s.io/yaml" + + "github.com/Tencent/bk-bcs/bcs-services/bcs-webconsole/console/components/bcs" + "github.com/Tencent/bk-bcs/bcs-services/bcs-webconsole/console/components/k8sclient" + "github.com/Tencent/bk-bcs/bcs-services/bcs-webconsole/console/config" + "github.com/Tencent/bk-bcs/bcs-services/bcs-webconsole/console/types" ) // StartupManager xxx diff --git a/bcs-services/bcs-webconsole/console/tracing/init.go b/bcs-services/bcs-webconsole/console/tracing/init.go index 10eb033a05..a7a24d0693 100644 --- a/bcs-services/bcs-webconsole/console/tracing/init.go +++ b/bcs-services/bcs-webconsole/console/tracing/init.go @@ -16,9 +16,9 @@ package tracing import ( "context" + "github.com/Tencent/bk-bcs/bcs-common/pkg/otel/trace" "go.opentelemetry.io/otel/attribute" - "github.com/Tencent/bk-bcs/bcs-common/pkg/otel/trace" configTracing "github.com/Tencent/bk-bcs/bcs-services/bcs-webconsole/console/config" ) diff --git a/bcs-services/bcs-webconsole/console/types/podexec.go b/bcs-services/bcs-webconsole/console/types/podexec.go index 02fdab1fe0..7d43fbfbb8 100644 --- a/bcs-services/bcs-webconsole/console/types/podexec.go +++ b/bcs-services/bcs-webconsole/console/types/podexec.go @@ -17,12 +17,13 @@ package types import ( "io" - "github.com/Tencent/bk-bcs/bcs-services/bcs-webconsole/console/components/k8sclient" coreV1 "k8s.io/api/core/v1" "k8s.io/client-go/kubernetes" "k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/rest" "k8s.io/client-go/tools/remotecommand" + + "github.com/Tencent/bk-bcs/bcs-services/bcs-webconsole/console/components/k8sclient" ) // PodExec pod exec context diff --git a/bcs-services/bcs-webconsole/console/web/web.go b/bcs-services/bcs-webconsole/console/web/web.go index eb1bc1fd6a..323d8b04dd 100644 --- a/bcs-services/bcs-webconsole/console/web/web.go +++ b/bcs-services/bcs-webconsole/console/web/web.go @@ -21,6 +21,7 @@ import ( ) // FS xxx +// //go:embed templates static var FS embed.FS From 25dfc10f64a48d24d5261b2718ac92ad24f8abe8 Mon Sep 17 00:00:00 2001 From: ifooth Date: Mon, 18 Sep 2023 11:56:28 +0800 Subject: [PATCH 10/10] Update: auto fix bcs-webconsole lint --- .github/workflows/lint.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index aa5fcbc3bd..69ec2929a0 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -19,7 +19,7 @@ jobs: uses: golangci/golangci-lint-action@v3 with: version: v1.54.2 - args: --timeout=30m --issues-exit-code=0 --out-format=colored-line-number + args: --timeout=30m --issues-exit-code=0 working-directory: bcs-services/bcs-webconsole bcs-monitor: name: bcs-monitor @@ -39,7 +39,7 @@ jobs: uses: golangci/golangci-lint-action@v3 with: version: v1.54.2 - args: --timeout=30m --issues-exit-code=0 --out-format=colored-line-number + args: --timeout=30m --issues-exit-code=0 working-directory: bcs-services/bcs-monitor bcs-bscp: name: bcs-bscp @@ -59,5 +59,5 @@ jobs: uses: golangci/golangci-lint-action@v3 with: version: v1.54.2 - args: --timeout=30m --issues-exit-code=0 --out-format=colored-line-number + args: --timeout=30m --issues-exit-code=0 working-directory: bcs-services/bcs-bscp