golang 编译器说程序正在重新定义变量,还没有重新定义

golang compiler is saing that the program is redefineing variables, that haven't been redfeind

编译器说每个已定义的变量都在 5 行后再次定义并引发错误,当然我没有在 5 行后重新定义所有变量,我该如何停止这个错误? 这是结构之一的示例

type Holder struct {
    Name  string
    Holders_need int
    Avail int
}

它声称在 32 之类的结构关闭后的行上有 redifend 我找到了这个问题的答案

您应该添加一些代码,让我们确切知道您在做什么。

您可能在初始化变量后使用 := 而不是 =。例如

i := 1
// use i
i = 2 // change value of i using = since i has already been declared
// i := 2 throws error 'no new variables on left side of :='
// since i was already created above

详情请参考here

我找到了我的问题的答案,感谢那些试图提供帮助的人,如果其他人有这个问题,请检查你的编译器是否试图编译同一个程序两次,因为这就是这里发生的事情!