dpd7195 2014-12-02 12:24
浏览 90
已采纳

如何在Go中安装要求? “找不到包裹”

I'm new to Go and I'm trying to set up a Go project with minimal documentation: https://github.com/alphagov/metadata-api

I've cloned it, but when I try go build I get the following warnings:

main.go:8:2: cannot find package "github.com/Sirupsen/logrus" in any of:
    /usr/local/Cellar/go/1.3.3/libexec/src/pkg/github.com/Sirupsen/logrus (from $GOROOT)
    /Users/me/go/src/github.com/Sirupsen/logrus (from $GOPATH)
main.go:14:2: cannot find package "github.com/alphagov/metadata-api/content_api" in any of:
    /usr/local/Cellar/go/1.3.3/libexec/src/pkg/github.com/alphagov/metadata-api/content_api (from $GOROOT)
    /Users/me/go/src/github.com/alphagov/metadata-api/content_api (from $GOPATH)

I'm guessing this is because I haven't installed the Go equivalent of requirements?

My GOPATH is set:

metadata-api$ echo $GOPATH
/Users/me/go

And the Go executable is in

metadata-ape$ echo $PATH
....:/Users/me/go/bin

What do I need to do to help Go find these packages?

  • 写回答

1条回答 默认 最新

  • dsgrs26202 2014-12-02 12:25
    关注

    You should install package first:

    try

    $ go get github.com/Sirupsen/logrus
    

    and check you $GOPATH dir

    This project use gom as the package manager,

    Make sure you have installed gom

    or try this command

    $ gom install 
    

    I think your $GOPATH and $PATH settings are incorrect, the $GOPATH environment variable specifies the location of your workspace, these are my path settings:

    export GOROOT=$HOME/bin/go
    export GOBIN=$GOROOT/bin
    export GOPATH=$HOME/golang
    export PATH=$PATH:$GOBIN
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度