简体   繁体   English

配置golang gopath设置

[英]configuring golang gopath setup

When I run my cat .bash_profile command via terminal the following message is displayed: 当我通过终端运行cat .bash_profile命令时,将显示以下消息:

export GOPATH=c:/Users/Petey/Documents/go 导出GOPATH = c:/ Users / Petey / Documents / go

I cd into the above, create a main.go and attempt to execute with go run main.go , but I receive this error. cd到上面,创建一个main.go并尝试与执行go run main.go ,但我收到此错误。 What am I doing incorrectly? 我做错了什么?

go: GOPATH entry is relative; go:GOPATH条目是相对的; must be absolute path: "c". 必须是绝对路径:“ c”。

You should quote the path like so: export GOPATH="C:/Users/Petey/Documents/go" 您应该这样引用路径:export GOPATH =“ C:/ Users / Petey / Documents / go”

Since it is Windows bash, you could also try: export GOPATH="/mnt/c/Users/Petey/Documents/go" 由于它是Windows bash,因此您也可以尝试:export GOPATH =“ / mnt / c / Users / Petey / Documents / go”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM