英文:
undefined error when build go file
问题
我有一个简单的go文件,如下所示:
package main
import (
"flag"
)
var port = flag.Int("port", 23456, "port to listen.")
func main() {
flag.Parse()
}
昨天构建它时没有问题,但升级到go1.2.1后,我遇到了以下错误:
d:\dev\golang>go build main.go
# flag
C:\Go\src\pkg\flag\flag.go:87: undefined: strconv.ParseBool
尝试卸载1.2.1并重新安装1.2,结果相同。
有人能告诉我为什么吗?非常感谢您能提供的任何帮助。
go版本:go1.2.windows-amd64,go1.2.1.windows-amd64
Windows 7 64位
英文:
I have a simple go file like below
package main
import (
"flag"
)
var port = flag.Int("port", 23456, "port to listen.")
func main() {
flag.Parse()
}
It was no problem when I built it yesterday, but after upgrade to go1.2.1, I get below error.
d:\dev\golang>go build main.go
# flag
C:\Go\src\pkg\flag\flag.go:87: undefined: strconv.ParseBool
Tried to uninstall 1.2.1 and re-install 1.2, same result.
Can anybody tell me why? I really appreciate any help you can provide.
go version: go1.2.windows-amd64, go1.2.1.windows-amd64
windows 7 64 bit
答案1
得分: 0
好的,以下是翻译好的内容:
好的,最终我找到了解决方案。
在我将 C:\Go\pkg\windows_amd64
重命名为 windows_amd64\windows_amd64_111
后,系统自动为我重新创建了一个 C:\Go\pkg\windows_amd64
文件夹,然后一切都正常了。
仍然不知道为什么会这样...
英文:
Okay, finally I found the solution.
After I renamed C:\Go\pkg\windows_amd64
to windows_amd64\windows_amd64_111
, system automatically recreated a C:\Go\pkg\windows_amd64
folder for me, and then, everything goes OK.
Still don't know why...
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论