首页 > 其他分享 >解决命令行窗口执行godoc报错

解决命令行窗口执行godoc报错

时间:2023-01-12 21:55:18浏览次数:58  
标签:bin GOPATH 报错 godoc 命令行 location

在cmd命令行窗口执行godoc报错:

'godoc' is not recognized as an internal or external command,
operable program or batch file.

 

原因:这是因为Windows的系统变量没有配置好GOPATH

 

解决:

有2种方法可以解决:

第一种是变通的方法:使用godoc的完整路径

每次运行godoc都带上gopath的完整路径,假设你的GOPATH根目录是C:\Users\fastb\go\bin,你可以使用C:\Users\fastb\go\bin\godoc.exe执行godoc

第二种方法(推荐):把GOPATH添加到Path环境变量

首先,请确保已经设置好了GOPATH,然后把%GOPATH%\bin加到系统环境变量的Path变量,重新打开cmd命令行窗口,再次执行godoc就可以了

TRANSLATE with x English
Arabic Hebrew Polish
Bulgarian Hindi Portuguese
Catalan Hmong Daw Romanian
Chinese Simplified Hungarian Russian
Chinese Traditional Indonesian Slovak
Czech Italian Slovenian
Danish Japanese Spanish
Dutch Klingon Swedish
English Korean Thai
Estonian Latvian Turkish
Finnish Lithuanian Ukrainian
French Malay Urdu
German Maltese Vietnamese
Greek Norwegian Welsh
Haitian Creole Persian  
  TRANSLATE with COPY THE URL BELOW Back EMBED THE SNIPPET BELOW IN YOUR SITE Enable collaborative features and customize widget: Bing Webmaster Portal Back

标签:bin,GOPATH,报错,godoc,命令行,location
From: https://www.cnblogs.com/jamstack/p/17048034.html

相关文章