shadowing of predeclared identifier: new
36 if err := json.Unmarshal(data, v); err != nil {
37 return false, false, err
38 }
39 new, _ := json.Marshal(v)40 if !bytes.Equal(old, new) {
41 return true, true, nil
42 }
shadowing of predeclared identifier: copy
216 strict: false,
217 }}
218 for _, v := range testdata {
219 copy := origin.cloneBucketItemByRange(v.startKey, v.endKey)220 re.Equal(v.startKey, copy.startKey)
221 re.Equal(v.endKey, copy.endKey)
222 re.Len(copy.stats, v.count)
shadowing of predeclared identifier: copy
128 right = stat.EndKey
129 }
130 if bytes.Compare(left, right) < 0 {
131 copy := stat.clone()132 copy.StartKey = left
133 copy.EndKey = right
134 item.stats = append(item.stats, copy)
shadowing of predeclared identifier: cap
78func (s *SlidingWindows) Reset(_ float64, _ Type) {
79}
80
81func (s *SlidingWindows) set(cap float64, typ Type) { 82 if typ != SendSnapshot {
83 return
84 }
shadowing of predeclared identifier: cap
66 // There are two constants to control the proportion of the sum and the current error.
67 // The sum of the error is used to ensure the capacity is more stable even if the error is zero.
68 // In the final scene, the sum of the error should be stable and the current error should be zero.
69 cap := defaultProportion*e + defaultIntegral*s.lastSum 70 // The capacity should be at least the default window size.
71 if cap < defaultWindowSize {
72 cap = defaultWindowSize
shadowing of predeclared identifier: cap
52 re.Len(s.windows, int(constant.PriorityLevelLen))
53 // capacity:[10, 10, 10, 10]
54 for i, v := range s.windows {
55 cap := capacity >> i 56 if cap < minSnapSize {
57 cap = minSnapSize
58 }
Description
It is not recommended to shadow builtins because identifiers shadowing a built-in makes it inaccessible to use. A shadowed variable or function is declared in the scope with the same name as a built-in function.
Bad practice
len := 10 // shadowing bultin `len`
Recommended
length := 10