mirror of
https://github.com/kubernetes/kubernetes.git
synced 2026-05-28 04:04:39 -04:00
Enforce Golang a, b = b, a swaps
This eliminates the last two remaining three-step value swaps (t = a; a = b; b = t instead of a, b = b, a) and enables linting to prevent new ones being added in future. Signed-off-by: Stephen Kitt <skitt@redhat.com>
This commit is contained in:
parent
854e67bb51
commit
55c337637e
3 changed files with 2 additions and 8 deletions
|
|
@ -432,7 +432,6 @@ linters:
|
|||
- typeSwitchVar
|
||||
- underef
|
||||
- unslice
|
||||
- valSwap
|
||||
revive:
|
||||
# Only these rules are enabled.
|
||||
rules:
|
||||
|
|
|
|||
|
|
@ -253,7 +253,6 @@ linters:
|
|||
- typeSwitchVar
|
||||
- underef
|
||||
- unslice
|
||||
- valSwap
|
||||
{{- end}}
|
||||
revive:
|
||||
# Only these rules are enabled.
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue