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

Add Exportloopref linter and fix errors #548

Merged
merged 2 commits into from
Jan 30, 2024

Conversation

Hoega
Copy link
Contributor

@Hoega Hoega commented Jan 11, 2024

What type of PR is this?

/kind bug

What this PR does / why we need it

Avoid the "loop variable trap" as described in exportloopref

Which issue(s) this PR fixes

Fixes #541

Special notes for your reviewer

Fix the following errors returned by golangci-lint run -E exportloopref :

apiserver/pkg/dataset/dataset.go:57:27: exporting a pointer for the loop variable cond (exportloopref)
                                ds.UpdateTimestamp = &cond.LastTransitionTime.Time
                                                      ^
apiserver/pkg/ray/raycluster.go:47:20: exporting a pointer for the loop variable cluster (exportloopref)
                        HeadAddress:   &cluster.HeadAddress,
                                        ^
apiserver/pkg/ray/raycluster.go:48:20: exporting a pointer for the loop variable cluster (exportloopref)
                        DashboardHost: &cluster.DashboardHost,
                                        ^
apiserver/pkg/ray/raycluster.go:49:20: exporting a pointer for the loop variable cluster (exportloopref)
                        PythonVersion: &cluster.PythonVersion,
                                        ^
apiserver/pkg/versioneddataset/versioned_dataset.go:87:28: exporting a pointer for the loop variable cond (exportloopref)
                                vds.UpdateTimestamp = &cond.LastTransitionTime.Time

@Hoega Hoega force-pushed the exportloopref-linter branch 2 times, most recently from fd61b04 to 8aa43d9 Compare January 11, 2024 16:04
@Hoega Hoega marked this pull request as ready for review January 12, 2024 08:01
Copy link
Collaborator

@Abirdcfly Abirdcfly left a comment

Choose a reason for hiding this comment

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

we can use rebase merge for this pull request, then we will get only one commit in git log.

@nkwangleiGIT nkwangleiGIT merged commit 7f60cc0 into kubeagi:main Jan 30, 2024
9 checks passed
@Hoega Hoega deleted the exportloopref-linter branch January 30, 2024 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add golangcli-lint check for pointers to enclosing loop variables
3 participants