我无法安装Go包。

huangapple go评论67阅读模式
英文:

I can't install a go package

问题

我目前正在尝试安装https://github.com/willnorris/imageproxy。我对Go语言还是新手,所以我首先安装了Go、GitHub和Mercurial。

我尝试了几种方法,包括克隆git仓库、使用go get、使用go install和go build。但是没有一种方法成功,它可以将文件下载到src目录,但没有得到bin文件。

所以有人有什么想法吗?

---编辑---
使用以下命令:
go get github.com/willnorris/imageproxy/cmd/imageproxy

我得到的错误信息是:

[root@s17848415 go]# go get github.com/willnorris/imageproxy/cmd/imageproxy
src/github.com/willnorris/imageproxy/cmd/imageproxy/main.go:27: imported and not used: "github.com/sosedoff/imageproxy/proxy"
src/github.com/willnorris/imageproxy/cmd/imageproxy/main.go:60: undefined: imageproxy

--编辑2---

[root@s17848415 go]# go get github.com/willnorris/imageproxy/cmd/imageproxy
package willnorris.com/go/imageproxy: unrecognized import path "willnorris.com/go/imageproxy"
英文:

i'm currently try to install https://github.com/willnorris/imageproxy . I'm a newbie with go lang. So i installed first go, github and hg.

I tried a few things, clone the git repository, use go get, use go install, go build.
But nothing worked, it could download the files to the src direcotry, but didn't get the bin.

so has anybody an idea?

---edit---
with:
go get github.com/willnorris/imageproxy/cmd/imageproxy

i get:

[root@s17848415 go]# go get github.com/willnorris/imageproxy/cmd/imageproxy
# github.com/willnorris/imageproxy/cmd/imageproxy
src/github.com/willnorris/imageproxy/cmd/imageproxy/main.go:27: imported and not used: "github.com/sosedoff/imageproxy/proxy"
src/github.com/willnorris/imageproxy/cmd/imageproxy/main.go:60: undefined: imageproxy

--edit 2 ---

[root@s17848415 go]# go get github.com/willnorris/imageproxy/cmd/imageproxy
package willnorris.com/go/imageproxy: unrecognized import path "willnorris.com/go/imageproxy"

答案1

得分: 1

解决方案:

首先:

go get github.com/willnorris/imageproxy/cmd/imageproxy

(下载源代码)

第二步 - 修改 "vi github.com/willnorris/imageproxy/cmd/imageproxy" 的最后一行

import (
     "flag"
     "fmt"
     "log"
     "net/http"
     "strings"

     "github.com/gregjones/httpcache"
     "github.com/gregjones/httpcache/diskcache"

     "github.com/willnorris/imageproxy"
 )

最后 - 再次执行:

  go get github.com/willnorris/imageproxy/cmd/imageproxy
英文:

solution:

first:

go get github.com/willnorris/imageproxy/cmd/imageproxy

(downloads source)

second - change "vi github.com/willnorris/imageproxy/cmd/imageproxy"
last line

import (
     "flag"
     "fmt"
     "log"
     "net/http"
     "strings"

     "github.com/gregjones/httpcache"
     "github.com/gregjones/httpcache/diskcache"

     "github.com/willnorris/imageproxy"
 )

last - again:

  go get github.com/willnorris/imageproxy/cmd/imageproxy

答案2

得分: 1

我已经更新了README文件,包括入门指南:https://github.com/willnorris/imageproxy#getting-started。特别要注意的是,你应该使用"willnorris.com/go/imageproxy"而不是"github.com/willnorris/imageproxy"进行获取。

英文:

I've updated the README file to include getting started instructions: https://github.com/willnorris/imageproxy#getting-started. Notably, you should go get as "willnorris.com/go/imageproxy", not "github.com/willnorris/imageproxy".

huangapple
  • 本文由 发表于 2014年9月23日 04:08:59
  • 转载请务必保留本文链接:https://go.coder-hub.com/25982369.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定