cannot download, $GOPATH not set

前端 未结 15 2135
闹比i
闹比i 2020-11-29 17:00

I want to install json2csv using go get github.com/jehiah/json2csv but I receive this error:

package github.com/jehiah/json2csv: cannot download         


        
15条回答
  •  既然无缘
    2020-11-29 17:40

    I had to run an application as root (to open a webserver on port 80), this produced the error for me, because the sudo user has a different environment than the normal user, hence GOPATH was not set.

    If someone else is having this problem, add -E to the command, this will preserve the user environment.

    sudo -E go run main.go

    For more infos see discussion here: Google Groups – GOPATH Problem

提交回复
热议问题