This is a creation in Article, where the information may have evolved or changed.
So, get a private library with DEP
Introduced
dep
is a dependency management tool. It requires a 1.9 or later Golang
version to compile
dep
It 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
- Assuming that you are the first time, and do not perform the above step (
ECDSA key fingerprint
), will always be jammed
- 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
dep
It'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