2013-08-22 93 views
2

我正在关注go文档并尝试运行hello.go。 我在Windows 7上,使用msi安装程序安装go 1.1.2。 我有文件“C:\ Go \ pkg \ tool \ windows_386 \ 8g.exe”(请参阅​​下面的dir输出),但是当我执行'go.exe运行hello.go'时,我得到的文件不存在错误。当我运行hello.go程序时文件不存在错误

请帮忙。谢谢。

C:\>go.exe run hello.go 
go build command-line-arguments: exec: "C:\\Go\\pkg\\tool\\windows_386\\8g.exe": 
file does not exist 

C:\>go.exe version 
go version go1.1.2 windows/386 

C:\>go.exe run hello.go 
go build command-line-arguments: exec: "C:\\Go\\pkg\\tool\\windows_386\\8g.exe": 
file does not exist 

C:\>dir C:\\Go\\pkg\\tool\\windows_386\\8g.exe 
The specified path is invalid. 

C:\>dir C:\Go\pkg\tool\\windows_386\\8g.exe 
Volume in drive C is Local Disk 
Volume Serial Number is C07E-54F5 

Directory of C:\Go\pkg\tool\windows_386 

08/13/2013 07:04 AM   1,831,416 8g.exe 
       1 File(s)  1,831,416 bytes 
       0 Dir(s) 11,407,892,480 bytes free 
+1

对我来说,问题是,你可以设置GOOS到Linux,而试图在Windows上运行。 –

回答

3

issue 6224,如果您有环境变量PATHEXT设置为只能有一个扩展,运行go.exe在此之前错误发生。

  1. set PATHEXT=.BAT
  2. go run hello.go

什么是预期的输出?
没有错误和你好世界程序运行

你看到什么呢?

go build command-line-arguments: 
exec: "c:\\Go\\pkg\\tool\\windows_386\\8g.exe": file does not exist 

8克 64个Windows 7 去版本go1.1.2窗/ 386


在我的电脑(W7 64位),我有:

set pa 
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC 

和一切运行得很好。

LookPath被称为与“c:\Go\pkg\tool\windows_386\8g.exe”而事实上,PATHEXT是一个邪恶的方式设定假设,使LookPath失败

+0

I.e. 'PATHEXT'应该至少包含'.EXE'。 – VonC

相关问题