#57433 added slices.Equal, using it can reduce the amount of code
Change-Id: I70d14b6c4c24da641a34ed36c900d9291033f526
Reviewed-on: https://go-review.googlesource.com/c/go/+/492576
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: shuang cui <imcusg@gmail.com>
import (
"fmt"
+ "slices"
"strconv"
)
initialized bool
}
-func ssleq(s1 []string, s2 []string) bool {
- if len(s1) != len(s2) {
- return false
- }
- for i := range s1 {
- if s1[i] != s2[i] {
- return false
- }
- }
- return true
-}
-
func (a *argstate) Merge(state argvalues) {
if !a.initialized {
a.state = state
a.initialized = true
return
}
- if !ssleq(a.state.osargs, state.osargs) {
+ if !slices.Equal(a.state.osargs, state.osargs) {
a.state.osargs = nil
}
if state.goos != a.state.goos {