Basic use of GODEP

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

About GODEP

Found that a lot of golang projects are used to GODEP as a package management tool, such as large-scale projects, such as Kubernetes, are using GODEP to rely on management operations, looked a bit like maven feeling, here to record the basic operation.

The first is the installation

Because of the network problem, goget when there is a package will not find, there are many alternative solutions, such as this

Basic use

Go Save

For example, to build a basic project, take Beego's example project. It is also important to note that go save is unsuccessful when you are not using version control and will report an error similar to the following:

godep: error while inspecting "/Users/Hessen/goworkspace/src/testBee/bapi": directory "/Users/Hessen/goworkspace/src" is not using a known version control system

The specific reasons for this article are explained in more detail. Always use the version Control tool to initialize the entire project first. After Godev save can see in the current directory generated Godeps folder, there is _workspace folder, storage of the source of the dependent package, as well as Godeps.json files, specifically describes the dependency relationship. The good thing about this is that you don't have to edit the description of the dependent package yourself, as Maven did, and it's automatically generated from the version control tool.

Go restore

The operation of restore and go save is done on the opposite side, such as Git on a project using GODEP, pull down, using GODEP restore can be godeps/ The dependent copies listed in Godeps.json are below the local gopath. One problem to note is that if there is already a related package installed, and some modifications have been made and some pull,request operations have been done, there may be some git related errors.

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.