doushi9729 2017-07-13 15:19
浏览 439
已采纳

在GOPATH下找不到软件包

I am trying to install the dependencies of my project with glidebut unfortunately it fails with the following message:

main.go:7:2: cannot find package "github.com/arschles/go-in-5-minutes/episode13/models" in any of:
    /Users/theo/go-workspace/src/github.com/thitami/go-in-5-minutes/episode13/vendor/github.com/arschles/go-in-5-minutes/episode13/models (vendor tree)
    /usr/local/Cellar/go/1.8.3/libexec/src/github.com/arschles/go-in-5-minutes/episode13/models (from $GOROOT)
    /Users/theo/go-workspace/src/github.com/arschles/go-in-5-minutes/episode13/models (from $GOPATH)

Running a go env, this is my env variables of interest:

GOPATH="/Users/theo/go-workspace"
GOROOT="/usr/local/Cellar/go/1.8.3/libexec"

Please be advised that I am zsh and I am exporting the GOPATH inside the .zshrc file like this:

export GOPATH=HOME/go-workspace

Any ideas are appreciated

* UPDATE *

As requested this is the piece of code with the call to the models package:

import (
    "database/sql"
    "log"

    "github.com/arschles/go-in-5-minutes/episode13/models"
    _ "github.com/mxk/go-sqlite/sqlite3"
)
  • 写回答

1条回答 默认 最新

  • dppxp79175 2017-07-15 16:38
    关注

    You can only set the gopath once and you'll have to reset it every time you change packages. Think of it as a virtualenv. One way around it is to install the packages global or by using something like gvm

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

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料