Skip to content

Fix golangci-lint errors#1068

Merged
knative-prow-robot merged 1 commit intoknative:masterfrom
daisy-ycguo:lint
Oct 19, 2020
Merged

Fix golangci-lint errors#1068
knative-prow-robot merged 1 commit intoknative:masterfrom
daisy-ycguo:lint

Conversation

@daisy-ycguo
Copy link
Copy Markdown

Description

The output of golangci-lint includes below errors:

$ golangci-lint run --out-format=github-actions
::error file=pkg/kn/commands/channel/list_types_test.go,line=156,col=2::ineffectual assignment to `output` (ineffassign)
::error file=pkg/kn/commands/channel/list_types_test.go,line=167,col=2::ineffectual assignment to `output` (ineffassign)
::error file=pkg/kn/commands/channel/list_types_test.go,line=181,col=2::ineffectual assignment to `output` (ineffassign)
::error file=pkg/kn/commands/subscription/flags.go,line=113,col=2::Consider preallocating `others` (prealloc)
::error file=pkg/messaging/v1beta1/subscriptions_client_mock.go,line=30,col=2::`namespace` is unused (structcheck)
::error file=pkg/dynamic/client_test.go,line=346,col=9::composites: `k8s.io/apimachinery/pkg/runtime/schema.GroupVersion` composite literal uses unkeyed fields (govet)
::error file=pkg/dynamic/client_test.go,line=353,col=45::composites: `k8s.io/apimachinery/pkg/runtime/schema.GroupVersionKind` composite literal uses unkeyed fields (govet)
::error file=pkg/dynamic/client_test.go,line=360,col=45::composites: `k8s.io/apimachinery/pkg/runtime/schema.GroupVersionKind` composite literal uses unkeyed fields (govet)
::error file=pkg/kn/flags/channel_types.go,line=122,col=2::unreachable: unreachable code (govet)
::error file=pkg/dynamic/client_test.go,line=352,col=25::SA5011: possible nil pointer dereference (staticcheck)
::error file=pkg/dynamic/client_test.go,line=359,col=25::SA5011: possible nil pointer dereference (staticcheck)
::error file=pkg/kn/commands/channel/list_types_test.go,line=111,col=30::SA5011: possible nil pointer dereference (staticcheck)

This will affect precheck of every PRs and will cause a Code Style / Lint (pull_request) Failing after 55s — Lint.

This PR is to fix those errors in order to pass the Lint check.

Changes

  • Fixes Lint check errors

@google-cla google-cla bot added the cla: yes Indicates the PR's author has signed the CLA. label Oct 19, 2020
Copy link
Copy Markdown
Contributor

@knative-prow-robot knative-prow-robot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@daisy-ycguo: 0 warnings.

Details

In response to this:

Description

The output of golangci-lint includes below errors:

$ golangci-lint run --out-format=github-actions
::error file=pkg/kn/commands/channel/list_types_test.go,line=156,col=2::ineffectual assignment to `output` (ineffassign)
::error file=pkg/kn/commands/channel/list_types_test.go,line=167,col=2::ineffectual assignment to `output` (ineffassign)
::error file=pkg/kn/commands/channel/list_types_test.go,line=181,col=2::ineffectual assignment to `output` (ineffassign)
::error file=pkg/kn/commands/subscription/flags.go,line=113,col=2::Consider preallocating `others` (prealloc)
::error file=pkg/messaging/v1beta1/subscriptions_client_mock.go,line=30,col=2::`namespace` is unused (structcheck)
::error file=pkg/dynamic/client_test.go,line=346,col=9::composites: `k8s.io/apimachinery/pkg/runtime/schema.GroupVersion` composite literal uses unkeyed fields (govet)
::error file=pkg/dynamic/client_test.go,line=353,col=45::composites: `k8s.io/apimachinery/pkg/runtime/schema.GroupVersionKind` composite literal uses unkeyed fields (govet)
::error file=pkg/dynamic/client_test.go,line=360,col=45::composites: `k8s.io/apimachinery/pkg/runtime/schema.GroupVersionKind` composite literal uses unkeyed fields (govet)
::error file=pkg/kn/flags/channel_types.go,line=122,col=2::unreachable: unreachable code (govet)
::error file=pkg/dynamic/client_test.go,line=352,col=25::SA5011: possible nil pointer dereference (staticcheck)
::error file=pkg/dynamic/client_test.go,line=359,col=25::SA5011: possible nil pointer dereference (staticcheck)
::error file=pkg/kn/commands/channel/list_types_test.go,line=111,col=30::SA5011: possible nil pointer dereference (staticcheck)

This will affect precheck of every PRs and will cause a Code Style / Lint (pull_request) Failing after 55s — Lint.

This PR is to fix those errors in order to pass the Lint check.

Changes

  • Fixes Lint check errors

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@knative-prow-robot knative-prow-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 19, 2020
@knative-metrics-robot
Copy link
Copy Markdown

The following is the coverage report on the affected files.
Say /test pull-knative-client-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/kn/flags/channel_types.go 91.7% 95.7% 4.0

@daisy-ycguo
Copy link
Copy Markdown
Author

@rhuss @maximilien This PR is to fix the link test failures: https://github.com/knative/client/pull/1024/checks?check_run_id=1258727196 . Please help to review. Thank you.

Copy link
Copy Markdown
Contributor

@navidshaikh navidshaikh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

Thanks @daisy-ycguo !

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 19, 2020
@knative-prow-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: daisy-ycguo, navidshaikh

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 19, 2020
@knative-prow-robot knative-prow-robot merged commit 25b537b into knative:master Oct 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants