Use DEP instead of go get to get a private library

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

Use dep instead go get to get a private library

(Kyung's Column 2017.11)

go getThe function is weak, unable to get branches, tags, specific versions, fork, and dep can do. depYou can also get a private library.

Use the gitee.com Private library as a test. Create a gogettest library.

Available:

get -u gitee.com/jinq0123/gogettest

If you change to a private library, it fails:

gethttps://gitee.com/jinq0123/gogettest?go-get=1fromhttps://gitee.com/jinq0123/gogettest?go-get=1403"gitee.com/jinq0123/gogettest"https://gitee.com/jinq0123/gogettest?go-get=1: no go-import meta tags ())

Use the DEP tool to take a private library

Https://github.com/golang/dep

Installing DEP

get -u github.com/golang/dep/cmd/dep

Initialization

Run in project directory:

dep init

Generate Gopkg.toml andGopkg.lock

Add Force (Constraint)

Add in GOPKG.TOML:

[[constraint]]  "master"  "gitee.com/jinq012345/gogettest"  "https://gitee.com/jinq0123/gogettest.git"

Source enforces the use of HTTPS to obtain the Gotgettest library.

Notice that the library name is changed so that the jinq012345 import:
imort "gitee.com/jinq012345/gogettest"

The settings for name and source support are obtained from the Fork Library.

Get gogettest Library

ensure

An HTTPS login username and password entry box will pop up.

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.