Package management with Glide for Golang

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

Overview

Golang has a lot of package management tools, this space mainly introduces glide for package management.

Installation and command introduction

➜ tonny@tonny-pc  ~ go get github.com/Masterminds/glide

Command Introduction
Glide Create|init initializes the project and creates the Glide.yaml file.
Glide get to get a single package
--all-dependencies will download all associated dependency packages
-S removes all versioning, such as. git
-V Delete nested vendor
Glide Install Package
Glide Update|up Update Package

Case Test

Get ready

The package for this test is GITHUB.COM/MATTN/GO-ADODB, and this package has a dependency package that is github.com/go-ole/go-ole.

Download a single package

command:    glide get github.com/mattn/go-adodbglide.lock:    hash:    60061bf3133f0eec2f147f3d80f3e37c402ee12df8cde841b03d80c82a96bab7    updated: 2016-05-18T23:30:08.5219207+08:00    imports:    - name: github.com/mattn/go-adodb      version: 452cccbbcfb7906b3cbc512992557c1083e1011b    devImports: []glide.yaml:    package: glide_demo6    import:    - package: github.com/mattn/go-adodb

Download a single package,--all-dependencies

command:    glide get --all-dependencies -s -v github.com/mattn/go-adodbglide.lock:    hash: 60061bf3133f0eec2f147f3d80f3e37c402ee12df8cde841b03d80c82a96bab7    updated: 2016-05-18T23:34:48.7545322+08:00    imports:    - name: github.com/go-ole/go-ole      version: 572eabb84c424e76a0d39d31510dd7dfd62f70b2      subpackages:      - oleutil    - name: github.com/gonuts/commander      version: f8ba4e959ca914268227c3ebbd7f6bf0bb35541a    - name: github.com/gonuts/flag      version: 741a6cbd37a30dedc93f817e7de6aaf0ca38a493    - name: github.com/mattn/go-adodb      version: 452cccbbcfb7906b3cbc512992557c1083e1011b    devImports: []glide.yaml:    package: glide_demo6    import:    - package: github.com/mattn/go-adodb

As you can see from lock, all the dependent packages are downloaded.

Download the package that made the version number

command:    glide get github.com/go-sql-driver/mysql#v1.2glide.yaml:    package: glide_demo    import:    - package: github.com/go-sql-driver/mysql      version: v1.2

Team Development

When the team starts, Glide.yaml and glide.lock need to be versioned, vendor ignored.
The process of team development under simulation
A classmate: Initialize the project, and submit the source code, where Glide.yaml and glide.lock content are as follows

glide.yaml:    package: glide_demo6    import:    - package: github.com/mattn/go-adodb    - package: github.com/go-ole/go-oleglide.lock:    hash: 18e3b9c2f5c11f3268b22ebdbea09636c5cae28e78f0011578f455c485e9d214    updated: 2016-05-18T23:43:15.8217224+08:00    imports:    - name: github.com/go-ole/go-ole      version: 572eabb84c424e76a0d39d31510dd7dfd62f70b2    - name: github.com/mattn/go-adodb      version: 452cccbbcfb7906b3cbc512992557c1083e1011b    devImports: []

B Classmate: Pull the project, execute glide install, will automatically download the corresponding package

Summarize

The benefit of

Using glide is that each project takes on its own separate package, and that it has a good control over the version of the package, which is especially important in team development.

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.