So, get a private library with DEP

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

So, get a private library with DEP

Introduced

depis a dependency management tool. It requires a 1.9 or later Golang version to compile

depIt has been able to be used safely in the production chain, but still in the official pilot phase, which is not yet go tool in. But I think it's a matter of sooner or later: =)

Guidelines and references, see the documentation

Get a private library

There are two ways we use it git , the first is through ssh , and the second ishttps

In this article gitlab.com , we create a private warehouse as a case private

by ssh Way

First we need to generate on this machine ssh-key , if not generated can turn right portal

Get what you need to use ssh-key after we open our gitlab.com , copy and paste into our Settings SSH Keys

After adding the success, we directly in the Gopkg.toml configuration of our parameters

[[constraint]]  branch = "master"  name = "gitlab.com/eddycjy/test"  source = "git@gitlab.com:EDDYCJY/test.git"

Before pulling resources, be careful to assume that you are using the pull for the first time, and that you ssh-key need to git clone pull it again, agreeing ECDSA key fingerprint :

$ git clone git@gitlab.com:EDDYCJY/test.gitCloning into 'test'...The authenticity of host 'gitlab.com (52.167.219.168)' can't be established.ECDSA key fingerprint is xxxxxxxxxxxxx.Are you sure you want to continue connecting (yes/no)? yes...

Next, we dep ensure can pull it down by executing it directly under the project!

Problem

    1. Assuming that you are the first time, and do not perform the above step ( ECDSA key fingerprint ), will always be jammed
    2. The correct feedback should be that there is no error after executing the command, but if this error message appears, it indicates that the storage warehouse is not included dep (example: gitee )
$ dep ensureThe following issues were found in Gopkg.toml:unable to deduce repository and source type for "xxxx": unable to read metadata: go-import metadata not foundProjectRoot name validation failed

by https Way

We are directly in the Gopkg.toml configuration of our parameters

[[constraint]]  branch = "master"  name = "gitlab.com/eddycjy/test"  source = "https://{username}:{password}@gitlab.com"

The main is to modify source the configuration items, username fill in gitlab the user name, password for the password

Finally, go back to the project and execute the dep ensure pull resource .

At last

depIt's still an official trial phase, and there may be variables.

Please be sure to follow the sf original text, if the dep new version is subject to change

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.