If you want to check the equality of two slices and the order is important then this snippet will save your time:
package main
import "fmt"
func main() {
firstSlice := []int{1, 2, 3, 4, 5}
secondSlice := []int{1, 2, 3, 4, 5, 6}
fmt.Println("isEqual", isEqual(firstSlice, secondSlice))
}
func isEqual(first, second []int) bool {
if len(first) != len(second) {
return false
}
for i, v := range first {
if v != second[i] {
return false
}
}
return true
}