普通网友 2013-08-22 18:27 采纳率: 0%
浏览 216

运行hello.go程序时文件不存在错误

I am following go documentation and try to run hello.go. I am on Windows 7 and install go 1.1.2 using msi installer. I have file "C:\Go\pkg\tool\windows_386\8g.exe" (see dir output below), but when I do 'go.exe run hello.go', I get the file does not exist error.

Please help. Thank you.

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
  • 写回答

2条回答 默认 最新

  • doushou3814 2013-08-24 14:02
    关注

    From issue 6224, this error happens if you had the environment variable PATHEXT set to only one extension, before running go.exe.

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

    What is the expected output?
    no errors and hello world program runs

    What do you see instead?

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

    8g Windows 7 64bit go version go1.1.2 windows/386


    On my computer (W7 64 bits), I have:

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

    and everything runs just fine.

    LookPath is called with "c:\Go\pkg\tool\windows_386\8g.exe" and the fact that PATHEXT is being set in an evil way let's say, make LookPath fails

    评论

报告相同问题?

悬赏问题

  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行