Skip to content
This repository has been archived by the owner on Feb 26, 2019. It is now read-only.

[feature] support local repo mirror through add "repo" into top level of vender file #480

Open
YueHonghui opened this issue May 30, 2016 · 2 comments

Comments

@YueHonghui
Copy link

We plan to use golang in our team, and want to create a local repo mirror that copy all dependencies we used in our private network. But after playing with dependency manager tools like godep and govender, we realized it is difficult work.
I suggest add "repo" into top level of vender file, to redirect all origin to repo/origin, like this:

{
    "comment": "Note the use of a non-standard crypto package.",
    "repo":"privatedomain",
    "package": [
        {
            "path": "rsc.io/pdf",
            "revision": "3a3aeae79a3ec4f6d093a6b036c24698938158f3",
            "revisionTime": "2014-09-25T17:07:18-04:00",
            "comment": "located on disk at $GOPATH/src/github.com/kardianos/mypkg/vendor/rsc.io/pdf"
        },
        {
            "path": "golang.org/x/net/context",
            "revision": "25f1feceb5e13da68a35ee552069f86d18d63fee",
            "revisionTime": "2015-04-09T05:06:17-08:00",
            "comment": "Use the 25f1 version. Located on disk at $GOPATH/src/github.com/kardianos/mypkg/vendor/golang.org/x/net/context"
        }
    ]
}

This will tell vendor tools to fetch "privatedomain/rsc.io/pdf" as "rsc.io/pdf", "privatedomain/golang.org/x/net/context" as "golang.org/x/net/context". I think this will be a great idea providing golang dependency management the ability of private mirror repo.

ps: I have posted a same issue(kardianos/govendor#155) to govender.

@freeformz
Copy link

I'll likely add an "origin" field to each dep instead. That's probably not the best for your use case, but probably more generally applicable. Thoughts on that?

@YueHonghui
Copy link
Author

@freeformz Add an "origin" field to each dep worked in this case. But I think the targets of add "origin" field to each dep or add "repo"(maybe "redirect", "mirror", "prefix"?) to top level of vendor file seems different. For the deps will be added in the future, "origin" field of each dep can't do well at now. For the case downloading "rsc.io/pdf" from "anyurl/anypath", "repo" field doesn't work at all.
Private repo mirror to have best control of dependencies or fit the situation lack of access to public network is important for the company use, "origin" field to each dep is not the best practice. I'll think more for this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants