Thus, dep is used to obtain the private library.

  Dependency management tools, golang

Thus, dep is used to obtain the private library.


depIs a dependency management tool. It requires 1.9 or newerGolangVersion to compile

depIt can be used safely in the production process, but it is still in the official test stage, that is, it is not yet in place.go toolChina. But I think sooner or later: =)

For guidelines and reference materials, please refer toDocument

Get private library

We often usegitThere are two ways, the first is throughssh, the second ishttps

In this paper, we usegitlab.comFor the case, create aprivatePrivate warehouse of


First, we need to generate it locallyssh-key, if not generated can turn rightPortal

Get what you need to usessh-keyAfter that, we opened, copy and paste into ourSettings->SSH KeysIn


After the success of the addition, we directly inGopkg.tomlIn the configuration of our parameters

  branch = "master"
  name = ""
  source = ""

Before pulling resources, be careful to assume that this is your first time to use it.ssh-keyPull, need to use manually firstgit clonePull it again and agreeECDSA key fingerprint

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

Next, we are under the projectDirect executiondep ensureYou can pull it out.Down!


  1. Suppose that this is your first time and you have not performed the above step (ECDSA key fingerprint), will always be stuck
  2. The correct feedback should be that there is no error after executing the command, but if the error prompt appears, it means that the storage warehouse has not been included.dep(example:gitee)
$ dep ensure

The following issues were found in Gopkg.toml:

unable to deduce repository and source type for "xxxx": unable to read metadata: go-import metadata not found

ProjectRoot name validation failed


We are directly inGopkg.tomlIn the configuration of our parameters

  branch = "master"
  name = ""
  source = "https://{username}:{password}"

It is mainly a revision.sourceThe configuration item for,usernameFill ingitlabThe user name of,passwordFor password

Finally back to the projectcarry outdep ensurePull resourcesJust do it


depAt present, it is still an official test stage, and there may be variables.

Please be sure tosfsuperiorOriginal textSubject, ifdepThe new version is subject to change and will be revised accordingly.