douting0585
douting0585
2017-03-19 10:35

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

  • IT行业问题
  • 计算机技术
  • it技术
  • 编程语言问答
  • 互联网问答
已采纳

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 douxiao0400 4年前

    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

    点赞 评论 复制链接分享

为你推荐