From ba6f455eb9fc9feb62b84eaacd153e0e86c284aa Mon Sep 17 00:00:00 2001 From: kezhenxu94 Date: Thu, 20 Mar 2025 11:27:41 +0800 Subject: [PATCH 1/7] Bump up a bunch of dependencies --- .github/workflows/CI.yaml | 36 +++++++++++++-------------- .github/workflows/publish-docker.yaml | 4 +-- Dockerfile | 2 +- go.mod | 2 +- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index 1b245264..149e8d1e 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -36,7 +36,7 @@ jobs: if: (github.event_name == 'schedule' && github.repository == 'apache/skywalking-cli') || (github.event_name != 'schedule') runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Check License Header uses: apache/skywalking-eyes@5dfa68f93380a5e57259faaf95088b7f133b5778 @@ -44,9 +44,9 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Setup Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: - go-version: "1.18" + go-version: "1.24" - name: Check Dependencies License run: make dependency-license @@ -59,7 +59,7 @@ jobs: outputs: cli: ${{ steps.filter-cli.outputs.any_modified }} steps: - - uses: actions/checkout@v3 # required for push event + - uses: actions/checkout@v4 # required for push event with: fetch-depth: 0 - name: Check for CLI source changes @@ -83,11 +83,11 @@ jobs: ( always() && ! cancelled() ) && ((github.event_name == 'schedule' && github.repository == 'apache/skywalking-cli') || needs.changes.outputs.cli == 'true') steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v5 - name: Set up Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: - go-version: 1.18 + go-version: 1.24 - name: golangci-lint uses: golangci/golangci-lint-action@v6 @@ -104,16 +104,16 @@ jobs: ( always() && ! cancelled() ) && ((github.event_name == 'schedule' && github.repository == 'apache/skywalking-cli') || needs.changes.outputs.cli == 'true') steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: - go-version: 1.18 + go-version: 1.24 - name: Check code generation run: make check-codegen - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 if: failure() with: name: check-diff @@ -138,11 +138,11 @@ jobs: oap: - a65a6e0ff2ef9c716131b36172399076307c35f1 # Feb 27th, 2024 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: - go-version: 1.18 + go-version: 1.24 - name: Test commands uses: apache/skywalking-infra-e2e@cf589b4a0b9f8e6f436f78e9cfd94a1ee5494180 @@ -160,11 +160,11 @@ jobs: ( always() && ! cancelled() ) && ((github.event_name == 'schedule' && github.repository == 'apache/skywalking-cli') || needs.changes.outputs.cli == 'true') steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: setup go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: - go-version: '1.18' + go-version: '1.24' - name: run unit tests and report coverage working-directory: ./ @@ -196,4 +196,4 @@ jobs: [[ ${build} == 'success' ]] || [[ ${execute} != 'true' && ${build} == 'skipped' ]] || exit -3; [[ ${commandTests} == 'success' ]] || [[ ${execute} != 'true' && ${commandTests} == 'skipped' ]] || exit -4; [[ ${unitTests} == 'success' ]] || [[ ${execute} != 'true' && ${unitTests} == 'skipped' ]] || exit -5; - exit 0; \ No newline at end of file + exit 0; diff --git a/.github/workflows/publish-docker.yaml b/.github/workflows/publish-docker.yaml index 1ebca1cf..dbc761bc 100644 --- a/.github/workflows/publish-docker.yaml +++ b/.github/workflows/publish-docker.yaml @@ -43,7 +43,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: 1.18 + go-version: 1.24 - name: Log in to the Container registry uses: docker/login-action@v1.10.0 with: @@ -51,4 +51,4 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push docker images - run: make docker.push || make docker.push \ No newline at end of file + run: make docker.push || make docker.push diff --git a/Dockerfile b/Dockerfile index cd9a8bc2..2bd22135 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM golang:1.18 AS builder +FROM golang:1.24 AS builder ARG VERSION diff --git a/go.mod b/go.mod index af7daee4..caff7d79 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/apache/skywalking-cli -go 1.18 +go 1.24 require ( github.com/apache/skywalking-swck/operator v0.0.0-20220815142653-ed08076b7433 From 7a62b28f1c9510f9dfbb4c329690ebba596352ce Mon Sep 17 00:00:00 2001 From: kezhenxu94 Date: Thu, 20 Mar 2025 19:45:59 +0800 Subject: [PATCH 2/7] remove sh*t --- .github/workflows/CI.yaml | 45 +++++++-------------------------------- 1 file changed, 8 insertions(+), 37 deletions(-) diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index 149e8d1e..bca6b7b0 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -51,37 +51,12 @@ jobs: - name: Check Dependencies License run: make dependency-license - - changes: - runs-on: ubuntu-latest - if: github.event_name != 'schedule' - timeout-minutes: 10 - outputs: - cli: ${{ steps.filter-cli.outputs.any_modified }} - steps: - - uses: actions/checkout@v4 # required for push event - with: - fetch-depth: 0 - - name: Check for CLI source changes - id: filter-cli - # The GHA version is pinned by infra - uses: tj-actions/changed-files@v43.0.0 - with: - files_from_source_file: .github/file-filters.txt - - name: List all modified files - if: steps.filter-cli.outputs.any_modified == 'true' - run: | - echo "Files that have changed or modified:" - echo "Filter-cli: ${{ steps.filter-cli.outputs.all_changed_and_modified_files }}" - - golang-lint: name: Golang Lint runs-on: ubuntu-latest - needs: [changes] if: | ( always() && ! cancelled() ) && - ((github.event_name == 'schedule' && github.repository == 'apache/skywalking-cli') || needs.changes.outputs.cli == 'true') + ((github.event_name == 'schedule' && github.repository == 'apache/skywalking-cli')) steps: - uses: actions/checkout@v5 - name: Set up Go @@ -98,11 +73,10 @@ jobs: build: name: Build - needs: [changes] runs-on: ubuntu-latest if: | ( always() && ! cancelled() ) && - ((github.event_name == 'schedule' && github.repository == 'apache/skywalking-cli') || needs.changes.outputs.cli == 'true') + ((github.event_name == 'schedule' && github.repository == 'apache/skywalking-cli')) steps: - uses: actions/checkout@v4 - name: Set up Go @@ -129,10 +103,9 @@ jobs: command-tests: name: Command Tests runs-on: ubuntu-latest - needs: [changes] if: | ( always() && ! cancelled() ) && - ((github.event_name == 'schedule' && github.repository == 'apache/skywalking-cli') || needs.changes.outputs.cli == 'true') + ((github.event_name == 'schedule' && github.repository == 'apache/skywalking-cli')) strategy: matrix: oap: @@ -155,10 +128,9 @@ jobs: unit-tests: name: Unit Tests runs-on: ubuntu-latest - needs: [changes] if: | ( always() && ! cancelled() ) && - ((github.event_name == 'schedule' && github.repository == 'apache/skywalking-cli') || needs.changes.outputs.cli == 'true') + ((github.event_name == 'schedule' && github.repository == 'apache/skywalking-cli')) steps: - uses: actions/checkout@v4 - name: setup go @@ -185,15 +157,14 @@ jobs: steps: - name: Merge Requirement run: | - execute=${{ needs.changes.outputs.cli }} checkLicense=${{ needs.check-license.result }} [[ ${checkLicense} == 'success' ]] || exit -1; golangLint=${{ needs.golang-lint.result }}; build=${{ needs.build.result }}; commandTests=${{ needs.command-tests.result }}; unitTests=${{ needs.unit-tests.result }}; - [[ ${golangLint} == 'success' ]] || [[ ${execute} != 'true' && ${golangLint} == 'skipped' ]] || exit -2; - [[ ${build} == 'success' ]] || [[ ${execute} != 'true' && ${build} == 'skipped' ]] || exit -3; - [[ ${commandTests} == 'success' ]] || [[ ${execute} != 'true' && ${commandTests} == 'skipped' ]] || exit -4; - [[ ${unitTests} == 'success' ]] || [[ ${execute} != 'true' && ${unitTests} == 'skipped' ]] || exit -5; + [[ ${golangLint} == 'success' ]] || [[ ${golangLint} == 'skipped' ]] || exit -2; + [[ ${build} == 'success' ]] || [[ ${build} == 'skipped' ]] || exit -3; + [[ ${commandTests} == 'success' ]] || [[ ${commandTests} == 'skipped' ]] || exit -4; + [[ ${unitTests} == 'success' ]] || [[ ${unitTests} == 'skipped' ]] || exit -5; exit 0; From 8613d8c027c85ef9e4f60533acf77487a2bf99e2 Mon Sep 17 00:00:00 2001 From: kezhenxu94 Date: Thu, 20 Mar 2025 19:48:20 +0800 Subject: [PATCH 3/7] x --- .github/workflows/CI.yaml | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index bca6b7b0..9efcf71b 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -33,7 +33,7 @@ concurrency: jobs: check-license: name: License header - if: (github.event_name == 'schedule' && github.repository == 'apache/skywalking-cli') || (github.event_name != 'schedule') + if: github.repository == 'apache/skywalking-cli' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -54,9 +54,7 @@ jobs: golang-lint: name: Golang Lint runs-on: ubuntu-latest - if: | - ( always() && ! cancelled() ) && - ((github.event_name == 'schedule' && github.repository == 'apache/skywalking-cli')) + if: github.repository == 'apache/skywalking-cli' steps: - uses: actions/checkout@v5 - name: Set up Go @@ -74,9 +72,7 @@ jobs: build: name: Build runs-on: ubuntu-latest - if: | - ( always() && ! cancelled() ) && - ((github.event_name == 'schedule' && github.repository == 'apache/skywalking-cli')) + if: github.repository == 'apache/skywalking-cli' steps: - uses: actions/checkout@v4 - name: Set up Go @@ -103,9 +99,7 @@ jobs: command-tests: name: Command Tests runs-on: ubuntu-latest - if: | - ( always() && ! cancelled() ) && - ((github.event_name == 'schedule' && github.repository == 'apache/skywalking-cli')) + if: github.repository == 'apache/skywalking-cli' strategy: matrix: oap: @@ -128,9 +122,7 @@ jobs: unit-tests: name: Unit Tests runs-on: ubuntu-latest - if: | - ( always() && ! cancelled() ) && - ((github.event_name == 'schedule' && github.repository == 'apache/skywalking-cli')) + if: github.repository == 'apache/skywalking-cli' steps: - uses: actions/checkout@v4 - name: setup go @@ -158,13 +150,13 @@ jobs: - name: Merge Requirement run: | checkLicense=${{ needs.check-license.result }} - [[ ${checkLicense} == 'success' ]] || exit -1; + [[ ${checkLicense} == 'success' ]] || exit 1; golangLint=${{ needs.golang-lint.result }}; build=${{ needs.build.result }}; commandTests=${{ needs.command-tests.result }}; unitTests=${{ needs.unit-tests.result }}; - [[ ${golangLint} == 'success' ]] || [[ ${golangLint} == 'skipped' ]] || exit -2; - [[ ${build} == 'success' ]] || [[ ${build} == 'skipped' ]] || exit -3; - [[ ${commandTests} == 'success' ]] || [[ ${commandTests} == 'skipped' ]] || exit -4; - [[ ${unitTests} == 'success' ]] || [[ ${unitTests} == 'skipped' ]] || exit -5; + [[ ${golangLint} == 'success' ]] || [[ ${golangLint} == 'skipped' ]] || exit 2; + [[ ${build} == 'success' ]] || [[ ${build} == 'skipped' ]] || exit 3; + [[ ${commandTests} == 'success' ]] || [[ ${commandTests} == 'skipped' ]] || exit 4; + [[ ${unitTests} == 'success' ]] || [[ ${unitTests} == 'skipped' ]] || exit 5; exit 0; From f426f249e387fee11b98608d26af29905ecb5c8d Mon Sep 17 00:00:00 2001 From: kezhenxu94 Date: Thu, 20 Mar 2025 19:48:59 +0800 Subject: [PATCH 4/7] x --- .github/workflows/CI.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index 9efcf71b..fae25dd7 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -56,7 +56,7 @@ jobs: runs-on: ubuntu-latest if: github.repository == 'apache/skywalking-cli' steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v4 - name: Set up Go uses: actions/setup-go@v5 with: From be1ec028520c36a411d6c4a23bbfbf9c15449e8b Mon Sep 17 00:00:00 2001 From: kezhenxu94 Date: Thu, 20 Mar 2025 20:17:20 +0800 Subject: [PATCH 5/7] x --- .github/workflows/CI.yaml | 5 ++++- .golangci.yml | 15 ++----------- Makefile | 2 +- internal/commands/completion/bash.go | 2 +- internal/commands/completion/fish.go | 2 +- internal/commands/completion/powershell.go | 2 +- internal/commands/completion/zsh.go | 2 +- internal/commands/interceptor/duration.go | 12 +++++----- .../profiling/asyncprofiler/create.go | 4 ++-- pkg/heatmap/axes/axes.go | 6 ++--- pkg/heatmap/axes/label.go | 8 +++---- pkg/heatmap/heatmap.go | 22 +++++++++---------- pkg/util/commandNotFound.go | 15 ++----------- test/cases/basic/test.yaml | 2 -- 14 files changed, 39 insertions(+), 60 deletions(-) diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index fae25dd7..d36d5004 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -65,7 +65,7 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v6 with: - version: v1.50.0 + version: v1.64.0 args: --timeout 5m @@ -111,6 +111,9 @@ jobs: with: go-version: 1.24 + - name: Install swctl + run: make install DESTDIR=/usr/local/bin + - name: Test commands uses: apache/skywalking-infra-e2e@cf589b4a0b9f8e6f436f78e9cfd94a1ee5494180 env: diff --git a/.golangci.yml b/.golangci.yml index c9af1f94..82a287ff 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -16,25 +16,15 @@ linters-settings: govet: - check-shadowing: true - golint: - min-confidence: 0 + enable: + - shadow gocyclo: min-complexity: 15 - maligned: - suggest-new: true dupl: threshold: 200 goconst: min-len: 2 min-occurrences: 2 - depguard: - list-type: blacklist - packages: - - - include-go-root: true - packages-with-error-messages: - fmt: "logging is allowed only by logutils.Log" misspell: locale: US lll: @@ -60,7 +50,6 @@ linters-settings: linters: enable: - bodyclose - - depguard - dogsled - dupl - errcheck diff --git a/Makefile b/Makefile index bd3b9b6c..0cbf198e 100644 --- a/Makefile +++ b/Makefile @@ -58,7 +58,7 @@ deps: @$(GO_GET) -v -t -d ./... $(GO_LINT): - @$(GO_LINT) version > /dev/null 2>&1 || curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GO_PATH)/bin v1.50.0 + @$(GO_LINT) version > /dev/null 2>&1 || go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.64.0 $(LICENSE_EYE): @$(LICENSE_EYE) --version > /dev/null 2>&1 || go install github.com/apache/skywalking-eyes/cmd/license-eye@d38fe05 diff --git a/internal/commands/completion/bash.go b/internal/commands/completion/bash.go index 78ec3450..f8e44d8d 100644 --- a/internal/commands/completion/bash.go +++ b/internal/commands/completion/bash.go @@ -28,7 +28,7 @@ var bashCommand = &cli.Command{ Aliases: []string{"b"}, Usage: "Output shell completion code for bash", ArgsUsage: "[parameters...]", - Action: func(ctx *cli.Context) error { + Action: func(_ *cli.Context) error { fmt.Print(bashScript) return nil }, diff --git a/internal/commands/completion/fish.go b/internal/commands/completion/fish.go index 53f170b7..aafd7ab8 100644 --- a/internal/commands/completion/fish.go +++ b/internal/commands/completion/fish.go @@ -28,7 +28,7 @@ var fishCommand = &cli.Command{ Aliases: []string{"f"}, Usage: "Output shell completion code for fish", ArgsUsage: "[parameters...]", - Action: func(ctx *cli.Context) error { + Action: func(_ *cli.Context) error { fmt.Print(fishScript) return nil }, diff --git a/internal/commands/completion/powershell.go b/internal/commands/completion/powershell.go index 34234b7c..5aca22c8 100644 --- a/internal/commands/completion/powershell.go +++ b/internal/commands/completion/powershell.go @@ -28,7 +28,7 @@ var powershellCommand = &cli.Command{ Aliases: []string{"p"}, Usage: "Output shell completion code for powershell", ArgsUsage: "[parameters...]", - Action: func(ctx *cli.Context) error { + Action: func(_ *cli.Context) error { fmt.Print(powershellScript) return nil }, diff --git a/internal/commands/completion/zsh.go b/internal/commands/completion/zsh.go index e8505c9f..9d586efd 100644 --- a/internal/commands/completion/zsh.go +++ b/internal/commands/completion/zsh.go @@ -28,7 +28,7 @@ var zshCommand = &cli.Command{ Aliases: []string{"z"}, Usage: "Output shell completion code for zsh", ArgsUsage: "[parameters...]", - Action: func(ctx *cli.Context) error { + Action: func(_ *cli.Context) error { fmt.Print(zshScript) return nil }, diff --git a/internal/commands/interceptor/duration.go b/internal/commands/interceptor/duration.go index 20c1ac5b..5d93c897 100644 --- a/internal/commands/interceptor/duration.go +++ b/internal/commands/interceptor/duration.go @@ -106,7 +106,7 @@ func ParseDuration(start, end string, userStep api.Step) (startTime, endTime tim var err error // both are present - if len(start) > 0 && len(end) > 0 { + if start != "" && end != "" { if userStep, startTime, err = TryParseTime(start, userStep); err != nil { logger.Log.Fatalln("Unsupported time format:", start, err) } @@ -120,12 +120,12 @@ func ParseDuration(start, end string, userStep api.Step) (startTime, endTime tim logger.Log.Fatalln("Unsupported time format:", start, err) } return startTime, startTime.Add(30 * utils.StepDuration[step]), step, utils.EndAbsent - } else { // start is absent - if step, endTime, err = TryParseTime(end, userStep); err != nil { - logger.Log.Fatalln("Unsupported time format:", end, err) - } - return endTime.Add(-30 * utils.StepDuration[step]), endTime, step, utils.StartAbsent } + // start is absent + if step, endTime, err = TryParseTime(end, userStep); err != nil { + logger.Log.Fatalln("Unsupported time format:", end, err) + } + return endTime.Add(-30 * utils.StepDuration[step]), endTime, step, utils.StartAbsent } // AlignPrecision aligns the two time strings to same precision diff --git a/internal/commands/profiling/asyncprofiler/create.go b/internal/commands/profiling/asyncprofiler/create.go index 1d21938c..5df43279 100644 --- a/internal/commands/profiling/asyncprofiler/create.go +++ b/internal/commands/profiling/asyncprofiler/create.go @@ -69,7 +69,7 @@ $ swctl profiling async create --service-name=service-name --duration=60 --event ), Action: func(ctx *cli.Context) error { serviceID := ctx.String("service-id") - instanceIds := strings.Split(ctx.String("instance-id-list"), ",") + instanceIDs := strings.Split(ctx.String("instance-id-list"), ",") duration := ctx.Int("duration") eventTypes := ctx.Generic("events").(*asyncprofiler.ProfilerEventTypeEnumValue).Selected @@ -80,7 +80,7 @@ $ swctl profiling async create --service-name=service-name --duration=60 --event request := &query.AsyncProfilerTaskCreationRequest{ ServiceID: serviceID, - ServiceInstanceIds: instanceIds, + ServiceInstanceIds: instanceIDs, Duration: duration, Events: eventTypes, ExecArgs: execArgs, diff --git a/pkg/heatmap/axes/axes.go b/pkg/heatmap/axes/axes.go index 5354f7c3..f8e82968 100644 --- a/pkg/heatmap/axes/axes.go +++ b/pkg/heatmap/axes/axes.go @@ -44,8 +44,8 @@ type YDetails struct { // RequiredWidth calculates the minimum width required // in order to draw the Y axis and its labels. -func RequiredWidth(max string) int { - return runewidth.StringWidth(max) + AxisWidth +func RequiredWidth(mx string) int { + return runewidth.StringWidth(mx) + AxisWidth } // NewYDetails retrieves details about the Y axis required @@ -100,7 +100,7 @@ type XDetails struct { // plotted. // customLabels are the desired labels for the X axis, these are preferred if // provided. -func NewXDetails(cvsAr image.Rectangle, yEnd image.Point, stringLabels []string, cellWidth int) (*XDetails, error) { +func NewXDetails(_ image.Rectangle, yEnd image.Point, stringLabels []string, cellWidth int) (*XDetails, error) { // The space between the start of the axis and the end of the canvas. // graphWidth := cvsAr.Dx() - yEnd.X - 1 graphWidth := len(stringLabels) * cellWidth diff --git a/pkg/heatmap/axes/label.go b/pkg/heatmap/axes/label.go index e797dae9..0abe33a0 100644 --- a/pkg/heatmap/axes/label.go +++ b/pkg/heatmap/axes/label.go @@ -43,11 +43,11 @@ type Label struct { // Labels are returned with Y coordinates in ascending order. // Y coordinates grow down. func yLabels(graphHeight, labelWidth int, stringLabels []string) ([]*Label, error) { - if min := 2; graphHeight < min { - return nil, fmt.Errorf("cannot place labels on a canvas with height %d, minimum is %d", graphHeight, min) + if mn := 2; graphHeight < mn { + return nil, fmt.Errorf("cannot place labels on a canvas with height %d, minimum is %d", graphHeight, mn) } - if min := 0; labelWidth < min { - return nil, fmt.Errorf("cannot place labels in label area width %d, minimum is %d", labelWidth, min) + if mn := 0; labelWidth < mn { + return nil, fmt.Errorf("cannot place labels in label area width %d, minimum is %d", labelWidth, mn) } var labels []*Label diff --git a/pkg/heatmap/heatmap.go b/pkg/heatmap/heatmap.go index 5c877308..74c9ff0e 100644 --- a/pkg/heatmap/heatmap.go +++ b/pkg/heatmap/heatmap.go @@ -51,12 +51,12 @@ func newColumnValues(values []int64) *columnValues { v := make([]int64, len(values)) copy(v, values) - min, max := minMax(values) + mn, mx := minMax(values) return &columnValues{ values: v, - Min: min, - Max: max, + Min: mn, + Max: mx, } } @@ -159,7 +159,7 @@ func (hp *HeatMap) axesDetails(cvs *canvas.Canvas) (*axes.XDetails, *axes.YDetai // Draw draws the values as HeatMap. // Implements widgetapi.Widget.Draw. -func (hp *HeatMap) Draw(cvs *canvas.Canvas, meta *widgetapi.Meta) error { +func (hp *HeatMap) Draw(cvs *canvas.Canvas, _ *widgetapi.Meta) error { hp.mu.Lock() defer hp.mu.Unlock() @@ -250,12 +250,12 @@ func (hp *HeatMap) minSize() image.Point { } // Keyboard input isn't supported on the SparkLine widget. -func (*HeatMap) Keyboard(k *terminalapi.Keyboard) error { +func (*HeatMap) Keyboard(_ *terminalapi.Keyboard) error { return errors.New("the HeatMap widget doesn't support keyboard events") } // Mouse input isn't supported on the SparkLine widget. -func (*HeatMap) Mouse(m *terminalapi.Mouse) error { +func (*HeatMap) Mouse(_ *terminalapi.Mouse) error { return errors.New("the HeatMap widget doesn't support mouse events") } @@ -280,13 +280,13 @@ func (hp *HeatMap) getBlockColor(value int64) cell.Color { } // minMax returns the min and max values in given integer array. -func minMax(values []int64) (min, max int64) { - min = math.MaxInt64 - max = math.MinInt64 +func minMax(values []int64) (mn, mx int64) { + mn = math.MaxInt64 + mx = math.MinInt64 for _, v := range values { - min = int64(math.Min(float64(min), float64(v))) - max = int64(math.Max(float64(max), float64(v))) + mn = int64(math.Min(float64(mn), float64(v))) + mx = int64(math.Max(float64(mx), float64(v))) } return } diff --git a/pkg/util/commandNotFound.go b/pkg/util/commandNotFound.go index be462bbe..b104dbbc 100644 --- a/pkg/util/commandNotFound.go +++ b/pkg/util/commandNotFound.go @@ -66,10 +66,10 @@ func minEditDistance(word1, word2 string) int { for i := range dp { dp[i] = make([]int, n+1) } - for i := 0; i < m+1; i++ { + for i := range m + 1 { dp[i][0] = i } - for j := 0; j < n+1; j++ { + for j := range n + 1 { dp[0][j] = j } for i := 1; i < m+1; i++ { @@ -83,14 +83,3 @@ func minEditDistance(word1, word2 string) int { } return dp[m][n] } - -// min get The minimum of the args. -func min(args ...int) int { - min := args[0] - for _, item := range args { - if item < min { - min = item - } - } - return min -} diff --git a/test/cases/basic/test.yaml b/test/cases/basic/test.yaml index 78716efd..6214a1ca 100644 --- a/test/cases/basic/test.yaml +++ b/test/cases/basic/test.yaml @@ -22,8 +22,6 @@ setup: steps: - name: install yq command: yq > /dev/null 2>&1 || go install github.com/mikefarah/yq/v4@latest - - name: install swctl - command: make install DESTDIR=/usr/local/bin > /dev/null 2>&1 trigger: action: http From 92c9dadcdb680ed3ae7c2edd6b735a2bb18e98a7 Mon Sep 17 00:00:00 2001 From: kezhenxu94 Date: Thu, 20 Mar 2025 20:18:39 +0800 Subject: [PATCH 6/7] x --- .github/workflows/CI.yaml | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index d36d5004..97ad1508 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -51,24 +51,6 @@ jobs: - name: Check Dependencies License run: make dependency-license - golang-lint: - name: Golang Lint - runs-on: ubuntu-latest - if: github.repository == 'apache/skywalking-cli' - steps: - - uses: actions/checkout@v4 - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: 1.24 - - - name: golangci-lint - uses: golangci/golangci-lint-action@v6 - with: - version: v1.64.0 - args: --timeout 5m - - build: name: Build runs-on: ubuntu-latest @@ -83,6 +65,9 @@ jobs: - name: Check code generation run: make check-codegen + - name: Lint + run: make lint + - uses: actions/upload-artifact@v4 if: failure() with: From ee5f79249984d8b9750af9885fe597c34ac2af56 Mon Sep 17 00:00:00 2001 From: kezhenxu94 Date: Thu, 20 Mar 2025 20:19:49 +0800 Subject: [PATCH 7/7] x --- .github/workflows/CI.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index 97ad1508..f2c0ac5f 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -128,7 +128,6 @@ jobs: name: Required needs: - check-license - - golang-lint - build - command-tests - unit-tests @@ -139,11 +138,9 @@ jobs: run: | checkLicense=${{ needs.check-license.result }} [[ ${checkLicense} == 'success' ]] || exit 1; - golangLint=${{ needs.golang-lint.result }}; build=${{ needs.build.result }}; commandTests=${{ needs.command-tests.result }}; unitTests=${{ needs.unit-tests.result }}; - [[ ${golangLint} == 'success' ]] || [[ ${golangLint} == 'skipped' ]] || exit 2; [[ ${build} == 'success' ]] || [[ ${build} == 'skipped' ]] || exit 3; [[ ${commandTests} == 'success' ]] || [[ ${commandTests} == 'skipped' ]] || exit 4; [[ ${unitTests} == 'success' ]] || [[ ${unitTests} == 'skipped' ]] || exit 5;