Merge pull request #135219 from skitt/valswap

Enforce Golang a, b = b, a swaps
This commit is contained in:
Kubernetes Prow Robot 2025-12-17 19:59:46 -08:00 committed by GitHub
commit 1c0eb534ca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 2 additions and 8 deletions

View file

@ -443,7 +443,6 @@ linters:
- typeSwitchVar
- underef
- unslice
- valSwap
revive:
# Only these rules are enabled.
rules:

View file

@ -253,7 +253,6 @@ linters:
- typeSwitchVar
- underef
- unslice
- valSwap
{{- end}}
revive:
# Only these rules are enabled.

View file

@ -1827,9 +1827,7 @@ func (ss SortableSliceOfMaps) Less(i, j int) bool {
}
func (ss SortableSliceOfMaps) Swap(i, j int) {
tmp := ss.s[i]
ss.s[i] = ss.s[j]
ss.s[j] = tmp
ss.s[i], ss.s[j] = ss.s[j], ss.s[i]
}
func deduplicateAndSortScalars(s []interface{}) []interface{} {
@ -1875,9 +1873,7 @@ func (ss SortableSliceOfScalars) Less(i, j int) bool {
}
func (ss SortableSliceOfScalars) Swap(i, j int) {
tmp := ss.s[i]
ss.s[i] = ss.s[j]
ss.s[j] = tmp
ss.s[i], ss.s[j] = ss.s[j], ss.s[i]
}
// Returns the type of the elements of N slice(s). If the type is different,