Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added govet to our Golang linter suite #5871

Merged
merged 1 commit into from
Dec 16, 2022
Merged

Added govet to our Golang linter suite #5871

merged 1 commit into from
Dec 16, 2022

Conversation

bendory
Copy link
Contributor

@bendory bendory commented Dec 13, 2022

Changes

This PR adds govet to our Golang linter suite. There are no expected functional changes
in this PR.

Also:

  • fixed two minor issues uncovered by go vet:
    • cmd/nop/main.go:30:3: misuse of unbuffered os.Signal channel as argument to signal.Notify
    • internal/sidecarlogresults/sidecarlogresults_test.go:46:4: call to (*T).Fatal from a non-test goroutine
  • fixed unkeyed composite literal fields in various _test.go files.

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • [N/A] Has Docs included if any changes are user facing
  • [N/A] Has Tests included if any functionality added or changed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including
    functionality, content, code)
  • Has a kind label. You can add one by adding a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • [N/A] Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings)
  • [N/A] Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

NONE

@tekton-robot tekton-robot added the release-note-none Denotes a PR that doesnt merit a release note. label Dec 13, 2022
@tekton-robot tekton-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Dec 13, 2022
@bendory
Copy link
Contributor Author

bendory commented Dec 13, 2022

/kind cleanup

@tekton-robot tekton-robot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Dec 13, 2022
@afrittoli
Copy link
Member

Thanks @bendory - running go vet sounds good to me.

I'm unsure if we should have a dedicated CI job for it though, since we already run other go tools in the pull-tekton-pipeline-build-tests job, and we plan to migrate that to Tekton.

That said since GitHub actions do not add cost to our infra, I don't mind having the extra job there for now - @vdemeester @abayer wdyt?

@bendory
Copy link
Contributor Author

bendory commented Dec 13, 2022

Thanks @bendory - running go vet sounds good to me.

I'm unsure if we should have a dedicated CI job for it though, since we already run other go tools in the pull-tekton-pipeline-build-tests job, and we plan to migrate that to Tekton.

That said since GitHub actions do not add cost to our infra, I don't mind having the extra job there for now - @vdemeester @abayer wdyt?

I also wondered if GHA or "tekton-on-tekton" is the right answer -- and concluded that GHA is quick and easy for now to keep us in integrity until we get to tekton-on-tekton later.

- name: Run vet
run: |
# Use in-place vendored dependencies.
# For now, ignore unkeyed composite fields in structs.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: I've already got a follow-on branch that takes care of the unkeyed composite fields. I'm holding that back as a separate PR to keep this PR small.

@dibyom
Copy link
Member

dibyom commented Dec 13, 2022

@bendory could we add govet to the list of linters we already run as part of the build tests: https://github.com/tektoncd/pipeline/blob/main/.golangci.yml#L15

@bendory
Copy link
Contributor Author

bendory commented Dec 13, 2022

@bendory could we add govet to the list of linters we already run as part of the build tests: https://github.com/tektoncd/pipeline/blob/main/.golangci.yml#L15

🤔

  • Why are gofmt and errcheck disabled?
  • We don't have govet disabled, so I assume it runs, but as this PR indicates, we have existing govet errors. What's happening there?

@JeromeJu
Copy link
Member

JeromeJu commented Dec 14, 2022

https://github.com/tektoncd/pipeline/blob/main/.golangci.yml#L15

Might be mistaken but I wonder if we shall add govet to the list at https://github.com/tektoncd/pipeline/blob/main/.golangci.yml#L17-L28 to not disable the test if that's what @dibyom pointed.

@bendory
Copy link
Contributor Author

bendory commented Dec 14, 2022

https://github.com/tektoncd/pipeline/blob/main/.golangci.yml#L15

Might be mistaken but I wonder if we shall add govet to the list at https://github.com/tektoncd/pipeline/blob/main/.golangci.yml#L17-L28 to not disable the test if that's what @dibyom pointed.

OIC, I misread the configuration -- it leads by disabling everything.

OK, update to this PR coming.

/hold

@tekton-robot tekton-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 14, 2022
@bendory
Copy link
Contributor Author

bendory commented Dec 14, 2022

/unhold

@tekton-robot tekton-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 14, 2022
Copy link
Member

@JeromeJu JeromeJu left a comment

Choose a reason for hiding this comment

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

Thanks @bendory
LGTM, just that we might want to update the PR comment and title once the build test passed.

@bendory bendory changed the title Added govet as a GitHub Action. Added govet, unused, and whitespace linters to our Golang linter suite Dec 14, 2022
@bendory
Copy link
Contributor Author

bendory commented Dec 14, 2022

Thanks @bendory LGTM, just that we might want to update the PR comment and title once the build test passed.

Done!

@bendory
Copy link
Contributor Author

bendory commented Dec 14, 2022

I've already got code changes ready for the composite literal issues, I'm going to add those here and also addressed the unused findings.

@tekton-robot tekton-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Dec 14, 2022
@bendory bendory changed the title Added govet, unused, and whitespace linters to our Golang linter suite Added govet to our Golang linter suite Dec 14, 2022
@bendory
Copy link
Contributor Author

bendory commented Dec 14, 2022

I've already got code changes ready for the composite literal issues, I'm going to add those here and also addressed the unused findings.

I decided to split out the unused and whitespace additions to separate PRs in order to keep this PR small.

@bendory
Copy link
Contributor Author

bendory commented Dec 14, 2022

/retest pull-tekton-pipeline-build-tests

@tekton-robot
Copy link
Collaborator

@bendory: The /retest command does not accept any targets.
The following commands are available to trigger required jobs:

  • /test pull-tekton-pipeline-alpha-integration-tests
  • /test pull-tekton-pipeline-build-tests
  • /test pull-tekton-pipeline-integration-tests
  • /test tekton-pipeline-unit-tests

The following commands are available to trigger optional jobs:

  • /test pull-tekton-pipeline-go-coverage

Use /test all to run all jobs.

In response to this:

/retest pull-tekton-pipeline-build-tests

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.

@bendory
Copy link
Contributor Author

bendory commented Dec 14, 2022

/test pull-tekton-pipeline-build-tests

@bendory
Copy link
Contributor Author

bendory commented Dec 14, 2022

/retest

Also:
- fixed two minor issues uncovered by `go vet`:
  - cmd/nop/main.go:30:3: misuse of unbuffered os.Signal channel as argument to signal.Notify
  - internal/sidecarlogresults/sidecarlogresults_test.go:46:4: call to (*T).Fatal from a non-test goroutine
- fixed unkeyed composite literal fields in various _test.go files
.golangci.yml Show resolved Hide resolved
.golangci.yml Show resolved Hide resolved
@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 15, 2022
@bendory
Copy link
Contributor Author

bendory commented Dec 15, 2022

Thanks @bendory - running go vet sounds good to me.

I'm unsure if we should have a dedicated CI job for it though, since we already run other go tools in the pull-tekton-pipeline-build-tests job, and we plan to migrate that to Tekton.

That said since GitHub actions do not add cost to our infra, I don't mind having the extra job there for now - @vdemeester @abayer wdyt?

Note: moved this into our existing dedicated CI job.

@bendory
Copy link
Contributor Author

bendory commented Dec 15, 2022

/assign vdemeester

Copy link
Member

@afrittoli afrittoli left a comment

Choose a reason for hiding this comment

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

Thank you!
/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Dec 16, 2022
@abayer
Copy link
Contributor

abayer commented Dec 16, 2022

/approve
fwiw. =)

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: abayer, JeromeJu, jerop

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

The pull request process is described here

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

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. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesnt merit a release note. 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.

8 participants