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

Fixes CI: makes golangci-lint use Go version from go.mod #2935

Merged

Conversation

m1kola
Copy link
Member

@m1kola m1kola commented Mar 8, 2023

Description of the change:

  • Makes .github/workflows/sanity.yaml use go version from go.mod for runing linter
  • Updates golangci-lint to the version which supports Go 1.19.

Note that I did not update golangci-lint to the latest version as it adds more issues which need extra attention/configuration and not necessary to makeing CI work again (e.g. loopclosure: loop variable tt captured by func literal for tests like this one).

Motivation for the change:

Currently the sanity workflow fails due to Go 1.20 being used. This PR makes sure that we use go version specified in go.mod to run golangci-lint.

Current failure example:

  Running [/home/runner/golangci-lint-1.46.0-linux-amd64/golangci-lint run --out-format=github-actions] in [] ...
  panic: load embedded ruleguard rules: rules/rules.go:13: can't load fmt
  
  goroutine 1 [running]:
  github.com/go-critic/go-critic/checkers.init.22()
  	github.com/go-critic/go-critic@v0.6.3/checkers/embedded_rules.go:47 +0x4b4
  
  Error: golangci-lint exit with code 2
  Ran golangci-lint in 12114ms

Architectural changes:

Testing remarks:

sanity should use go version from go.mod (1.19 at the moment) and should not fail.

Reviewer Checklist

  • Implementation matches the proposed design, or proposal is updated to match implementation
  • Sufficient unit test coverage
  • Sufficient end-to-end test coverage
  • Bug fixes are accompanied by regression test(s)
  • e2e tests and flake fixes are accompanied evidence of flake testing, e.g. executing the test 100(0) times
  • tech debt/todo is accompanied by issue link(s) in comments in the surrounding code
  • Tests are comprehensible, e.g. Ginkgo DSL is being used appropriately
  • Docs updated or added to /doc
  • Commit messages sensible and descriptive
  • Tests marked as [FLAKE] are truly flaky and have an issue
  • Code is properly formatted

@openshift-ci
Copy link

openshift-ci bot commented Mar 8, 2023

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 8, 2023
@m1kola m1kola force-pushed the fix-golangci-lint branch 10 times, most recently from 93fb352 to 08b0092 Compare March 8, 2023 15:56
Signed-off-by: Mikalai Radchuk <mradchuk@redhat.com>
@m1kola m1kola marked this pull request as ready for review March 8, 2023 16:20
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 8, 2023
Copy link
Contributor

@tmshort tmshort left a comment

Choose a reason for hiding this comment

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

Looks good, I was about to do the same...

Comment on lines +238 to +243
//
// affinity:
// nodeAffinity: {}
// podAffinity: {}
// podAntiAffinity: {}
//
Copy link
Contributor

Choose a reason for hiding this comment

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

This is just a whitespace change, what caused it?

Copy link
Member Author

Choose a reason for hiding this comment

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

gofmt was not happy about this comment.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oi!

Copy link
Member Author

Choose a reason for hiding this comment

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

There were some changes in Go 1.19 related to gofmt and doc comments: https://tip.golang.org/doc/go1.19

I don’t know why v2 action with Go 1.19 did not complain about it. My guess is that v2 action was shipping own version of gofmt which was older.

@tmshort
Copy link
Contributor

tmshort commented Mar 8, 2023

/lgtm
/approve

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Mar 8, 2023
@oceanc80
Copy link
Contributor

oceanc80 commented Mar 8, 2023

/approve

1 similar comment
@kevinrizza
Copy link
Member

/approve

@openshift-ci
Copy link

openshift-ci bot commented Mar 8, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kevinrizza, m1kola, oceanc80, tmshort

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 8, 2023
@openshift-merge-robot openshift-merge-robot merged commit 4634317 into operator-framework:master Mar 8, 2023
@m1kola m1kola deleted the fix-golangci-lint branch March 8, 2023 17:16
@m1kola m1kola mentioned this pull request Mar 8, 2023
11 tasks
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. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants