V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
The Go Programming Language
http://golang.org/
Go Playground
Go Projects
Revel Web Framework
iamverylovely
V2EX  ›  Go 编程语言

请问 go build 出现私有仓库下载不了怎么解决?

  •  
  •   iamverylovely · 2020-08-11 15:47:22 +08:00 · 1759 次点击
    这是一个创建于 1344 天前的主题,其中的信息可能已经有所发展或是发生改变。

    私有仓库的代码在本地有,但是没有这个仓库的权限,不是我自己的仓库,代码最初是开源的,之后设为私有了。

    之前克隆了一份到本地,不知道怎么引用,纯小白 GoGoGo 。

    go build
    
    build my_project: cannot find module for path github.com/example/my_project/xxx/xxx/xxx
    
    
    9 条回复    2020-08-11 17:57:07 +08:00
    maichael
        1
    maichael  
       2020-08-11 15:51:46 +08:00
    你都没权限还能怎么办。
    Vegetable
        2
    Vegetable  
       2020-08-11 15:53:23 +08:00
    把仓库上传到自己的 github 上,引用地址改一下
    virusdefender
        3
    virusdefender  
       2020-08-11 15:53:48 +08:00
    git submodule
    robinch
        4
    robinch  
       2020-08-11 15:56:00 +08:00
    读读代码
    AmrtaShiva
        6
    AmrtaShiva  
       2020-08-11 15:58:48 +08:00 via iPhone
    编辑 go.mod
    require github.com/example/my_project/xxx/xxx/xxx v0.0.0
    replace github.com/example/my_project/xxx/xxx/xxx =>/你 clone 的本地地址
    Leigg
        7
    Leigg  
       2020-08-11 16:00:37 +08:00 via Android
    记得有个 GOPRIVATE 变量解决
    reus
        8
    reus  
       2020-08-11 16:30:54 +08:00
    放到本地,然后 go.mod 里写

    github.com/example/my_project/ => ./my_project
    iamverylovely
        9
    iamverylovely  
    OP
       2020-08-11 17:57:07 +08:00
    @AmrtaShiva
    @Jirajine
    @reus 解决了,问题原来是 GO 版本低了,设置了这些都不起作用,之前找到过这些方法,谢谢各位了。。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1025 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 19:21 · PVG 03:21 · LAX 12:21 · JFK 15:21
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.