doumenshi1475 2017-09-24 17:18
浏览 901
已采纳

Golang-运行go.exe时Windows控制台退出

I installed Go in Windows 10 with the MSI installer. However, when I run go in cmd (or PowerShell) with an argument, such as env, build, install, list, ... The console window closes (or crashes?) after the go command is run. This prevents me from seeing any errors or anything while compiling go code.

Is there some sort of log in windows which contains console host data, such as crashing, errors, and warnings? This would be very helpful to find out if console or console host is crashing for some reason.

As an example:

go env

won't output anything and the console window will immediately close.

Edit: Just to clarify, I am not running this command in the run dialog, I am running it from an administrator command prompt (I tried using PowerShell, also no luck). If I run:

go help

It will work properly. However, as soon as I run go with any other argument, such as:

go install <target>

or

go build <target>

The process will work but the console will exit before giving me any information.

Edit:

I've discovered a temporary fix... If I run go commands in a Cygwin terminal they work as usual. This is very strange.

  • 写回答

2条回答 默认 最新

  • dqq9695 2017-11-14 17:09
    关注

    I figured it out, I have Cygwin installed and I put it in my path environment variable. Turns out the git installation from Cygwin was interfering with the regular up to date, git installation. This was causing go with args to only work if I had the Cygwin terminal running. On golang-nuts someone also mentioned that some git versions have some bug where come.exe is called causing go commands to fail on windows.

    To fix I just removed Cygwin from path and updated git to latest version.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 在若依框架下实现人脸识别
  • ¥15 网络科学导论,网络控制
  • ¥100 安卓tv程序连接SQLSERVER2008问题
  • ¥15 利用Sentinel-2和Landsat8做一个水库的长时序NDVI的对比,为什么Snetinel-2计算的结果最小值特别小,而Lansat8就很平均
  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同