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

build: update Go 1.23 #5036

Open
wants to merge 6 commits into
base: devel
Choose a base branch
from

Conversation

iPraveenParihar
Copy link
Contributor

Describe what this PR does

-build: update Go 1.23

Fixes: #5015

Checklist:

  • Commit Message Formatting: Commit titles and messages follow guidelines in the developer guide.
  • Reviewed the developer guide on Submitting a Pull Request
  • Pending release notes updated with breaking and/or notable changes for the next major release.
  • Documentation has been updated, if necessary.
  • Unit tests have been added, if necessary.
  • Integration tests have been added, if necessary.

Show available bot commands

These commands are normally not required, but in case of issues, leave any of
the following bot commands in an otherwise empty comment in this PR:

  • /retest ci/centos/<job-name>: retest the <job-name> after unrelated
    failure (please report the failure too!)

@iPraveenParihar iPraveenParihar self-assigned this Dec 19, 2024
@mergify mergify bot added the component/build Issues and PRs related to compiling Ceph-CSI label Dec 19, 2024
@iPraveenParihar
Copy link
Contributor Author

golangci-lint gettting killed unexpectedly

level=info msg="[linters_context] importas settings found, but no aliases listed. List aliases under alias: key."
./scripts/lint-go.sh: line 9:    17 Killed                  golangci-lint --config=scripts/golangci.yml run ./... -v
make: *** [Makefile:124: go-lint] Error 137

trying with latest version of golangci-lint

Signed-off-by: Praveen M <[email protected]>
@iPraveenParihar
Copy link
Contributor Author

iPraveenParihar commented Dec 19, 2024

updating golangci-lint to latest produces many lint issues - log

updating golangci-lint to minimum version supported by Go v1.23

@black-dragon74
Copy link
Member

updating golangci-lint to latest produces many lint issues - log

Magic number used be ignored earlier.

Static check for arg order is likely something added in the new releases of golangci-lint? If so we can exclude them in scripts/golangci.yml.in or maybe fix those specific issues?

@iPraveenParihar
Copy link
Contributor Author

Okay, I'll ignore the magic number for now. Also, there are other lint failures - gosec, staticcheck, govet
I'll fix them

Thanks for taking a look.

@iPraveenParihar
Copy link
Contributor Author

Magic number used be ignored earlier.

Actually the gomnd is replaced with mnd

@nixpanic
Copy link
Member

Fixes like you have in rbd: fix arguments have the wrong order (staticcheck) can also be sent as separate PR to make reviewing of this one easier. You can leave the error/warning from golangci-lint in the PR description.

@iPraveenParihar
Copy link
Contributor Author

Fixes like you have in rbd: fix arguments have the wrong order (staticcheck) can also be sent as separate PR to make reviewing of this one easier. You can leave the error/warning from golangci-lint in the PR description.

Sounds good to me, I'll open up a new PR to fix the golangci-lint errors.
Thanks!

@iPraveenParihar iPraveenParihar force-pushed the build/go-1.23 branch 2 times, most recently from f175130 to 5ba7034 Compare December 20, 2024 14:27
@iPraveenParihar
Copy link
Contributor Author

Hey @nixpanic, I tried to include the golangci-lint changes in this PR.
Now I see gosec lint errors - G115: integer overflow conversion , can we disable this rule for now and address later? Also, there seems to be an false positive reporting - securego/gosec#1212

@nixpanic
Copy link
Member

@iPraveenParihar , disabling only gosec rule G115 should be possible too? If you do that, make sure to open an issue for it so we can track it down later once gosec reports fewer false negatives.

@iPraveenParihar
Copy link
Contributor Author

@iPraveenParihar , disabling only gosec rule G115 should be possible too? If you do that, make sure to open an issue for it so we can track it down later once gosec reports fewer false negatives.

Created a issue for it - #5040

- gomnd is replaced by mnd in v1.58.0
- gosec exlcude G115 rule (Potential integer overflow when converting between integer types)
- disable new iface linter
- disable new recvcheck linter

Signed-off-by: Praveen M <[email protected]>
@iPraveenParihar iPraveenParihar marked this pull request as ready for review December 20, 2024 17:03
@@ -1580,10 +1580,10 @@ func k8sVersionGreaterEquals(c kubernetes.Interface, major, minor int) bool {
// return value.
}

maj := strconv.Itoa(major)
min := strconv.Itoa(minor)
_maj := strconv.Itoa(major)
Copy link
Member

Choose a reason for hiding this comment

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

This is rather ugly, not only because of the added _, also because comparing versions as a string.

Maybe it makes more sense to convert v.Major and v.Minor to integers?

@@ -768,7 +768,7 @@ var _ = Describe(cephfsType, func() {
for i := range deplPods {
err = ensureStatSucceeds(deplPods[i].Name)
if err != nil {
framework.Failf(err.Error())
framework.Failf("%v", err.Error())
Copy link
Member

Choose a reason for hiding this comment

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

a bit more context in the errors would help here.

framework.Failf("ensureStatSucceeds failed for pod %q: %v", deplPods[i].Name, err.Error())

Something like that really helps the person receiving the error a lot. These things can/should be done everywhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/build Issues and PRs related to compiling Ceph-CSI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

update the dependency to 1.32
3 participants