Our website uses cookies to enhance your browsing experience.
Accept
to the top
>
>
>
V8037. The same argument was passed...
menu mobile close menu
Additional information
toggle menu Contents

V8037. The same argument was passed to a function multiple times. A different argument may have been intended.

Aug 06 2026

The analyzer has detected a potential error caused by passing the same argument multiple times when a method or function is calling.

The example N1:

func Do(mX, mY, mZ int) {
  ....
}

func (vec Vector) Foo() {
  Do(vec.x, vec.y, vec.y)
}

In the Do function signature and its call, the vec.y argument is passed twice. Most likely, the mZ parameter was intended to receive vec.z.

The fixed code:

func (vec Vector) Foo() {
  Do(vec.x, vec.y, vec.z)
}

Passing identical arguments to certain standard library functions (math.Min, math.Max, and strings.Replace) may also be an error.

The example N2:

var count, capacity int
....
size := math.Max(float64(count), float64(count))

Due to a typo, math.Max compares the count variable with itself. Therefore, the function always returns the value of count.

The fixed code:

size := math.Max(float64(count), float64(capacity))