douting0585 2017-03-19 10:35
浏览 115
已采纳

生成.go软件包时出现致命错误

I'm trying to install a go package. I cloned the package, ran the following commands to build it:

$go get -v -d

Fetching https://golang.org/x/net/publicsuffix?go-get=1
Parsing meta tags from https://golang.org/x/net/publicsuffix?go-get=1 (status code 200)
get "golang.org/x/net/publicsuffix": found meta tag main.metaImport{Prefix:"golang.org/x/net", VCS:"git", RepoRoot:"https://go.googlesource.com/net"} at https://golang.org/x/net/publicsuffix?go-get=1
get "golang.org/x/net/publicsuffix": verifying non-authoritative meta tag
Fetching https://golang.org/x/net?go-get=1
Parsing meta tags from https://golang.org/x/net?go-get=1 (status code 200)
golang.org/x/net (download)

$go build *.go
# github.com/moul/http2curl
gccgo: error: $HOME/go/src/github.com/moul/http2curl/http2curl.go: No such file or directory
gccgo: fatal error: no input files
compilation terminated.
# github.com/pkg/errors
gccgo: error: $HOME/go/src/github.com/pkg/errors/errors.go: No such file or directory
gccgo: error: $HOME/go/src/github.com/pkg/errors/stack.go: No such file or directory
gccgo: fatal error: no input files
compilation terminated.
# golang.org/x/net/publicsuffix
gccgo: error: $HOME/go/src/golang.org/x/net/publicsuffix/list.go: No such file or directory
gccgo: error: $HOME/go/src/golang.org/x/net/publicsuffix/table.go: No such file or directory
gccgo: fatal error: no input files
compilation terminated.

I tried cloning github.com/moul/http2curl to $HOME/go/src/github.com/moul/http2curl and the http2curl.go file is exactly in the path specified and yet it still says No such file or directory. How do I build this?

  • 写回答

1条回答 默认 最新

  • douxiao0400 2017-03-19 11:46
    关注

    I'm not sure what plain go get -v -d gets you but you should specify the package(s) that you want to install. So what you should do is something like this:

    $go get github.com/moul/http2curl

    Without the -d flag this should download and install the package http2curl for you. But if you use the -d flag, you can install the package by first moving to the package's directory.

    $cd $GOPATH/src/github.com/moul/http2curl

    And then running build (without *.go).

    $go build

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥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数据包括密码,可以复制到另一手机上运行