├── LICENSE ├── README.md ├── glide.lock ├── glide.yaml ├── img.png ├── main.go ├── rules ├── old.go ├── rules.go └── uses.go └── vendor ├── github.com ├── Masterminds │ ├── glide │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── CHANGELOG.md │ │ ├── LICENSE │ │ ├── Makefile │ │ ├── README.md │ │ ├── action │ │ │ ├── about.go │ │ │ ├── about_test.go │ │ │ ├── cache.go │ │ │ ├── config_wizard.go │ │ │ ├── create.go │ │ │ ├── debug.go │ │ │ ├── doc.go │ │ │ ├── ensure.go │ │ │ ├── get.go │ │ │ ├── get_test.go │ │ │ ├── import_gb.go │ │ │ ├── import_godep.go │ │ │ ├── import_gom.go │ │ │ ├── import_gpm.go │ │ │ ├── init.go │ │ │ ├── install.go │ │ │ ├── list.go │ │ │ ├── list_test.go │ │ │ ├── mirrors.go │ │ │ ├── name.go │ │ │ ├── name_test.go │ │ │ ├── no_vendor.go │ │ │ ├── no_vendor_test.go │ │ │ ├── plugin.go │ │ │ ├── plugin_test.go │ │ │ ├── project_info.go │ │ │ ├── rebuild.go │ │ │ ├── rebuild_test.go │ │ │ ├── remove.go │ │ │ ├── tree.go │ │ │ └── update.go │ │ ├── cache │ │ │ ├── cache.go │ │ │ ├── cache_test.go │ │ │ ├── global_lock.go │ │ │ └── memory.go │ │ ├── cfg │ │ │ ├── cfg.go │ │ │ ├── config.go │ │ │ ├── config_test.go │ │ │ ├── lock.go │ │ │ └── lock_test.go │ │ ├── dependency │ │ │ ├── resolver.go │ │ │ ├── resolver_test.go │ │ │ └── scan.go │ │ ├── docs │ │ │ ├── commands.md │ │ │ ├── example-glide.yaml │ │ │ ├── faq.md │ │ │ ├── getting-started.md │ │ │ ├── glide-plugin-example │ │ │ ├── glide.lock.md │ │ │ ├── glide.yaml.md │ │ │ ├── importing.md │ │ │ ├── index.md │ │ │ ├── plugins.md │ │ │ ├── resolving-imports.md │ │ │ ├── vendor.md │ │ │ └── versions.md │ │ ├── gb │ │ │ ├── gb.go │ │ │ └── manifest.go │ │ ├── glide.go │ │ ├── glide.lock │ │ ├── glide.yaml │ │ ├── glide_test.go │ │ ├── godep │ │ │ ├── godep.go │ │ │ └── strip │ │ │ │ ├── strip.go │ │ │ │ └── strip_test.go │ │ ├── gom │ │ │ ├── gom.go │ │ │ └── parser.go │ │ ├── gpm │ │ │ └── gpm.go │ │ ├── importer │ │ │ └── importer.go │ │ ├── mirrors │ │ │ ├── cfg.go │ │ │ ├── mirrors.go │ │ │ └── mirrors_test.go │ │ ├── mkdocs.yml │ │ ├── msg │ │ │ ├── msg.go │ │ │ ├── out.go │ │ │ └── out_windows.go │ │ ├── path │ │ │ ├── path.go │ │ │ ├── path_test.go │ │ │ └── strip.go │ │ ├── repo │ │ │ ├── installer.go │ │ │ ├── repo.go │ │ │ ├── semver.go │ │ │ ├── set_reference.go │ │ │ ├── tracker.go │ │ │ ├── tracker_test.go │ │ │ └── vcs.go │ │ ├── testdata │ │ │ ├── name │ │ │ │ ├── glide.yaml │ │ │ │ └── glide2.yaml │ │ │ ├── nv │ │ │ │ ├── a │ │ │ │ │ └── foo.empty │ │ │ │ ├── b │ │ │ │ │ └── foo.empty │ │ │ │ └── c │ │ │ │ │ └── foo.empty │ │ │ ├── path │ │ │ │ ├── a │ │ │ │ │ ├── b │ │ │ │ │ │ └── c │ │ │ │ │ │ │ └── placeholder.empty │ │ │ │ │ └── glide.yaml │ │ │ │ └── x │ │ │ │ │ ├── glide.yaml │ │ │ │ │ ├── vendor │ │ │ │ │ └── y │ │ │ │ │ └── z │ │ │ │ │ └── placeholder.empty │ │ │ ├── plugin │ │ │ │ └── glide-hello │ │ │ └── rebuild │ │ │ │ └── glide.yaml │ │ ├── tree │ │ │ ├── tree.go │ │ │ └── tree_test.go │ │ └── util │ │ │ ├── normalizename_test.go │ │ │ ├── util.go │ │ │ └── util_test.go │ ├── semver │ │ ├── .travis.yml │ │ ├── CHANGELOG.md │ │ ├── LICENSE.txt │ │ ├── README.md │ │ ├── appveyor.yml │ │ ├── benchmark_test.go │ │ ├── collection.go │ │ ├── collection_test.go │ │ ├── constraints.go │ │ ├── constraints_test.go │ │ ├── doc.go │ │ ├── version.go │ │ └── version_test.go │ └── vcs │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── CHANGELOG.md │ │ ├── LICENSE.txt │ │ ├── README.md │ │ ├── bzr.go │ │ ├── bzr_test.go │ │ ├── errors.go │ │ ├── errors_test.go │ │ ├── git.go │ │ ├── git_test.go │ │ ├── glide.yaml │ │ ├── hg.go │ │ ├── hg_test.go │ │ ├── repo.go │ │ ├── repo_test.go │ │ ├── svn.go │ │ ├── svn_test.go │ │ ├── vcs_local_lookup.go │ │ ├── vcs_remote_lookup.go │ │ └── vcs_remote_lookup_test.go └── urfave │ └── cli │ ├── .gitignore │ ├── .travis.yml │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── altsrc │ ├── flag.go │ ├── flag_test.go │ ├── helpers_test.go │ ├── input_source_context.go │ ├── map_input_source.go │ ├── yaml_command_test.go │ └── yaml_file_loader.go │ ├── app.go │ ├── app_test.go │ ├── appveyor.yml │ ├── autocomplete │ ├── bash_autocomplete │ └── zsh_autocomplete │ ├── category.go │ ├── cli.go │ ├── command.go │ ├── command_test.go │ ├── context.go │ ├── context_test.go │ ├── errors.go │ ├── errors_test.go │ ├── flag.go │ ├── flag_test.go │ ├── funcs.go │ ├── help.go │ ├── help_test.go │ ├── helpers_test.go │ └── runtests └── gopkg.in └── yaml.v2 ├── LICENSE ├── LICENSE.libyaml ├── README.md ├── apic.go ├── decode.go ├── decode_test.go ├── emitterc.go ├── encode.go ├── encode_test.go ├── parserc.go ├── readerc.go ├── resolve.go ├── scannerc.go ├── sorter.go ├── suite_test.go ├── writerc.go ├── yaml.go ├── yamlh.go └── yamlprivateh.go /LICENSE: -------------------------------------------------------------------------------- 1 | Glide Report 2 | The Masterminds 3 | Copyright (C) 2016, Matt Farina 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Glide Report 2 | 3 | ![Terminal Example](img.png) 4 | 5 | This application attempts to help you determine how up to date your Go dependencies 6 | are. It does this by examining data stored in package managers and comparing it 7 | to the information in the projects themselves. 8 | 9 | It does leverage [Glide](https://glide.sh). If your project is not managed by 10 | Glide it will attempt to import it, without making any changes to your `vendor/` 11 | directory using the Glide import functionality. 12 | 13 | _Note, this is alpha software and should be treated as such. The reports are to 14 | help developers start to look deeper._ 15 | 16 | ## How To Install 17 | 18 | While this is prerelease use: 19 | 20 | ```sh 21 | $ go get -u github.com/Masterminds/glide-report 22 | ``` 23 | 24 | Once this is released a more appropriate release version will be available. 25 | 26 | ## How To Use 27 | 28 | Change into the root of a project and run: 29 | 30 | **If you have Glide installed:** 31 | ```sh 32 | $ glide report 33 | ``` 34 | 35 | **If you don't have Glide installed:** 36 | ```sh 37 | $ glide-report 38 | ``` 39 | 40 | There is an optional flag of `-no-color` if you want to turn color off in the 41 | report. So, you can do things like: 42 | 43 | ```sh 44 | $ glide report -no-color | pbcopy 45 | ``` 46 | 47 | On Mac this will create the report, displaying any messages, while the output 48 | of the report will be copied to the clipboard. 49 | 50 | ## What Do Reports Look Like? 51 | 52 | You can view a couple example reports [here](https://gist.github.com/mattfarina/d9e4bfed106af3ea8cf7f0e80a34d196) and [here](https://gist.github.com/mattfarina/fcba945cfd9efc49c284c202d7dfab92). 53 | -------------------------------------------------------------------------------- /glide.lock: -------------------------------------------------------------------------------- 1 | hash: 87059f4a0d95e8611c4ebb202577fa62fa45014c932e30b709564e8adf4ed4f0 2 | updated: 2016-08-23T19:37:25.481677732-04:00 3 | imports: 4 | - name: github.com/Masterminds/glide 5 | version: a539433d59f5a47ce0a2e29295619728f72adc93 6 | subpackages: 7 | - cache 8 | - cfg 9 | - dependency 10 | - godep/strip 11 | - mirrors 12 | - msg 13 | - path 14 | - util 15 | - name: github.com/Masterminds/semver 16 | version: 8d0431362b544d1a3536cca26684828866a7de09 17 | - name: github.com/Masterminds/vcs 18 | version: fbe9fb6ad5b5f35b3e82a7c21123cfc526cbf895 19 | - name: github.com/urfave/cli 20 | version: 1efa31f08b9333f1bd4882d61f9d668a70cd902e 21 | - name: gopkg.in/yaml.v2 22 | version: 53feefa2559fb8dfa8d81baad31be332c97d6c77 23 | testImports: [] 24 | -------------------------------------------------------------------------------- /glide.yaml: -------------------------------------------------------------------------------- 1 | package: github.com/mattfarina/glide-report 2 | import: 3 | - package: github.com/Masterminds/glide 4 | version: ^0.12.0 5 | - package: github.com/Masterminds/vcs 6 | version: ^1.8.0 7 | - package: github.com/Masterminds/semver 8 | version: ^1.1.1 9 | - package: github.com/urfave/cli 10 | version: ^1.18.0 11 | -------------------------------------------------------------------------------- /img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Masterminds/glide-report/2627ea83d5157dc73c40e6b4bef9673fa980cb58/img.png -------------------------------------------------------------------------------- /rules/old.go: -------------------------------------------------------------------------------- 1 | package rules 2 | 3 | import ( 4 | "time" 5 | 6 | "github.com/Masterminds/glide/cache" 7 | "github.com/Masterminds/glide/cfg" 8 | "github.com/Masterminds/glide/msg" 9 | "github.com/Masterminds/vcs" 10 | ) 11 | 12 | func howOld(name string, dep *cfg.Dependency, lock *cfg.Lock, repo vcs.Repo) { 13 | 14 | refs, err := getAllVcsRefs(repo) 15 | if err != nil { 16 | msg.Die("Unable to get refs: %s", err) 17 | } 18 | 19 | srs := getSemVers(refs) 20 | if len(srs) == 0 { 21 | // Get latest commit on default branch or branch in use 22 | // Start with finding the branch, if there is one. 23 | ref := dep.Reference 24 | if dep.Reference == "" { 25 | key, err := cache.Key(repo.Remote()) 26 | if err != nil { 27 | msg.Die("Unable to generate cache key: %s", err) 28 | } 29 | d, err := cache.RepoData(key) 30 | if err != nil { 31 | msg.Die("Unable to get cached repo data: %s", err) 32 | } 33 | ref = d.DefaultBranch 34 | } 35 | err = repo.UpdateVersion(ref) 36 | if err != nil { 37 | msg.Die("Error setting repo version on %s: %s", dep.Name, err) 38 | } 39 | 40 | curr, err := repo.Current() 41 | if err != nil { 42 | msg.Die("Error getting current version on %s: %s", dep.Name, err) 43 | } 44 | 45 | if curr == lock.Version { 46 | ci, err := repo.CommitInfo(lock.Version) 47 | if err == nil { 48 | msg.Puts("%s Using the latest revision on the selected or default branch (from: %s)", markD, ci.Date.Format(time.RFC3339)) 49 | } else { 50 | msg.Puts("%s Using the latest revision on the selected or default branch", markD) 51 | } 52 | return 53 | } 54 | 55 | tci, err := repo.CommitInfo(curr) 56 | if err != nil { 57 | msg.Die("Unable to get commit info for %s: %s", dep.Name, err) 58 | } 59 | 60 | // Get info for current commit 61 | cci, err := repo.CommitInfo(lock.Version) 62 | if err != nil { 63 | msg.Die("Unable to get commit info for %s: %s", dep.Name, err) 64 | } 65 | 66 | // Display based on date difference 67 | dur := tci.Date.Sub(cci.Date) 68 | days := dur.Hours() / 24 69 | if days < 91 { 70 | msg.Puts("%s Using revision within three month from the tip of the branch (%.0f days)", markD, days) 71 | } else if days < 182 { 72 | msg.Puts("%s Using revision between three and six months from the tip of the branch (%.0f days)", markD, days) 73 | } else { 74 | msg.Puts("%s Using revision over six months behind the tip of the branch (%.0f days)", markX, days) 75 | } 76 | } 77 | } 78 | 79 | func isBranch(branch string, repo vcs.Repo) (bool, error) { 80 | branches, err := repo.Branches() 81 | if err != nil { 82 | return false, err 83 | } 84 | for _, b := range branches { 85 | if b == branch { 86 | return true, nil 87 | } 88 | } 89 | return false, nil 90 | } 91 | -------------------------------------------------------------------------------- /rules/rules.go: -------------------------------------------------------------------------------- 1 | package rules 2 | 3 | import ( 4 | "github.com/Masterminds/glide/cfg" 5 | "github.com/Masterminds/glide/msg" 6 | "github.com/Masterminds/semver" 7 | "github.com/Masterminds/vcs" 8 | ) 9 | 10 | var markX = msg.Color(msg.Red, "X") 11 | var markC = msg.Color(msg.Green, "✓") 12 | var markD = msg.Color(msg.Yellow, "●") 13 | 14 | var cbs []cfunc 15 | 16 | func init() { 17 | cbs = []cfunc{ 18 | usesSemver, 19 | howOld, 20 | } 21 | } 22 | 23 | func Setup(noColor bool) { 24 | if noColor { 25 | markX = "X" 26 | markC = "✓" 27 | markD = "●" 28 | } 29 | } 30 | 31 | func Rules() []cfunc { 32 | return cbs 33 | } 34 | 35 | type cfunc func(name string, dep *cfg.Dependency, lock *cfg.Lock, repo vcs.Repo) 36 | 37 | func getSemVers(refs []string) []*semver.Version { 38 | sv := []*semver.Version{} 39 | for _, r := range refs { 40 | v, err := semver.NewVersion(r) 41 | if err == nil { 42 | sv = append(sv, v) 43 | } 44 | } 45 | 46 | return sv 47 | } 48 | 49 | func getAllVcsRefs(repo vcs.Repo) ([]string, error) { 50 | tags, err := repo.Tags() 51 | if err != nil { 52 | return []string{}, err 53 | } 54 | 55 | return tags, nil 56 | } 57 | -------------------------------------------------------------------------------- /rules/uses.go: -------------------------------------------------------------------------------- 1 | package rules 2 | 3 | import ( 4 | "sort" 5 | "strconv" 6 | 7 | "github.com/Masterminds/glide/cfg" 8 | "github.com/Masterminds/glide/msg" 9 | "github.com/Masterminds/semver" 10 | "github.com/Masterminds/vcs" 11 | ) 12 | 13 | func usesSemver(name string, dep *cfg.Dependency, lock *cfg.Lock, repo vcs.Repo) { 14 | 15 | refs, err := getAllVcsRefs(repo) 16 | if err != nil { 17 | msg.Die("Unable to get refs: %s", err) 18 | } 19 | 20 | srs := getSemVers(refs) 21 | var uses bool 22 | if len(srs) > 0 { 23 | msg.Puts("%s Dependency provides Semantic Version releases", markC) 24 | uses = true 25 | } else { 26 | msg.Puts("%s Dependency does not provide Semantic Version releases", markD) 27 | } 28 | 29 | if uses { 30 | tgs, err := repo.TagsFromCommit(lock.Version) 31 | if err != nil { 32 | msg.Die("Unable to get tags from commit: %s", err) 33 | } 34 | 35 | sort.Sort(sort.Reverse(semver.Collection(srs))) 36 | 37 | if len(tgs) == 0 { 38 | msg.Puts("%s Using development revision between Semantic Version releases", markX) 39 | } else { 40 | 41 | tg := tgs[0] 42 | _, err := semver.NewVersion(tg) 43 | if err != nil { 44 | msg.Puts("%s Using non-semantic version (%s) for project supporting Semantic Version", markD, tg) 45 | return 46 | } 47 | i := 0 48 | var latestV *semver.Version 49 | var latest bool 50 | var recent bool 51 | for _, v := range srs { 52 | if i == 0 { 53 | latestV = v 54 | } 55 | if tg == v.Original() { 56 | if i == 0 { 57 | msg.Puts("%s Using latest release (%s)", markC, tg) 58 | latest = true 59 | } else if i > 0 && i < 5 { 60 | msg.Puts("%s Using recent release (%d behind latest, latest: %s, using: %s)", markD, i, latestV.Original(), tg) 61 | recent = true 62 | } else { 63 | msg.Puts("%s %d releases behind latest release (latest: %s, using: %s)", markX, i, latestV.Original(), tg) 64 | } 65 | 66 | if v.Prerelease() != "" { 67 | msg.Puts("%s Using a pre-release version", markX) 68 | } 69 | } 70 | 71 | i++ 72 | } 73 | 74 | if !latest { 75 | c, err := semver.NewConstraint("^" + strconv.FormatInt(latestV.Major(), 10)) 76 | if err != nil { 77 | msg.Die("Unable to generate SemVer constraint: %s", err) 78 | } 79 | 80 | sv, err := semver.NewVersion(tg) 81 | if err != nil { 82 | msg.Die("Unable to generate SemVer on %s: %s", tg, err) 83 | } 84 | if !c.Check(sv) { 85 | if recent { 86 | msg.Puts("%s Not using latest Major Semantic Version", markD) 87 | } else { 88 | msg.Puts("%s Not using latest Major Semantic Version", markX) 89 | } 90 | } else { 91 | msg.Puts("%s Using latest Major Semantic Version", markC) 92 | } 93 | } 94 | } 95 | 96 | } 97 | 98 | } 99 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/.gitignore: -------------------------------------------------------------------------------- 1 | glide 2 | glide.exe 3 | *.a 4 | *.sublime-project 5 | *.sublime-workspace 6 | dist/ 7 | .DS_Store 8 | .idea 9 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | # The feature/go15 branch uses new features in go15. Only testing this branch 4 | # against tip which has the features. 5 | go: 6 | - 1.5 7 | - 1.6 8 | - 1.7 9 | - tip 10 | 11 | # Setting sudo access to false will let Travis CI use containers rather than 12 | # VMs to run the tests. For more details see: 13 | # - http://docs.travis-ci.com/user/workers/container-based-infrastructure/ 14 | # - http://docs.travis-ci.com/user/workers/standard-infrastructure/ 15 | sudo: false 16 | 17 | # The default script is go test -v ./... which will test everything 18 | # in the vendor directory. We don't need to test all dependent packages. 19 | # Only testing this project. 20 | script: 21 | - GO15VENDOREXPERIMENT=1 make test integration-test 22 | 23 | notifications: 24 | webhooks: 25 | urls: 26 | - https://webhooks.gitter.im/e/67e4b42cbf763625d0b4 27 | on_success: change 28 | on_failure: always 29 | on_start: never 30 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/LICENSE: -------------------------------------------------------------------------------- 1 | Glide 2 | The Masterminds 3 | Copyright (C) 2014-2016, Matt Butcher and Matt Farina 4 | Copyright (C) 2016, Hewlett Packard Enterprise Development LP 5 | Copyright (C) 2015, Google 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in 15 | all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/Makefile: -------------------------------------------------------------------------------- 1 | GLIDE_GO_EXECUTABLE ?= go 2 | VERSION := $(shell git describe --tags) 3 | DIST_DIRS := find * -type d -exec 4 | 5 | build: 6 | ${GLIDE_GO_EXECUTABLE} build -o glide -ldflags "-X main.version=${VERSION}" glide.go 7 | 8 | install: build 9 | install -d ${DESTDIR}/usr/local/bin/ 10 | install -m 755 ./glide ${DESTDIR}/usr/local/bin/glide 11 | 12 | test: 13 | ${GLIDE_GO_EXECUTABLE} test . ./gb ./path ./action ./tree ./util ./godep ./godep/strip ./gpm ./cfg ./dependency ./importer ./msg ./repo ./mirrors 14 | 15 | integration-test: 16 | ${GLIDE_GO_EXECUTABLE} build 17 | ./glide up 18 | ./glide install 19 | 20 | clean: 21 | rm -f ./glide.test 22 | rm -f ./glide 23 | rm -rf ./dist 24 | 25 | bootstrap-dist: 26 | ${GLIDE_GO_EXECUTABLE} get -u github.com/franciscocpg/gox 27 | cd ${GOPATH}/src/github.com/franciscocpg/gox && git checkout dc50315fc7992f4fa34a4ee4bb3d60052eeb038e 28 | cd ${GOPATH}/src/github.com/franciscocpg/gox && ${GLIDE_GO_EXECUTABLE} install 29 | 30 | 31 | build-all: 32 | gox -verbose \ 33 | -ldflags "-X main.version=${VERSION}" \ 34 | -os="linux darwin windows freebsd openbsd netbsd plan9" \ 35 | -arch="amd64 386 armv5 armv6 armv7 arm64" \ 36 | -osarch="!darwin/arm64" \ 37 | -output="dist/{{.OS}}-{{.Arch}}/{{.Dir}}" . 38 | 39 | dist: build-all 40 | cd dist && \ 41 | $(DIST_DIRS) cp ../LICENSE {} \; && \ 42 | $(DIST_DIRS) cp ../README.md {} \; && \ 43 | $(DIST_DIRS) tar -zcf glide-${VERSION}-{}.tar.gz {} \; && \ 44 | $(DIST_DIRS) zip -r glide-${VERSION}-{}.zip {} \; && \ 45 | cd .. 46 | 47 | 48 | .PHONY: build test install clean bootstrap-dist build-all dist integration-test 49 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/action/about.go: -------------------------------------------------------------------------------- 1 | package action 2 | 3 | import "github.com/Masterminds/glide/msg" 4 | 5 | const aboutMessage = ` 6 | Glide: Vendor Package Management for Go. Manage your vendor and vendored 7 | packages with ease. 8 | 9 | Name: 10 | Aside from being catchy, "glide" is a contraction of "Go Elide". The idea is 11 | to compress the tasks that normally take us lots of time into a just a few 12 | seconds. 13 | 14 | To file issues, obtain the source, or learn more visit: 15 | https://github.com/Masterminds/glide 16 | 17 | Glide is licensed under the MIT License: 18 | 19 | Copyright (C) 2014-2015, Matt Butcher and Matt Farina 20 | Copyright (C) 2015, Google 21 | 22 | Permission is hereby granted, free of charge, to any person obtaining a copy 23 | of this software and associated documentation files (the "Software"), to deal 24 | in the Software without restriction, including without limitation the rights 25 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 26 | copies of the Software, and to permit persons to whom the Software is 27 | furnished to do so, subject to the following conditions: 28 | 29 | The above copyright notice and this permission notice shall be included in 30 | all copies or substantial portions of the Software. 31 | 32 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 33 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 34 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 35 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 36 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 37 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 38 | THE SOFTWARE.` 39 | 40 | // About prints information about Glide. 41 | func About() { 42 | msg.Puts(aboutMessage) 43 | } 44 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/action/about_test.go: -------------------------------------------------------------------------------- 1 | package action 2 | 3 | import ( 4 | "bytes" 5 | "testing" 6 | 7 | "github.com/Masterminds/glide/msg" 8 | ) 9 | 10 | func TestAbout(t *testing.T) { 11 | var buf bytes.Buffer 12 | old := msg.Default.Stdout 13 | msg.Default.Stdout = &buf 14 | About() 15 | 16 | if buf.Len() < len(aboutMessage) { 17 | t.Errorf("expected this to match aboutMessage: %q", buf.String()) 18 | } 19 | 20 | msg.Default.Stdout = old 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/action/cache.go: -------------------------------------------------------------------------------- 1 | package action 2 | 3 | import ( 4 | "os" 5 | 6 | "github.com/Masterminds/glide/cache" 7 | "github.com/Masterminds/glide/msg" 8 | ) 9 | 10 | // CacheClear clears the Glide cache 11 | func CacheClear() { 12 | l := cache.Location() 13 | 14 | err := os.RemoveAll(l) 15 | if err != nil { 16 | msg.Die("Unable to clear the cache: %s", err) 17 | } 18 | 19 | cache.SetupReset() 20 | cache.Setup() 21 | 22 | msg.Info("Glide cache has been cleared.") 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/action/debug.go: -------------------------------------------------------------------------------- 1 | package action 2 | 3 | import ( 4 | "github.com/Masterminds/glide/msg" 5 | ) 6 | 7 | // Debug sets the debugging flags across components. 8 | func Debug(on bool) { 9 | msg.Default.IsDebugging = on 10 | 11 | if on == true { 12 | msg.Default.IsVerbose = on 13 | } 14 | } 15 | 16 | // Verbose sets the verbose flags across components. 17 | func Verbose(on bool) { 18 | msg.Default.IsVerbose = on 19 | } 20 | 21 | // Quiet sets the quiet flags across components. 22 | func Quiet(on bool) { 23 | msg.Default.Quiet = on 24 | } 25 | 26 | // NoColor sets the color flags. 27 | func NoColor(on bool) { 28 | msg.Default.NoColor = on 29 | } 30 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/action/doc.go: -------------------------------------------------------------------------------- 1 | // Package action provides implementations for every Glide command. 2 | // 3 | // This is not a general-purpose library. It is the main flow controller for Glide. 4 | // 5 | // The main glide package acts as a Facade, with this package providing the 6 | // implementation. This package should know nothing of the command line flags or 7 | // runtime characteristics. However, this package is allowed to control the flow 8 | // of the application, including termination. So actions may call `msg.Die()` to 9 | // immediately stop execution of the program. 10 | // 11 | // In general, actions are not required to function as library functions, nor as 12 | // concurrency-safe functions. 13 | package action 14 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/action/get_test.go: -------------------------------------------------------------------------------- 1 | package action 2 | 3 | import ( 4 | "io/ioutil" 5 | "testing" 6 | 7 | "github.com/Masterminds/glide/cfg" 8 | "github.com/Masterminds/glide/msg" 9 | ) 10 | 11 | func TestAddPkgsToConfig(t *testing.T) { 12 | // Route output to discard so it's not displayed with the test output. 13 | o := msg.Default.Stderr 14 | msg.Default.Stderr = ioutil.Discard 15 | 16 | conf := new(cfg.Config) 17 | dep := new(cfg.Dependency) 18 | dep.Name = "github.com/Masterminds/cookoo" 19 | dep.Subpackages = append(dep.Subpackages, "convert") 20 | conf.Imports = append(conf.Imports, dep) 21 | 22 | names := []string{ 23 | "github.com/Masterminds/cookoo/fmt", 24 | "github.com/Masterminds/semver", 25 | } 26 | 27 | addPkgsToConfig(conf, names, false, true, false) 28 | 29 | if !conf.HasDependency("github.com/Masterminds/semver") { 30 | t.Error("addPkgsToConfig failed to add github.com/Masterminds/semver") 31 | } 32 | 33 | d := conf.Imports.Get("github.com/Masterminds/cookoo") 34 | found := false 35 | for _, s := range d.Subpackages { 36 | if s == "fmt" { 37 | found = true 38 | } 39 | } 40 | if !found { 41 | t.Error("addPkgsToConfig failed to add subpackage to existing import") 42 | } 43 | 44 | // Restore messaging to original location 45 | msg.Default.Stderr = o 46 | } 47 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/action/import_gb.go: -------------------------------------------------------------------------------- 1 | package action 2 | 3 | import ( 4 | "github.com/Masterminds/glide/cfg" 5 | "github.com/Masterminds/glide/gb" 6 | "github.com/Masterminds/glide/msg" 7 | gpath "github.com/Masterminds/glide/path" 8 | ) 9 | 10 | // ImportGB imports GB dependencies into the present glide config. 11 | func ImportGB(dest string) { 12 | base := "." 13 | config := EnsureConfig() 14 | if !gb.Has(base) { 15 | msg.Die("There is no GB manifest to import.") 16 | } 17 | deps, err := gb.Parse(base) 18 | if err != nil { 19 | msg.Die("Failed to extract GB manifest: %s", err) 20 | } 21 | appendImports(deps, config) 22 | writeConfigToFileOrStdout(config, dest) 23 | } 24 | 25 | func appendImports(deps []*cfg.Dependency, config *cfg.Config) { 26 | if len(deps) == 0 { 27 | msg.Info("No dependencies added.") 28 | return 29 | } 30 | 31 | //Append deps to existing dependencies. 32 | if err := config.AddImport(deps...); err != nil { 33 | msg.Die("Failed to add imports: %s", err) 34 | } 35 | } 36 | 37 | // writeConfigToFileOrStdout is a convenience function for import utils. 38 | func writeConfigToFileOrStdout(config *cfg.Config, dest string) { 39 | if dest != "" { 40 | if err := config.WriteFile(dest); err != nil { 41 | msg.Die("Failed to write %s: %s", gpath.GlideFile, err) 42 | } 43 | } else { 44 | o, err := config.Marshal() 45 | if err != nil { 46 | msg.Die("Error encoding config: %s", err) 47 | } 48 | msg.Default.Stdout.Write(o) 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/action/import_godep.go: -------------------------------------------------------------------------------- 1 | package action 2 | 3 | import ( 4 | "github.com/Masterminds/glide/godep" 5 | "github.com/Masterminds/glide/msg" 6 | ) 7 | 8 | // ImportGodep imports a Godep file. 9 | func ImportGodep(dest string) { 10 | base := "." 11 | config := EnsureConfig() 12 | if !godep.Has(base) { 13 | msg.Die("No Godep data found.") 14 | } 15 | deps, err := godep.Parse(base) 16 | if err != nil { 17 | msg.Die("Failed to extract Godeps file: %s", err) 18 | } 19 | appendImports(deps, config) 20 | writeConfigToFileOrStdout(config, dest) 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/action/import_gom.go: -------------------------------------------------------------------------------- 1 | package action 2 | 3 | import ( 4 | "github.com/Masterminds/glide/gom" 5 | "github.com/Masterminds/glide/msg" 6 | ) 7 | 8 | // ImportGom imports a Gomfile. 9 | func ImportGom(dest string) { 10 | base := "." 11 | config := EnsureConfig() 12 | if !gom.Has(base) { 13 | msg.Die("No gom data found.") 14 | } 15 | deps, err := gom.Parse(base) 16 | if err != nil { 17 | msg.Die("Failed to extract Gomfile: %s", err) 18 | } 19 | appendImports(deps, config) 20 | writeConfigToFileOrStdout(config, dest) 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/action/import_gpm.go: -------------------------------------------------------------------------------- 1 | package action 2 | 3 | import ( 4 | "github.com/Masterminds/glide/gpm" 5 | "github.com/Masterminds/glide/msg" 6 | ) 7 | 8 | // ImportGPM imports a GPM file. 9 | func ImportGPM(dest string) { 10 | base := "." 11 | config := EnsureConfig() 12 | if !gpm.Has(base) { 13 | msg.Die("No GPM Godeps file found.") 14 | } 15 | deps, err := gpm.Parse(base) 16 | if err != nil { 17 | msg.Die("Failed to extract GPM Godeps file: %s", err) 18 | } 19 | appendImports(deps, config) 20 | writeConfigToFileOrStdout(config, dest) 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/action/init.go: -------------------------------------------------------------------------------- 1 | package action 2 | 3 | import ( 4 | gpath "github.com/Masterminds/glide/path" 5 | ) 6 | 7 | // Init initializes the action subsystem for handling one or more subesequent actions. 8 | func Init(yaml, home string) { 9 | gpath.GlideFile = yaml 10 | gpath.SetHome(home) 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/action/install.go: -------------------------------------------------------------------------------- 1 | package action 2 | 3 | import ( 4 | "path/filepath" 5 | 6 | "github.com/Masterminds/glide/cache" 7 | "github.com/Masterminds/glide/cfg" 8 | "github.com/Masterminds/glide/msg" 9 | gpath "github.com/Masterminds/glide/path" 10 | "github.com/Masterminds/glide/repo" 11 | ) 12 | 13 | // Install installs a vendor directory based on an existing Glide configuration. 14 | func Install(installer *repo.Installer, stripVendor bool) { 15 | cache.SystemLock() 16 | 17 | base := "." 18 | // Ensure GOPATH 19 | EnsureGopath() 20 | EnsureVendorDir() 21 | conf := EnsureConfig() 22 | 23 | // Lockfile exists 24 | if !gpath.HasLock(base) { 25 | msg.Info("Lock file (glide.lock) does not exist. Performing update.") 26 | Update(installer, false, stripVendor) 27 | return 28 | } 29 | // Load lockfile 30 | lock, err := cfg.ReadLockFile(filepath.Join(base, gpath.LockFile)) 31 | if err != nil { 32 | msg.Die("Could not load lockfile.") 33 | } 34 | // Verify lockfile hasn't changed 35 | hash, err := conf.Hash() 36 | if err != nil { 37 | msg.Die("Could not load lockfile.") 38 | } else if hash != lock.Hash { 39 | msg.Warn("Lock file may be out of date. Hash check of YAML failed. You may need to run 'update'") 40 | } 41 | 42 | // Install 43 | newConf, err := installer.Install(lock, conf) 44 | if err != nil { 45 | msg.Die("Failed to install: %s", err) 46 | } 47 | 48 | msg.Info("Setting references.") 49 | 50 | // Set reference 51 | if err := repo.SetReference(newConf, installer.ResolveTest); err != nil { 52 | msg.Die("Failed to set references: %s (Skip to cleanup)", err) 53 | } 54 | 55 | err = installer.Export(newConf) 56 | if err != nil { 57 | msg.Die("Unable to export dependencies to vendor directory: %s", err) 58 | } 59 | 60 | if stripVendor { 61 | msg.Info("Removing nested vendor and Godeps/_workspace directories...") 62 | err := gpath.StripVendor() 63 | if err != nil { 64 | msg.Err("Unable to strip vendor directories: %s", err) 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/action/list.go: -------------------------------------------------------------------------------- 1 | package action 2 | 3 | import ( 4 | "encoding/json" 5 | "path/filepath" 6 | "sort" 7 | 8 | "github.com/Masterminds/glide/dependency" 9 | "github.com/Masterminds/glide/msg" 10 | ) 11 | 12 | // List lists all of the dependencies of the current project. 13 | // 14 | // Params: 15 | // - dir (string): basedir 16 | // - deep (bool): whether to do a deep scan or a shallow scan 17 | // - format (string): The format to output (text, json, json-pretty) 18 | func List(basedir string, deep bool, format string) { 19 | basedir, err := filepath.Abs(basedir) 20 | if err != nil { 21 | msg.Die("Could not read directory: %s", err) 22 | } 23 | 24 | r, err := dependency.NewResolver(basedir) 25 | if err != nil { 26 | msg.Die("Could not create a resolver: %s", err) 27 | } 28 | h := &dependency.DefaultMissingPackageHandler{Missing: []string{}, Gopath: []string{}, Prefix: "vendor"} 29 | r.Handler = h 30 | 31 | localPkgs, _, err := r.ResolveLocal(deep) 32 | if err != nil { 33 | msg.Die("Error listing dependencies: %s", err) 34 | } 35 | sort.Strings(localPkgs) 36 | installed := make([]string, len(localPkgs)) 37 | for i, pkg := range localPkgs { 38 | relPkg, err := filepath.Rel(basedir, pkg) 39 | if err != nil { 40 | // msg.Warn("Failed to Rel path: %s", err) 41 | relPkg = pkg 42 | } 43 | installed[i] = relPkg 44 | } 45 | l := PackageList{ 46 | Installed: installed, 47 | Missing: h.Missing, 48 | Gopath: h.Gopath, 49 | } 50 | 51 | outputList(l, format) 52 | } 53 | 54 | // PackageList contains the packages being used by their location 55 | type PackageList struct { 56 | Installed []string `json:"installed"` 57 | Missing []string `json:"missing"` 58 | Gopath []string `json:"gopath"` 59 | } 60 | 61 | const ( 62 | textFormat = "text" 63 | jsonFormat = "json" 64 | jsonPrettyFormat = "json-pretty" 65 | ) 66 | 67 | func outputList(l PackageList, format string) { 68 | switch format { 69 | case textFormat: 70 | msg.Puts("INSTALLED packages:") 71 | for _, pkg := range l.Installed { 72 | msg.Puts("\t%s", pkg) 73 | } 74 | 75 | if len(l.Missing) > 0 { 76 | msg.Puts("\nMISSING packages:") 77 | for _, pkg := range l.Missing { 78 | msg.Puts("\t%s", pkg) 79 | } 80 | } 81 | if len(l.Gopath) > 0 { 82 | msg.Puts("\nGOPATH packages:") 83 | for _, pkg := range l.Gopath { 84 | msg.Puts("\t%s", pkg) 85 | } 86 | } 87 | case jsonFormat: 88 | json.NewEncoder(msg.Default.Stdout).Encode(l) 89 | case jsonPrettyFormat: 90 | b, err := json.MarshalIndent(l, "", " ") 91 | if err != nil { 92 | msg.Die("could not unmarshal package list: %s", err) 93 | } 94 | msg.Puts(string(b)) 95 | default: 96 | msg.Die("invalid output format: must be one of: json|json-pretty|text") 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/action/list_test.go: -------------------------------------------------------------------------------- 1 | package action 2 | 3 | import ( 4 | "bytes" 5 | "encoding/json" 6 | "testing" 7 | 8 | "github.com/Masterminds/glide/msg" 9 | ) 10 | 11 | func TestList(t *testing.T) { 12 | msg.Default.PanicOnDie = true 13 | old := msg.Default.Stdout 14 | defer func() { 15 | msg.Default.Stdout = old 16 | }() 17 | 18 | var buf bytes.Buffer 19 | msg.Default.Stdout = &buf 20 | List("../", false, "text") 21 | if buf.Len() < 5 { 22 | t.Error("Expected some data to be found.") 23 | } 24 | 25 | var buf2 bytes.Buffer 26 | msg.Default.Stdout = &buf2 27 | List("../", false, "json") 28 | j := buf2.Bytes() 29 | var o PackageList 30 | err := json.Unmarshal(j, &o) 31 | if err != nil { 32 | t.Errorf("Error unmarshaling json list: %s", err) 33 | } 34 | if len(o.Installed) == 0 { 35 | t.Error("No packages found on json list") 36 | } 37 | 38 | var buf3 bytes.Buffer 39 | msg.Default.Stdout = &buf3 40 | List("../", false, "json-pretty") 41 | j = buf3.Bytes() 42 | var o2 PackageList 43 | err = json.Unmarshal(j, &o2) 44 | if err != nil { 45 | t.Errorf("Error unmarshaling json-pretty list: %s", err) 46 | } 47 | if len(o2.Installed) == 0 { 48 | t.Error("No packages found on json-pretty list") 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/action/mirrors.go: -------------------------------------------------------------------------------- 1 | package action 2 | 3 | import ( 4 | "os" 5 | "path/filepath" 6 | 7 | "github.com/Masterminds/glide/mirrors" 8 | "github.com/Masterminds/glide/msg" 9 | gpath "github.com/Masterminds/glide/path" 10 | ) 11 | 12 | // MirrorsList displays a list of currently setup mirrors. 13 | func MirrorsList() error { 14 | home := gpath.Home() 15 | 16 | op := filepath.Join(home, "mirrors.yaml") 17 | 18 | if _, err := os.Stat(op); os.IsNotExist(err) { 19 | msg.Info("No mirrors exist. No mirrors.yaml file not found") 20 | return nil 21 | } 22 | 23 | ov, err := mirrors.ReadMirrorsFile(op) 24 | if err != nil { 25 | msg.Die("Unable to read mirrors.yaml file: %s", err) 26 | } 27 | 28 | if len(ov.Repos) == 0 { 29 | msg.Info("No mirrors found") 30 | return nil 31 | } 32 | 33 | msg.Info("Mirrors...") 34 | for _, r := range ov.Repos { 35 | if r.Vcs == "" { 36 | msg.Info("--> %s replaced by %s", r.Original, r.Repo) 37 | } else { 38 | msg.Info("--> %s replaced by %s (%s)", r.Original, r.Repo, r.Vcs) 39 | } 40 | } 41 | 42 | return nil 43 | } 44 | 45 | // MirrorsSet sets a mirror to use 46 | func MirrorsSet(o, r, v string) error { 47 | if o == "" || r == "" { 48 | msg.Err("Both the original and mirror values are required") 49 | return nil 50 | } 51 | 52 | home := gpath.Home() 53 | 54 | op := filepath.Join(home, "mirrors.yaml") 55 | 56 | var ov *mirrors.Mirrors 57 | if _, err := os.Stat(op); os.IsNotExist(err) { 58 | msg.Info("No mirrors.yaml file exists. Creating new one") 59 | ov = &mirrors.Mirrors{ 60 | Repos: make(mirrors.MirrorRepos, 0), 61 | } 62 | } else { 63 | ov, err = mirrors.ReadMirrorsFile(op) 64 | if err != nil { 65 | msg.Die("Error reading existing mirrors.yaml file: %s", err) 66 | } 67 | } 68 | 69 | found := false 70 | for i, re := range ov.Repos { 71 | if re.Original == o { 72 | found = true 73 | msg.Info("%s found in mirrors. Replacing with new settings", o) 74 | ov.Repos[i].Repo = r 75 | ov.Repos[i].Vcs = v 76 | } 77 | } 78 | 79 | if !found { 80 | nr := &mirrors.MirrorRepo{ 81 | Original: o, 82 | Repo: r, 83 | Vcs: v, 84 | } 85 | ov.Repos = append(ov.Repos, nr) 86 | } 87 | 88 | msg.Info("%s being set to %s", o, r) 89 | 90 | err := ov.WriteFile(op) 91 | if err != nil { 92 | msg.Err("Error writing mirrors.yaml file: %s", err) 93 | } else { 94 | msg.Info("mirrors.yaml written with changes") 95 | } 96 | 97 | return nil 98 | } 99 | 100 | // MirrorsRemove removes a mirrors setting 101 | func MirrorsRemove(k string) error { 102 | if k == "" { 103 | msg.Err("The mirror to remove is required") 104 | return nil 105 | } 106 | 107 | home := gpath.Home() 108 | 109 | op := filepath.Join(home, "mirrors.yaml") 110 | 111 | if _, err := os.Stat(op); os.IsNotExist(err) { 112 | msg.Err("mirrors.yaml file not found") 113 | return nil 114 | } 115 | 116 | ov, err := mirrors.ReadMirrorsFile(op) 117 | if err != nil { 118 | msg.Die("Unable to read mirrors.yaml file: %s", err) 119 | } 120 | 121 | var nre mirrors.MirrorRepos 122 | var found bool 123 | for _, re := range ov.Repos { 124 | if re.Original != k { 125 | nre = append(nre, re) 126 | } else { 127 | found = true 128 | } 129 | } 130 | 131 | if !found { 132 | msg.Warn("%s was not found in mirrors", k) 133 | } else { 134 | msg.Info("%s was removed from mirrors", k) 135 | ov.Repos = nre 136 | 137 | err = ov.WriteFile(op) 138 | if err != nil { 139 | msg.Err("Error writing mirrors.yaml file: %s", err) 140 | } else { 141 | msg.Info("mirrors.yaml written with changes") 142 | } 143 | } 144 | 145 | return nil 146 | } 147 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/action/name.go: -------------------------------------------------------------------------------- 1 | package action 2 | 3 | import ( 4 | "github.com/Masterminds/glide/msg" 5 | ) 6 | 7 | // Name prints the name of the package, according to the glide.yaml file. 8 | func Name() { 9 | conf := EnsureConfig() 10 | msg.Puts(conf.Name) 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/action/name_test.go: -------------------------------------------------------------------------------- 1 | package action 2 | 3 | import ( 4 | "bytes" 5 | "os" 6 | "testing" 7 | 8 | "github.com/Masterminds/glide/msg" 9 | ) 10 | 11 | func TestName(t *testing.T) { 12 | var buf bytes.Buffer 13 | msg.Default.PanicOnDie = true 14 | ostdout := msg.Default.Stdout 15 | msg.Default.Stdout = &buf 16 | wd, _ := os.Getwd() 17 | if err := os.Chdir("../testdata/name"); err != nil { 18 | t.Errorf("Failed to change directory: %s", err) 19 | } 20 | Name() 21 | if buf.String() != "technosophos.com/x/foo\n" { 22 | t.Errorf("Unexpectedly got name %q", buf.String()) 23 | } 24 | msg.Default.Stdout = ostdout 25 | os.Chdir(wd) 26 | } 27 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/action/no_vendor.go: -------------------------------------------------------------------------------- 1 | package action 2 | 3 | import ( 4 | "os" 5 | "path/filepath" 6 | "strings" 7 | 8 | "github.com/Masterminds/glide/msg" 9 | ) 10 | 11 | // NoVendor generates a list of source code directories, excepting `vendor/`. 12 | // 13 | // If "onlyGo" is true, only folders that have Go code in them will be returned. 14 | // 15 | // If suffix is true, this will append `/...` to every directory. 16 | func NoVendor(path string, onlyGo, suffix bool) { 17 | // This is responsible for printing the results of noVend. 18 | paths, err := noVend(path, onlyGo, suffix) 19 | if err != nil { 20 | msg.Err("Failed to walk file tree: %s", err) 21 | msg.Warn("FIXME: NoVendor should exit with non-zero exit code.") 22 | return 23 | } 24 | 25 | for _, p := range paths { 26 | msg.Puts(p) 27 | } 28 | } 29 | 30 | // noVend takes a directory and returns a list of Go-like files or directories, 31 | // provided the directory is not a vendor directory. 32 | // 33 | // If onlyGo is true, this will filter out all directories that do not contain 34 | // ".go" files. 35 | // 36 | // TODO: Should we move this to its own package? 37 | func noVend(path string, onlyGo, suffix bool) ([]string, error) { 38 | 39 | info, err := os.Stat(path) 40 | if err != nil { 41 | return []string{}, err 42 | } 43 | 44 | if !info.IsDir() { 45 | return []string{path}, nil 46 | } 47 | 48 | res := []string{} 49 | f, err := os.Open(path) 50 | if err != nil { 51 | return res, err 52 | } 53 | 54 | fis, err := f.Readdir(0) 55 | if err != nil { 56 | return res, err 57 | } 58 | 59 | cur := false 60 | 61 | for _, fi := range fis { 62 | if exclude(fi) { 63 | continue 64 | } 65 | 66 | full := filepath.Join(path, fi.Name()) 67 | if fi.IsDir() && !isVend(fi) { 68 | p := "./" + full + "/..." 69 | res = append(res, p) 70 | } else if !fi.IsDir() && isGoish(fi) { 71 | //res = append(res, full) 72 | cur = true 73 | } 74 | } 75 | 76 | // Filter out directories that do not contain Go code 77 | if onlyGo { 78 | res = hasGoSource(res, suffix) 79 | } 80 | 81 | if cur { 82 | res = append(res, ".") 83 | } 84 | 85 | return res, nil 86 | } 87 | 88 | // hasGoSource returns a list of directories that contain Go source. 89 | func hasGoSource(dirs []string, suffix bool) []string { 90 | suf := "/" 91 | if suffix { 92 | suf = "/..." 93 | } 94 | buf := []string{} 95 | for _, d := range dirs { 96 | d := filepath.Dir(d) 97 | found := false 98 | walker := func(p string, fi os.FileInfo, err error) error { 99 | // Dumb optimization 100 | if found { 101 | return nil 102 | } 103 | 104 | // If the file ends with .go, report a match. 105 | if strings.ToLower(filepath.Ext(p)) == ".go" { 106 | found = true 107 | } 108 | 109 | return nil 110 | } 111 | filepath.Walk(d, walker) 112 | 113 | if found { 114 | buf = append(buf, "./"+d+suf) 115 | } 116 | } 117 | return buf 118 | } 119 | 120 | // isVend returns true of this directory is a vendor directory. 121 | // 122 | // TODO: Should we return true for Godeps directory? 123 | func isVend(fi os.FileInfo) bool { 124 | return fi.Name() == "vendor" 125 | } 126 | 127 | // exclude returns true if the directory should be excluded by Go toolchain tools. 128 | // 129 | // Examples: directories prefixed with '.' or '_'. 130 | func exclude(fi os.FileInfo) bool { 131 | if strings.HasPrefix(fi.Name(), "_") { 132 | return true 133 | } 134 | if strings.HasPrefix(fi.Name(), ".") { 135 | return true 136 | } 137 | return false 138 | } 139 | 140 | // isGoish returns true if the file appears to be Go source. 141 | func isGoish(fi os.FileInfo) bool { 142 | return filepath.Ext(fi.Name()) == ".go" 143 | } 144 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/action/no_vendor_test.go: -------------------------------------------------------------------------------- 1 | package action 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/Masterminds/glide/msg" 7 | ) 8 | 9 | func TestNoVendor(t *testing.T) { 10 | msg.Default.PanicOnDie = true 11 | NoVendor("../testdata/nv", false, false) 12 | } 13 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/action/plugin.go: -------------------------------------------------------------------------------- 1 | package action 2 | 3 | import ( 4 | "os" 5 | "os/exec" 6 | 7 | "github.com/Masterminds/glide/msg" 8 | ) 9 | 10 | // Plugin attempts to find and execute a plugin based on a command. 11 | // 12 | // Exit code 99 means the plugin was never executed. Code 1 means the program 13 | // exited badly. 14 | func Plugin(command string, args []string) { 15 | 16 | cwd, err := os.Getwd() 17 | if err != nil { 18 | msg.ExitCode(99) 19 | msg.Die("Could not get working directory: %s", err) 20 | } 21 | 22 | cmd := "glide-" + command 23 | var fullcmd string 24 | if fullcmd, err = exec.LookPath(cmd); err != nil { 25 | fullcmd = cwd + "/" + cmd 26 | if _, err := os.Stat(fullcmd); err != nil { 27 | msg.ExitCode(99) 28 | msg.Die("Command %s does not exist.", cmd) 29 | } 30 | } 31 | 32 | // Turning os.Args first argument from `glide` to `glide-command` 33 | args[0] = cmd 34 | // Removing the first argument (command) 35 | removed := false 36 | for i, v := range args { 37 | if removed == false && v == command { 38 | args = append(args[:i], args[i+1:]...) 39 | removed = true 40 | } 41 | } 42 | pa := os.ProcAttr{ 43 | Files: []*os.File{os.Stdin, os.Stdout, os.Stderr}, 44 | Dir: cwd, 45 | } 46 | 47 | msg.Debug("Delegating to plugin %s (%v)\n", fullcmd, args) 48 | 49 | proc, err := os.StartProcess(fullcmd, args, &pa) 50 | if err != nil { 51 | msg.Err("Failed to execute %s: %s", cmd, err) 52 | os.Exit(98) 53 | } 54 | 55 | if _, err := proc.Wait(); err != nil { 56 | msg.Err(err.Error()) 57 | os.Exit(1) 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/action/plugin_test.go: -------------------------------------------------------------------------------- 1 | package action 2 | 3 | import ( 4 | "os" 5 | "testing" 6 | 7 | "github.com/Masterminds/glide/msg" 8 | ) 9 | 10 | func TestPlugin(t *testing.T) { 11 | wd, _ := os.Getwd() 12 | os.Chdir("../testdata/plugin") 13 | msg.Default.PanicOnDie = true 14 | cmd := "hello" 15 | args := []string{"a", "b"} 16 | // FIXME: Trapping the panic is the nice thing to do. 17 | Plugin(cmd, args) 18 | os.Chdir(wd) 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/action/project_info.go: -------------------------------------------------------------------------------- 1 | package action 2 | 3 | import ( 4 | "bytes" 5 | 6 | "github.com/Masterminds/glide/msg" 7 | ) 8 | 9 | // Info prints information about a project based on a passed in format. 10 | func Info(format string) { 11 | conf := EnsureConfig() 12 | var buffer bytes.Buffer 13 | varInit := false 14 | for _, varfmt := range format { 15 | if varInit { 16 | switch varfmt { 17 | case 'n': 18 | buffer.WriteString(conf.Name) 19 | case 'd': 20 | buffer.WriteString(conf.Description) 21 | case 'h': 22 | buffer.WriteString(conf.Home) 23 | case 'l': 24 | buffer.WriteString(conf.License) 25 | default: 26 | msg.Die("Invalid format %s", string(varfmt)) 27 | } 28 | } else { 29 | switch varfmt { 30 | case '%': 31 | varInit = true 32 | continue 33 | default: 34 | buffer.WriteString(string(varfmt)) 35 | } 36 | } 37 | varInit = false 38 | } 39 | msg.Puts(buffer.String()) 40 | } 41 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/action/rebuild.go: -------------------------------------------------------------------------------- 1 | package action 2 | 3 | import ( 4 | "os" 5 | "os/exec" 6 | "path" 7 | "path/filepath" 8 | "strings" 9 | 10 | "github.com/Masterminds/glide/cfg" 11 | "github.com/Masterminds/glide/msg" 12 | gpath "github.com/Masterminds/glide/path" 13 | ) 14 | 15 | // Rebuild rebuilds '.a' files for a project. 16 | // 17 | // Prior to Go 1.4, this could substantially reduce time on incremental compiles. 18 | // It remains to be seen whether this is tremendously beneficial to modern Go 19 | // programs. 20 | func Rebuild() { 21 | msg.Warn("The rebuild command is deprecated and will be removed in a future version") 22 | msg.Warn("Use the go install command instead") 23 | conf := EnsureConfig() 24 | vpath, err := gpath.Vendor() 25 | if err != nil { 26 | msg.Die("Could not get vendor path: %s", err) 27 | } 28 | 29 | msg.Info("Building dependencies.\n") 30 | 31 | if len(conf.Imports) == 0 { 32 | msg.Info("No dependencies found. Nothing built.\n") 33 | return 34 | } 35 | 36 | for _, dep := range conf.Imports { 37 | if err := buildDep(dep, vpath); err != nil { 38 | msg.Warn("Failed to build %s: %s\n", dep.Name, err) 39 | } 40 | } 41 | } 42 | 43 | func buildDep(dep *cfg.Dependency, vpath string) error { 44 | if len(dep.Subpackages) == 0 { 45 | buildPath(dep.Name) 46 | } 47 | 48 | for _, pkg := range dep.Subpackages { 49 | if pkg == "**" || pkg == "..." { 50 | //Info("Building all packages in %s\n", dep.Name) 51 | buildPath(path.Join(dep.Name, "...")) 52 | } else { 53 | paths, err := resolvePackages(vpath, dep.Name, pkg) 54 | if err != nil { 55 | msg.Warn("Error resolving packages: %s", err) 56 | } 57 | buildPaths(paths) 58 | } 59 | } 60 | 61 | return nil 62 | } 63 | 64 | func resolvePackages(vpath, pkg, subpkg string) ([]string, error) { 65 | sdir, _ := os.Getwd() 66 | if err := os.Chdir(filepath.Join(vpath, pkg, subpkg)); err != nil { 67 | return []string{}, err 68 | } 69 | defer os.Chdir(sdir) 70 | p, err := filepath.Glob(path.Join(vpath, pkg, subpkg)) 71 | if err != nil { 72 | return []string{}, err 73 | } 74 | for k, v := range p { 75 | nv := strings.TrimPrefix(v, vpath) 76 | p[k] = strings.TrimPrefix(nv, string(filepath.Separator)) 77 | } 78 | return p, nil 79 | } 80 | 81 | func buildPaths(paths []string) error { 82 | for _, path := range paths { 83 | if err := buildPath(path); err != nil { 84 | return err 85 | } 86 | } 87 | 88 | return nil 89 | } 90 | 91 | func buildPath(path string) error { 92 | msg.Info("Running go build %s\n", path) 93 | // . in a filepath.Join is removed so it needs to be prepended separately. 94 | p := "." + string(filepath.Separator) + filepath.Join("vendor", path) 95 | out, err := exec.Command(goExecutable(), "install", p).CombinedOutput() 96 | if err != nil { 97 | msg.Warn("Failed to run 'go install' for %s: %s", path, string(out)) 98 | } 99 | return err 100 | } 101 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/action/rebuild_test.go: -------------------------------------------------------------------------------- 1 | package action 2 | 3 | import ( 4 | "os" 5 | "testing" 6 | 7 | "github.com/Masterminds/glide/msg" 8 | ) 9 | 10 | func TestRebuild(t *testing.T) { 11 | msg.Default.PanicOnDie = true 12 | wd, _ := os.Getwd() 13 | if err := os.Chdir("../testdata/rebuild"); err != nil { 14 | t.Errorf("Could not change dir: %s (%s)", err, wd) 15 | } 16 | Rebuild() 17 | os.Chdir(wd) 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/action/remove.go: -------------------------------------------------------------------------------- 1 | package action 2 | 3 | import ( 4 | "github.com/Masterminds/glide/cache" 5 | "github.com/Masterminds/glide/cfg" 6 | "github.com/Masterminds/glide/msg" 7 | gpath "github.com/Masterminds/glide/path" 8 | "github.com/Masterminds/glide/repo" 9 | ) 10 | 11 | // Remove removes a dependncy from the configuration. 12 | func Remove(packages []string, inst *repo.Installer) { 13 | cache.SystemLock() 14 | base := gpath.Basepath() 15 | EnsureGopath() 16 | EnsureVendorDir() 17 | conf := EnsureConfig() 18 | glidefile, err := gpath.Glide() 19 | if err != nil { 20 | msg.Die("Could not find Glide file: %s", err) 21 | } 22 | 23 | msg.Info("Preparing to remove %d packages.", len(packages)) 24 | conf.Imports = rmDeps(packages, conf.Imports) 25 | conf.DevImports = rmDeps(packages, conf.DevImports) 26 | 27 | // Copy used to generate locks. 28 | confcopy := conf.Clone() 29 | 30 | //confcopy.Imports = inst.List(confcopy) 31 | 32 | if err := repo.SetReference(confcopy, inst.ResolveTest); err != nil { 33 | msg.Err("Failed to set references: %s", err) 34 | } 35 | 36 | err = inst.Export(confcopy) 37 | if err != nil { 38 | msg.Die("Unable to export dependencies to vendor directory: %s", err) 39 | } 40 | 41 | // Write glide.yaml 42 | if err := conf.WriteFile(glidefile); err != nil { 43 | msg.Die("Failed to write glide YAML file: %s", err) 44 | } 45 | 46 | // Write glide lock 47 | writeLock(conf, confcopy, base) 48 | } 49 | 50 | // rmDeps returns a list of dependencies that do not contain the given pkgs. 51 | // 52 | // It generates neither an error nor a warning for a pkg that does not exist 53 | // in the list of deps. 54 | func rmDeps(pkgs []string, deps []*cfg.Dependency) []*cfg.Dependency { 55 | res := []*cfg.Dependency{} 56 | for _, d := range deps { 57 | rem := false 58 | for _, p := range pkgs { 59 | if p == d.Name { 60 | rem = true 61 | } 62 | } 63 | if !rem { 64 | res = append(res, d) 65 | } 66 | } 67 | return res 68 | } 69 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/action/tree.go: -------------------------------------------------------------------------------- 1 | package action 2 | 3 | import ( 4 | "container/list" 5 | "os" 6 | 7 | "github.com/Masterminds/glide/msg" 8 | "github.com/Masterminds/glide/tree" 9 | "github.com/Masterminds/glide/util" 10 | ) 11 | 12 | // Tree prints a tree representing dependencies. 13 | func Tree(basedir string, showcore bool) { 14 | msg.Warn("The tree command is deprecated and will be removed in a future version") 15 | buildContext, err := util.GetBuildContext() 16 | if err != nil { 17 | msg.Die("Failed to get a build context: %s", err) 18 | } 19 | myName := buildContext.PackageName(basedir) 20 | 21 | if basedir == "." { 22 | var err error 23 | basedir, err = os.Getwd() 24 | if err != nil { 25 | msg.Die("Could not get working directory") 26 | } 27 | } 28 | 29 | msg.Puts(myName) 30 | l := list.New() 31 | l.PushBack(myName) 32 | tree.Display(buildContext, basedir, myName, 1, showcore, l) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/action/update.go: -------------------------------------------------------------------------------- 1 | package action 2 | 3 | import ( 4 | "io/ioutil" 5 | "path/filepath" 6 | 7 | "github.com/Masterminds/glide/cache" 8 | "github.com/Masterminds/glide/cfg" 9 | "github.com/Masterminds/glide/msg" 10 | gpath "github.com/Masterminds/glide/path" 11 | "github.com/Masterminds/glide/repo" 12 | ) 13 | 14 | // Update updates repos and the lock file from the main glide yaml. 15 | func Update(installer *repo.Installer, skipRecursive, stripVendor bool) { 16 | cache.SystemLock() 17 | 18 | base := "." 19 | EnsureGopath() 20 | EnsureVendorDir() 21 | conf := EnsureConfig() 22 | 23 | // Try to check out the initial dependencies. 24 | if err := installer.Checkout(conf); err != nil { 25 | msg.Die("Failed to do initial checkout of config: %s", err) 26 | } 27 | 28 | // Set the versions for the initial dependencies so that resolved dependencies 29 | // are rooted in the correct version of the base. 30 | if err := repo.SetReference(conf, installer.ResolveTest); err != nil { 31 | msg.Die("Failed to set initial config references: %s", err) 32 | } 33 | 34 | // Prior to resolving dependencies we need to start working with a clone 35 | // of the conf because we'll be making real changes to it. 36 | confcopy := conf.Clone() 37 | 38 | if !skipRecursive { 39 | // Get all repos and update them. 40 | err := installer.Update(confcopy) 41 | if err != nil { 42 | msg.Die("Could not update packages: %s", err) 43 | } 44 | 45 | // Set references. There may be no remaining references to set since the 46 | // installer set them as it went to make sure it parsed the right imports 47 | // from the right version of the package. 48 | msg.Info("Setting references for remaining imports") 49 | if err := repo.SetReference(confcopy, installer.ResolveTest); err != nil { 50 | msg.Err("Failed to set references: %s (Skip to cleanup)", err) 51 | } 52 | } 53 | 54 | err := installer.Export(confcopy) 55 | if err != nil { 56 | msg.Die("Unable to export dependencies to vendor directory: %s", err) 57 | } 58 | 59 | // Write glide.yaml (Why? Godeps/GPM/GB?) 60 | // I think we don't need to write a new Glide file because update should not 61 | // change anything important. It will just generate information about 62 | // transative dependencies, all of which belongs exclusively in the lock 63 | // file, not the glide.yaml file. 64 | // TODO(mattfarina): Detect when a new dependency has been added or removed 65 | // from the project. A removed dependency should warn and an added dependency 66 | // should be added to the glide.yaml file. See issue #193. 67 | 68 | if !skipRecursive { 69 | // Write lock 70 | hash, err := conf.Hash() 71 | if err != nil { 72 | msg.Die("Failed to generate config hash. Unable to generate lock file.") 73 | } 74 | lock, err := cfg.NewLockfile(confcopy.Imports, confcopy.DevImports, hash) 75 | if err != nil { 76 | msg.Die("Failed to generate lock file: %s", err) 77 | } 78 | wl := true 79 | if gpath.HasLock(base) { 80 | yml, err := ioutil.ReadFile(filepath.Join(base, gpath.LockFile)) 81 | if err == nil { 82 | l2, err := cfg.LockfileFromYaml(yml) 83 | if err == nil { 84 | f1, err := l2.Fingerprint() 85 | f2, err2 := lock.Fingerprint() 86 | if err == nil && err2 == nil && f1 == f2 { 87 | wl = false 88 | } 89 | } 90 | } 91 | } 92 | if wl { 93 | if err := lock.WriteFile(filepath.Join(base, gpath.LockFile)); err != nil { 94 | msg.Err("Could not write lock file to %s: %s", base, err) 95 | return 96 | } 97 | } else { 98 | msg.Info("Versions did not change. Skipping glide.lock update.") 99 | } 100 | 101 | msg.Info("Project relies on %d dependencies.", len(confcopy.Imports)) 102 | } else { 103 | msg.Warn("Skipping lockfile generation because full dependency tree is not being calculated") 104 | } 105 | 106 | if stripVendor { 107 | msg.Info("Removing nested vendor and Godeps/_workspace directories...") 108 | err := gpath.StripVendor() 109 | if err != nil { 110 | msg.Err("Unable to strip vendor directories: %s", err) 111 | } 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/cache/cache_test.go: -------------------------------------------------------------------------------- 1 | package cache 2 | 3 | import "testing" 4 | 5 | func TestKey(t *testing.T) { 6 | tests := map[string]string{ 7 | "https://github.com/foo/bar": "https-github.com-foo-bar", 8 | "git@github.com:foo/bar": "git-github.com-foo-bar", 9 | "https://github.com:123/foo/bar": "https-github.com-123-foo-bar", 10 | } 11 | 12 | for k, v := range tests { 13 | key, err := Key(k) 14 | if err != nil { 15 | t.Errorf("Cache key generation err: %s", err) 16 | continue 17 | } 18 | if key != v { 19 | t.Errorf("Expected cache key %s for %s but got %s", v, k, key) 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/cache/global_lock.go: -------------------------------------------------------------------------------- 1 | package cache 2 | 3 | import ( 4 | "encoding/json" 5 | "io/ioutil" 6 | "os" 7 | "path/filepath" 8 | "time" 9 | 10 | "github.com/Masterminds/glide/msg" 11 | gpath "github.com/Masterminds/glide/path" 12 | ) 13 | 14 | var isStarted bool 15 | 16 | // SystemLock starts a system rather than application lock. This way multiple 17 | // app instances don't cause race conditions when working in the cache. 18 | func SystemLock() error { 19 | if isStarted { 20 | return nil 21 | } 22 | err := waitOnLock() 23 | if err != nil { 24 | return err 25 | } 26 | err = startLock() 27 | isStarted = true 28 | return err 29 | } 30 | 31 | // SystemUnlock removes the system wide Glide cache lock. 32 | func SystemUnlock() { 33 | lockdone <- struct{}{} 34 | os.Remove(lockFileName) 35 | } 36 | 37 | var lockdone = make(chan struct{}, 1) 38 | 39 | type lockdata struct { 40 | Comment string `json:"comment"` 41 | Pid int `json:"pid"` 42 | Time string `json:"time"` 43 | } 44 | 45 | var lockFileName = filepath.Join(gpath.Home(), "lock.json") 46 | 47 | // Write a lock for now. 48 | func writeLock() error { 49 | ld := &lockdata{ 50 | Comment: "File managed by Glide (https://glide.sh)", 51 | Pid: os.Getpid(), 52 | Time: time.Now().Format(time.RFC3339Nano), 53 | } 54 | 55 | out, err := json.Marshal(ld) 56 | if err != nil { 57 | return err 58 | } 59 | err = ioutil.WriteFile(lockFileName, out, 0755) 60 | return err 61 | } 62 | 63 | func startLock() error { 64 | err := writeLock() 65 | if err != nil { 66 | return err 67 | } 68 | 69 | go func() { 70 | for { 71 | select { 72 | case <-lockdone: 73 | return 74 | default: 75 | time.Sleep(10 * time.Second) 76 | err := writeLock() 77 | if err != nil { 78 | msg.Die("Error using Glide lock: %s", err) 79 | } 80 | } 81 | } 82 | }() 83 | 84 | return nil 85 | } 86 | 87 | func waitOnLock() error { 88 | var announced bool 89 | for { 90 | fi, err := os.Stat(lockFileName) 91 | if err != nil && os.IsNotExist(err) { 92 | return nil 93 | } else if err != nil { 94 | return err 95 | } 96 | 97 | diff := time.Now().Sub(fi.ModTime()) 98 | if diff.Seconds() > 15 { 99 | return nil 100 | } 101 | 102 | if !announced { 103 | announced = true 104 | msg.Info("Waiting on Glide global cache access") 105 | } 106 | 107 | // Check on the lock file every 15 seconds. 108 | // TODO(mattfarina): should this be a different length? 109 | time.Sleep(time.Second) 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/cache/memory.go: -------------------------------------------------------------------------------- 1 | package cache 2 | 3 | import ( 4 | "sync" 5 | 6 | "github.com/Masterminds/glide/msg" 7 | "github.com/Masterminds/semver" 8 | ) 9 | 10 | // Provide an in memory cache of imported project information. 11 | 12 | var defaultMemCache = newMemCache() 13 | 14 | // MemPut put a version into the in memory cache for a name. 15 | // This will silently ignore non-semver and make sure the latest 16 | // is stored. 17 | func MemPut(name, version string) { 18 | defaultMemCache.put(name, version) 19 | } 20 | 21 | // MemTouched returns true if the cache was touched for a name. 22 | func MemTouched(name string) bool { 23 | return defaultMemCache.touched(name) 24 | } 25 | 26 | // MemTouch notes if a name has been looked at. 27 | func MemTouch(name string) { 28 | defaultMemCache.touch(name) 29 | } 30 | 31 | // MemLatest returns the latest, that is most recent, semver release. This 32 | // may be a blank string if no put value 33 | func MemLatest(name string) string { 34 | return defaultMemCache.getLatest(name) 35 | } 36 | 37 | // MemSetCurrent is used to set the current version in use. 38 | func MemSetCurrent(name, version string) { 39 | defaultMemCache.setCurrent(name, version) 40 | } 41 | 42 | // MemCurrent is used to get the current version in use. 43 | func MemCurrent(name string) string { 44 | return defaultMemCache.current(name) 45 | } 46 | 47 | // An in memory cache. 48 | type memCache struct { 49 | sync.RWMutex 50 | latest map[string]string 51 | t map[string]bool 52 | versions map[string][]string 53 | c map[string]string 54 | } 55 | 56 | func newMemCache() *memCache { 57 | return &memCache{ 58 | latest: make(map[string]string), 59 | t: make(map[string]bool), 60 | versions: make(map[string][]string), 61 | c: make(map[string]string), 62 | } 63 | } 64 | 65 | func (m *memCache) setCurrent(name, version string) { 66 | m.Lock() 67 | defer m.Unlock() 68 | 69 | if m.c[name] == "" { 70 | m.c[name] = version 71 | } else { 72 | // If we already have a version try to see if the new or old one is 73 | // semver and use that one. 74 | _, err := semver.NewVersion(m.c[name]) 75 | if err != nil { 76 | _, err2 := semver.NewVersion(version) 77 | if err2 == nil { 78 | m.c[name] = version 79 | } 80 | } 81 | } 82 | } 83 | 84 | func (m *memCache) current(name string) string { 85 | m.RLock() 86 | defer m.RUnlock() 87 | return m.c[name] 88 | } 89 | 90 | func (m *memCache) put(name, version string) { 91 | m.Lock() 92 | defer m.Unlock() 93 | m.t[name] = true 94 | sv, err := semver.NewVersion(version) 95 | if err != nil { 96 | msg.Debug("Ignoring %s version %s: %s", name, version, err) 97 | return 98 | } 99 | 100 | latest, found := m.latest[name] 101 | if found { 102 | lv, err := semver.NewVersion(latest) 103 | if err == nil { 104 | if sv.GreaterThan(lv) { 105 | m.latest[name] = version 106 | } 107 | } 108 | } else { 109 | m.latest[name] = version 110 | } 111 | 112 | found = false 113 | for _, v := range m.versions[name] { 114 | if v == version { 115 | found = true 116 | } 117 | } 118 | if !found { 119 | m.versions[name] = append(m.versions[name], version) 120 | } 121 | } 122 | 123 | func (m *memCache) touch(name string) { 124 | m.Lock() 125 | defer m.Unlock() 126 | m.t[name] = true 127 | } 128 | 129 | func (m *memCache) touched(name string) bool { 130 | m.RLock() 131 | defer m.RUnlock() 132 | return m.t[name] 133 | } 134 | 135 | func (m *memCache) getLatest(name string) string { 136 | m.RLock() 137 | defer m.RUnlock() 138 | return m.latest[name] 139 | } 140 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/cfg/cfg.go: -------------------------------------------------------------------------------- 1 | // Package cfg handles working with the Glide configuration files. 2 | // 3 | // The cfg package contains the ability to parse (unmarshal) and write (marshal) 4 | // glide.yaml and glide.lock files. These files contains the details about 5 | // projects managed by Glide. 6 | // 7 | // To convert yaml into a cfg.Config instance use the cfg.ConfigFromYaml function. 8 | // The yaml, typically in a glide.yaml file, has the following structure. 9 | // 10 | // package: github.com/Masterminds/glide 11 | // homepage: https://masterminds.github.io/glide 12 | // license: MIT 13 | // owners: 14 | // - name: Matt Butcher 15 | // email: technosophos@gmail.com 16 | // homepage: http://technosophos.com 17 | // - name: Matt Farina 18 | // email: matt@mattfarina.com 19 | // homepage: https://www.mattfarina.com 20 | // ignore: 21 | // - appengine 22 | // excludeDirs: 23 | // - node_modules 24 | // import: 25 | // - package: gopkg.in/yaml.v2 26 | // - package: github.com/Masterminds/vcs 27 | // version: ^1.2.0 28 | // repo: git@github.com:Masterminds/vcs 29 | // vcs: git 30 | // - package: github.com/codegangsta/cli 31 | // - package: github.com/Masterminds/semver 32 | // version: ^1.0.0 33 | // 34 | // These elements are: 35 | // 36 | // - package: The top level package is the location in the GOPATH. This is used 37 | // for things such as making sure an import isn't also importing the top level 38 | // package. 39 | // - homepage: To find the place where you can find details about the package or 40 | // applications. For example, http://k8s.io 41 | // - license: The license is either an SPDX license string or the filepath to the 42 | // license. This allows automation and consumers to easily identify the license. 43 | // - owners: The owners is a list of one or more owners for the project. This 44 | // can be a person or organization and is useful for things like notifying the 45 | // owners of a security issue without filing a public bug. 46 | // - ignore: A list of packages for Glide to ignore importing. These are package 47 | // names to ignore rather than directories. 48 | // - excludeDirs: A list of directories in the local codebase to exclude from 49 | // scanning for dependencies. 50 | // - import: A list of packages to import. Each package can include: 51 | // - package: The name of the package to import and the only non-optional item. 52 | // - version: A semantic version, semantic version range, branch, tag, or 53 | // commit id to use. 54 | // - repo: If the package name isn't the repo location or this is a private 55 | // repository it can go here. The package will be checked out from the 56 | // repo and put where the package name specifies. This allows using forks. 57 | // - vcs: A VCS to use such as git, hg, bzr, or svn. This is only needed 58 | // when the type cannot be detected from the name. For example, a repo 59 | // ending in .git or on GitHub can be detected to be Git. For a repo on 60 | // Bitbucket we can contact the API to discover the type. 61 | // - testImport: A list of development packages not already listed under import. 62 | // Each package has the same details as those listed under import. 63 | package cfg 64 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/cfg/config_test.go: -------------------------------------------------------------------------------- 1 | package cfg 2 | 3 | import ( 4 | "testing" 5 | 6 | "gopkg.in/yaml.v2" 7 | ) 8 | 9 | var yml = ` 10 | package: fake/testing 11 | description: foo bar baz 12 | homepage: https://example.com 13 | license: MIT 14 | owners: 15 | - name: foo 16 | email: bar@example.com 17 | homepage: https://example.com 18 | import: 19 | - package: github.com/kylelemons/go-gypsy 20 | subpackages: 21 | - yaml 22 | # Intentionally left spaces at end of next line. 23 | - package: github.com/Masterminds/convert 24 | repo: git@github.com:Masterminds/convert.git 25 | vcs: git 26 | ref: a9949121a2e2192ca92fa6dddfeaaa4a4412d955 27 | subpackages: 28 | - color 29 | - nautical 30 | - radial 31 | os: 32 | - linux 33 | arch: 34 | - i386 35 | - arm 36 | - package: github.com/Masterminds/structable 37 | - package: github.com/Masterminds/cookoo/color 38 | - package: github.com/Masterminds/cookoo/convert 39 | 40 | testImport: 41 | - package: github.com/kylelemons/go-gypsy 42 | ` 43 | 44 | func TestManualConfigFromYaml(t *testing.T) { 45 | cfg := &Config{} 46 | err := yaml.Unmarshal([]byte(yml), &cfg) 47 | if err != nil { 48 | t.Errorf("Unable to Unmarshal config yaml") 49 | } 50 | 51 | if cfg.Name != "fake/testing" { 52 | t.Errorf("Inaccurate name found %s", cfg.Name) 53 | } 54 | 55 | if cfg.Description != "foo bar baz" { 56 | t.Errorf("Inaccurate description found %s", cfg.Description) 57 | } 58 | 59 | if cfg.Home != "https://example.com" { 60 | t.Errorf("Inaccurate homepage found %s", cfg.Home) 61 | } 62 | 63 | if cfg.License != "MIT" { 64 | t.Errorf("Inaccurate license found %s", cfg.License) 65 | } 66 | 67 | found := false 68 | found2 := false 69 | for _, i := range cfg.Imports { 70 | if i.Name == "github.com/Masterminds/convert" { 71 | found = true 72 | ref := "a9949121a2e2192ca92fa6dddfeaaa4a4412d955" 73 | if i.Reference != ref { 74 | t.Errorf("Config reference for cookoo is inaccurate. Expected '%s' found '%s'", ref, i.Reference) 75 | } 76 | } 77 | 78 | if i.Name == "github.com/Masterminds/cookoo" { 79 | found2 = true 80 | if i.Subpackages[0] != "color" { 81 | t.Error("Dependency separating package and subpackage not working") 82 | } 83 | } 84 | } 85 | if !found { 86 | t.Error("Unable to find github.com/Masterminds/convert") 87 | } 88 | if !found2 { 89 | t.Error("Unable to find github.com/Masterminds/cookoo") 90 | } 91 | } 92 | 93 | func TestClone(t *testing.T) { 94 | cfg := &Config{} 95 | err := yaml.Unmarshal([]byte(yml), &cfg) 96 | if err != nil { 97 | t.Errorf("Unable to Unmarshal config yaml") 98 | } 99 | 100 | cfg2 := cfg.Clone() 101 | if cfg2.Name != "fake/testing" { 102 | t.Error("Config cloning failed") 103 | } 104 | if cfg2.License != "MIT" { 105 | t.Error("Config cloning failed to copy License") 106 | } 107 | cfg.Name = "foo" 108 | 109 | if cfg.Name == cfg2.Name { 110 | t.Error("Cloning Config name failed") 111 | } 112 | } 113 | 114 | func TestConfigFromYaml(t *testing.T) { 115 | c, err := ConfigFromYaml([]byte(yml)) 116 | if err != nil { 117 | t.Error("ConfigFromYaml failed to parse yaml") 118 | } 119 | 120 | if c.Name != "fake/testing" { 121 | t.Error("ConfigFromYaml failed to properly parse yaml") 122 | } 123 | } 124 | 125 | func TestHasDependency(t *testing.T) { 126 | c, err := ConfigFromYaml([]byte(yml)) 127 | if err != nil { 128 | t.Error("ConfigFromYaml failed to parse yaml for HasDependency") 129 | } 130 | 131 | if c.HasDependency("github.com/Masterminds/convert") != true { 132 | t.Error("HasDependency failing to pickup depenency") 133 | } 134 | 135 | if c.HasDependency("foo/bar/bar") != false { 136 | t.Error("HasDependency picking up dependency it shouldn't") 137 | } 138 | } 139 | 140 | func TestOwners(t *testing.T) { 141 | o := new(Owner) 142 | o.Name = "foo" 143 | o.Email = "foo@example.com" 144 | o.Home = "https://foo.example.com" 145 | 146 | o2 := o.Clone() 147 | if o2.Name != o.Name || o2.Email != o.Email || o2.Home != o.Home { 148 | t.Error("Unable to clone Owner") 149 | } 150 | 151 | o.Name = "Bar" 152 | if o.Name == o2.Name { 153 | t.Error("Owner clone is a pointer instead of a clone") 154 | } 155 | 156 | s := make(Owners, 0, 1) 157 | s = append(s, o) 158 | s2 := s.Clone() 159 | o3 := s2[0] 160 | 161 | o3.Name = "Qux" 162 | 163 | if o3.Name == o.Name { 164 | t.Error("Owners cloning isn't deep") 165 | } 166 | 167 | cfg := &Config{} 168 | err := yaml.Unmarshal([]byte(yml), &cfg) 169 | if err != nil { 170 | t.Errorf("Unable to Unmarshal config yaml") 171 | } 172 | 173 | if cfg.Owners[0].Name != "foo" || 174 | cfg.Owners[0].Email != "bar@example.com" || 175 | cfg.Owners[0].Home != "https://example.com" { 176 | t.Error("Unable to parse owners from yaml") 177 | } 178 | } 179 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/cfg/lock_test.go: -------------------------------------------------------------------------------- 1 | package cfg 2 | 3 | import ( 4 | "sort" 5 | "strings" 6 | "testing" 7 | ) 8 | 9 | func TestSortLocks(t *testing.T) { 10 | c, err := ConfigFromYaml([]byte(yml)) 11 | if err != nil { 12 | t.Error("ConfigFromYaml failed to parse yaml for TestSortDependencies") 13 | } 14 | 15 | ls := make(Locks, len(c.Imports)) 16 | for i := 0; i < len(c.Imports); i++ { 17 | ls[i] = &Lock{ 18 | Name: c.Imports[i].Name, 19 | Version: c.Imports[i].Reference, 20 | } 21 | } 22 | 23 | if ls[2].Name != "github.com/Masterminds/structable" { 24 | t.Error("Initial dependencies are out of order prior to sort") 25 | } 26 | 27 | sort.Sort(ls) 28 | 29 | if ls[0].Name != "github.com/kylelemons/go-gypsy" || 30 | ls[1].Name != "github.com/Masterminds/convert" || 31 | ls[2].Name != "github.com/Masterminds/cookoo" || 32 | ls[3].Name != "github.com/Masterminds/structable" { 33 | t.Error("Sorting of dependencies failed") 34 | } 35 | } 36 | 37 | const inputSubpkgYaml = ` 38 | imports: 39 | - name: github.com/gogo/protobuf 40 | version: 82d16f734d6d871204a3feb1a73cb220cc92574c 41 | subpackages: 42 | - plugin/equal 43 | - sortkeys 44 | - plugin/face 45 | - plugin/gostring 46 | - vanity 47 | - plugin/grpc 48 | - plugin/marshalto 49 | - plugin/populate 50 | - plugin/oneofcheck 51 | - plugin/size 52 | - plugin/stringer 53 | - plugin/defaultcheck 54 | - plugin/embedcheck 55 | - plugin/description 56 | - plugin/enumstringer 57 | - gogoproto 58 | - plugin/testgen 59 | - plugin/union 60 | - plugin/unmarshal 61 | - protoc-gen-gogo/generator 62 | - protoc-gen-gogo/plugin 63 | - vanity/command 64 | - protoc-gen-gogo/descriptor 65 | - proto 66 | ` 67 | const expectSubpkgYaml = ` 68 | imports: 69 | - name: github.com/gogo/protobuf 70 | version: 82d16f734d6d871204a3feb1a73cb220cc92574c 71 | subpackages: 72 | - gogoproto 73 | - plugin/defaultcheck 74 | - plugin/description 75 | - plugin/embedcheck 76 | - plugin/enumstringer 77 | - plugin/equal 78 | - plugin/face 79 | - plugin/gostring 80 | - plugin/grpc 81 | - plugin/marshalto 82 | - plugin/oneofcheck 83 | - plugin/populate 84 | - plugin/size 85 | - plugin/stringer 86 | - plugin/testgen 87 | - plugin/union 88 | - plugin/unmarshal 89 | - proto 90 | - protoc-gen-gogo/descriptor 91 | - protoc-gen-gogo/generator 92 | - protoc-gen-gogo/plugin 93 | - sortkeys 94 | - vanity 95 | - vanity/command 96 | ` 97 | 98 | func TestSortSubpackages(t *testing.T) { 99 | lf, err := LockfileFromYaml([]byte(inputSubpkgYaml)) 100 | if err != nil { 101 | t.Fatal(err) 102 | } 103 | 104 | out, err := lf.Marshal() 105 | if err != nil { 106 | t.Fatal(err) 107 | } 108 | 109 | if !strings.Contains(string(out), expectSubpkgYaml) { 110 | t.Errorf("Expected %q\n to contain\n%q", string(out), expectSubpkgYaml) 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/dependency/resolver_test.go: -------------------------------------------------------------------------------- 1 | package dependency 2 | 3 | import ( 4 | "os" 5 | "path/filepath" 6 | "strings" 7 | "testing" 8 | 9 | "github.com/Masterminds/glide/cfg" 10 | ) 11 | 12 | func TestResolveLocalShallow(t *testing.T) { 13 | r, err := NewResolver("../") 14 | if err != nil { 15 | t.Fatal(err) 16 | } 17 | 18 | l, _, err := r.ResolveLocal(false) 19 | if err != nil { 20 | t.Fatalf("Failed to resolve: %s", err) 21 | } 22 | 23 | expect := []string{ 24 | "github.com/Masterminds/semver", 25 | "github.com/Masterminds/vcs", 26 | "gopkg.in/yaml.v2", 27 | "github.com/codegangsta/cli", 28 | } 29 | 30 | for _, p := range expect { 31 | found := false 32 | for _, li := range l { 33 | if strings.HasSuffix(li, p) { 34 | found = true 35 | break 36 | } 37 | } 38 | if !found { 39 | t.Errorf("Could not find %s in resolved list.", p) 40 | } 41 | } 42 | } 43 | 44 | func TestResolveLocalDeep(t *testing.T) { 45 | r, err := NewResolver("../") 46 | if err != nil { 47 | t.Fatal(err) 48 | } 49 | h := &DefaultMissingPackageHandler{Missing: []string{}, Gopath: []string{}, Prefix: "../vendor"} 50 | r.Handler = h 51 | 52 | l, _, err := r.ResolveLocal(true) 53 | if err != nil { 54 | t.Fatalf("Failed to resolve: %s", err) 55 | } 56 | 57 | if len(l) < 4 { 58 | t.Errorf("Expected at least 4 deps, got %d", len(l)) 59 | } 60 | } 61 | 62 | func TestResolve(t *testing.T) { 63 | r, err := NewResolver("../") 64 | if err != nil { 65 | t.Fatal(err) 66 | } 67 | h := &DefaultMissingPackageHandler{Missing: []string{}, Gopath: []string{}, Prefix: "../vendor"} 68 | r.Handler = h 69 | 70 | base := filepath.Join(os.Getenv("GOPATH"), "src/github.com/Masterminds/glide/vendor") 71 | l, err := r.Resolve("github.com/codegangsta/cli", base) 72 | if err != nil { 73 | t.Fatalf("Failed to resolve: %s", err) 74 | } 75 | 76 | if len(l) != 1 { 77 | t.Errorf("Expected 1 dep, got %d: %s", len(l), l[0]) 78 | } 79 | 80 | if !strings.HasSuffix("github.com/codegangsta/cli", l[0]) { 81 | t.Errorf("Unexpected package name: %s", l[0]) 82 | } 83 | } 84 | 85 | func TestResolveAll(t *testing.T) { 86 | // These are build dependencies of Glide, so we know they are here. 87 | deps := []*cfg.Dependency{ 88 | {Name: "github.com/codegangsta/cli"}, 89 | {Name: "github.com/Masterminds/semver"}, 90 | {Name: "github.com/Masterminds/vcs"}, 91 | {Name: "gopkg.in/yaml.v2"}, 92 | } 93 | 94 | r, err := NewResolver("../") 95 | if err != nil { 96 | t.Fatalf("No new resolver: %s", err) 97 | } 98 | h := &DefaultMissingPackageHandler{Missing: []string{}, Gopath: []string{}, Prefix: "../vendor"} 99 | r.Handler = h 100 | l, err := r.ResolveAll(deps, false) 101 | if err != nil { 102 | t.Fatalf("Failed to resolve: %s", err) 103 | } 104 | 105 | if len(l) < len(deps) { 106 | t.Errorf("Expected at least %d deps, got %d", len(deps), len(l)) 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/docs/example-glide.yaml: -------------------------------------------------------------------------------- 1 | # The name of this package. 2 | package: github.com/Masterminds/glide 3 | 4 | # External dependencies. 5 | import: 6 | # Minimal definition 7 | # This will use "go get [-u]" to fetch and update the package, and it will 8 | # attempt to keep the release at the tip of master. It does this by looking 9 | # for telltale signs that this is a git, bzr, or hg repo, and then acting 10 | # accordingly. 11 | - package: github.com/kylelemons/go-gypsy 12 | 13 | # Full definition 14 | # This will check out the given Git repo, set the version to master, 15 | # use "git" (not "go get") to manage it, and alias the package to the 16 | # import path github.com/Masterminds/cookoo 17 | - package: github.com/Masterminds/cookoo 18 | vcs: git 19 | version: master 20 | repo: git@github.com:Masterminds/cookoo.git 21 | 22 | # Here's an example with a commit hash for a version. Since repo is not 23 | # specified, this will use git to to try to clone 24 | # 'http://github.com/aokoli/goutils' and then set the revision to the given 25 | # hash. 26 | - package: github.com/aokoli/goutils 27 | vcs: git 28 | version: 9c37978a95bd5c709a15883b6242714ea6709e64 29 | 30 | # MASKING: This takes my fork of goamz (technosophos/goamz) and clones it 31 | # as if it were the crowdmob/goamz package. This is incredibly useful for 32 | # masking packages and/or working with forks or clones. 33 | # 34 | # Note that absolutely no namespace munging happens on the code. If you want 35 | # that, you'll have to do it on your own. The intent of this masking was to 36 | # make it so you don't have to vendor imports. 37 | - package: github.com/crowdmob/goamz 38 | vcs: git 39 | repo: git@github.com:technosophos/goamz.git 40 | 41 | - package: bzr.example.com/foo/bar/trunk 42 | vcs: bzr 43 | repo: bzr://bzr.example.com/foo/bar/trunk 44 | # The version can be a branch, tag, commit id, or a semantic version 45 | # constraint parsable by https://github.com/Masterminds/semver 46 | version: 1.0.0 47 | 48 | - package: hg.example.com/foo/bar 49 | vcs: hg 50 | repo: http://hg.example.com/foo/bar 51 | version: ae081cd1d6cc 52 | 53 | # For SVN, the only valid version is a commit number. Tags and branches go in 54 | # the repo URL. 55 | - package: svn.example.com/foo/bar/trunk 56 | vcs: svn 57 | repo: http://svn.example.com/foo/bar/trunk 58 | 59 | 60 | # If a package is dependent on OS, you can tell Glide to only 61 | # fetch for certain OS or architectures. 62 | # 63 | # os can be any valid GOOS. 64 | # arch can be any valid GOARCH. 65 | - package: github.com/unixy/package 66 | os: 67 | - linux 68 | - darwin 69 | arch: 70 | - amd64 71 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/docs/faq.md: -------------------------------------------------------------------------------- 1 | # Frequently Asked Questions (F.A.Q.) 2 | 3 | ## Q: Why does Glide have the concept of sub-packages when Go doesn't? 4 | 5 | In Go every directory is a package. This works well when you have one repo containing all of your packages. When you have different packages in different VCS locations things become a bit more complicated. A project containing a collection of packages should be handled with the same information including the version. By grouping packages this way we are able to manage the related information. 6 | 7 | ## Q: bzr (or hg) is not working the way I expected. Why? 8 | 9 | These are works in progress, and may need some additional tuning. Please take a look at the [vcs package](https://github.com/masterminds/vcs). If you see a better way to handle it please let us know. 10 | 11 | ## Q: Should I check `vendor/` into version control? 12 | 13 | That's up to you. It's a personal or organizational decision. Glide will help you install the outside dependencies on demand or help you manage the dependencies as they are checked into your version control system. 14 | 15 | By default, commands such as `glide update` and `glide install` install on-demand. To manage a vendor folder that's checked into version control use the flags: 16 | 17 | * `--update-vendored` (aliased to `-u`) to update the vendored dependencies. 18 | * `--strip-vcs` (aliased to `-s`) to strip VCS metadata (e.g., `.git` directories) from the `vendor` folder. 19 | * `--strip-vendor` (aliased to `-v`) to strip nested `vendor/` directories. 20 | 21 | ## Q: How do I import settings from GPM, Godep, Gom, or GB? 22 | 23 | There are two parts to importing. 24 | 25 | 1. If a package you import has configuration for GPM, Godep, Gom, or GB Glide will recursively install the dependencies automatically. 26 | 2. If you would like to import configuration from GPM, Godep, Gom, or GB to Glide see the `glide import` command. For example, you can run `glide import godep` for Glide to detect the projects Godep configuration and generate a `glide.yaml` file for you. 27 | 28 | Each of these will merge your existing `glide.yaml` file with the 29 | dependencies it finds for those managers, and then emit the file as 30 | output. **It will not overwrite your glide.yaml file.** 31 | 32 | You can write it to file like this: 33 | 34 | $ glide import godep -f glide.yaml 35 | 36 | 37 | ## Q: Can Glide fetch a package based on OS or Arch? 38 | 39 | Yes. Using the `os` and `arch` fields on a `package`, you can specify 40 | which OSes and architectures the package should be fetched for. For 41 | example, the following package will only be fetched for 64-bit 42 | Darwin/OSX systems: 43 | 44 | - package: some/package 45 | os: 46 | - darwin 47 | arch: 48 | - amd64 49 | 50 | The package will not be fetched for other architectures or OSes. 51 | 52 | ## Q: How did Glide get its name? 53 | 54 | Aside from being catchy, "glide" is a contraction of "Go Elide". The 55 | idea is to compress the tasks that normally take us lots of time into a 56 | just a few seconds. 57 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/docs/getting-started.md: -------------------------------------------------------------------------------- 1 | # Getting Started With Glide 2 | 3 | This is a quick start guide to using Glide once you have it installed. 4 | 5 | ## Initially Detecting Project Dependencies 6 | 7 | Glide can detect the dependencies in use on a project and create an initial `glide.yaml` file for you. This detection can import the configuration from Godep, GPM, Gom, and GB. To do this change into the top level directory for the project and run: 8 | 9 | $ glide init 10 | 11 | When this is complete you'll have a `glide.yaml` file populated with the projects being used. You can open up this file and even edit it to add information such as versions. 12 | 13 | Running `glide init` will also ask if you would like to use a wizard to discover information about your dependencies versions and use versions or ranges. Each decision is interactive and your choice. 14 | 15 | ## Updating Dependencies 16 | 17 | To fetch the dependencies and set them to any versions specified in the `glide.yaml` file use the following command: 18 | 19 | $ glide up 20 | 21 | The `up` is short for `update`. This will fetch any dependencies specified in the `glide.yaml` file, walk the dependency tree to make sure any dependencies of the dependencies are fetched, and set them to the proper version. While walking the tree it will make sure versions are set and configuration from Godep, GPM, Gom, and GB is imported. 22 | 23 | The fetched dependencies are all placed in the `vendor/` folder at the root of the project. The `go` toolchain will use the dependencies here prior to looking in the `GOPATH` or `GOROOT` if you are using Go 1.6+ or Go 1.5 with the Go 1.5 Vendor Experiment enabled. 24 | 25 | Glide will then create a `glide.lock` file. This file contains the entire dependency tree pinned to specific commit ids. This file, as we'll see in a moment, can be used to recreate the exact dependency tree and versions used. 26 | 27 | If you want to remove nested `vendor/` directories from within dependencies use the `--strip-vendor` or `-v` flag. 28 | 29 | ### Dependency Flattening 30 | 31 | All of the dependencies Glide fetches are into the top level `vendor/` folder for a project. Go provides the ability for each package to have a `vendor/` folder. Glide only uses a top level folder for two reasons: 32 | 33 | 1. Each import location will be compiled into the binary. If the same dependency is imported into three `vendor/` folders it will be in the compiled binary tree times. This can quickly lead to binary bloat. 34 | 2. Instances of types created in a dependency in one `vendor/` folder are not compatible with the same dependency in other locations. Even if they are the same version. Go sees them as different packages because they are in different locations. This is a problem for database drivers, loggers, and many other things. If you [try to pass an instance created from one location of a package to another you'll encounter errors](https://github.com/mattfarina/golang-broken-vendor). 35 | 36 | If a dependency has a `vendor/` directory of its own Glide does not remove it by default. The resolution in the `go` toolchain will use these nested versions if they are present. To remove them use the `--strip-vendor` or `-v` flag on the `up` or `install` commands. 37 | 38 | ## Installing Dependencies 39 | 40 | If you want to install the dependencies needed by a project use the `install` command like so: 41 | 42 | $ glide install 43 | 44 | This command does one of two things: 45 | 46 | * If a `glide.lock` file is present it retrieves, if missing from the `vendor/` folder, the dependency and sets it to the exact version in the `glide.lock` file. The dependencies are fetched and versions set concurrently so this operation is fairly quick. 47 | * If there is no `glide.lock` file then an `update` will be performed. 48 | 49 | If you're not managing the dependency versions for a project but need to install the dependencies you should use the `install` command. 50 | 51 | ## Adding More Dependencies 52 | 53 | Glide can help you add more dependencies to the `glide.yaml` file with the `get` command. 54 | 55 | $ glide get github.com/Masterminds/semver 56 | 57 | The `get` command is similar to `go get` but instead fetches dependencies into the `vendor/` folder and adds them to the `glide.yaml` file. This command can take one or more dependencies to fetch. 58 | 59 | The `get` command can also work with versions. 60 | 61 | $ glide get github.com/Masterminds/semver#~1.2.0 62 | 63 | The `#` is used as a separator between the dependency name and a version to use. The version can be a semantic version, version range, branch, tag, or commit id. 64 | 65 | If no version or range is specified and the dependency uses Semantic Versions Glide will prompt you to ask if you want to use them. 66 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/docs/glide-plugin-example: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # You can execute me through Glide by doing the following: 4 | # - Copy me to a directory on $PATH. _vendor/bin/ will work just fine. 5 | # - Execute `glide plugin-example` 6 | # - ??? 7 | # - Profit 8 | 9 | echo "I received arguments '$@'" 10 | 11 | # This should match the directory from which you executed glide. 12 | echo "My current working directory is $(pwd)" 13 | 14 | # This is the GOPATH for the current glide session. 15 | echo "My GOPATH is $GOPATH" 16 | 17 | # This is the base directory of your project. 18 | echo "The project directory is $GLIDE_PROJECT" 19 | 20 | # This is the location of the glide.yaml file. 21 | echo "The Glide YAML is in $GLIDE_YAML" 22 | 23 | # This is the PATH that the plugin inherited. 24 | echo "My PATH is $PATH" 25 | 26 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/docs/glide.lock.md: -------------------------------------------------------------------------------- 1 | # The glide.lock File 2 | 3 | Where a [`glide.yaml`](glide.yaml.md) file contains the dependencies, versions (including ranges), and other configuration for the local codebase, the related `glide.lock` file contains the complete dependency tree and the revision (commit id) in use. 4 | 5 | Knowing the complete dependency tree is useful for Glide. For example, when the complete tree is known the `glide install` command can install and set the proper revision for multiple dependencies concurrently. This is a fast operation to reproducibly install the dependencies. 6 | 7 | The lock file also provides a record of the complete tree, beyond the needs of your codebase, and the revisions used. This is useful for things like audits or detecting what changed in a dependency tree when troubleshooting a problem. 8 | 9 | The details of this file are not included here as this file should not be edited by hand. If you know how to read the [`glide.yaml`](glide.yaml.md) file you'll be able to generally understand the `glide.lock` file. 10 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/docs/glide.yaml.md: -------------------------------------------------------------------------------- 1 | # The glide.yaml File 2 | 3 | The `glide.yaml` file contains information about the project and the dependent packages. Here the elements of the `glide.yaml` file are outlined. 4 | 5 | package: github.com/Masterminds/glide 6 | homepage: https://masterminds.github.io/glide 7 | license: MIT 8 | owners: 9 | - name: Matt Butcher 10 | email: technosophos@gmail.com 11 | homepage: http://technosophos.com 12 | - name: Matt Farina 13 | email: matt@mattfarina.com 14 | homepage: https://www.mattfarina.com 15 | ignore: 16 | - appengine 17 | excludeDirs: 18 | - node_modules 19 | import: 20 | - package: gopkg.in/yaml.v2 21 | - package: github.com/Masterminds/vcs 22 | version: ^1.2.0 23 | repo: git@github.com:Masterminds/vcs 24 | vcs: git 25 | - package: github.com/codegangsta/cli 26 | - package: github.com/Masterminds/semver 27 | version: ^1.0.0 28 | testImport: 29 | - package: github.com/arschles/assert 30 | 31 | These elements are: 32 | 33 | - `package`: The top level package is the location in the `GOPATH`. This is used for things such as making sure an import isn't also importing the top level package. 34 | - `homepage`: To find the place where you can find details about the package or applications. For example, http://k8s.io 35 | - license: The license is either an [SPDX license](http://spdx.org/licenses/) string or the filepath to the license. This allows automation and consumers to easily identify the license. 36 | - `owners`: The owners is a list of one or more owners for the project. This can be a person or organization and is useful for things like notifying the owners of a security issue without filing a public bug. 37 | - `ignore`: A list of packages for Glide to ignore importing. These are package names to ignore rather than directories. 38 | - `excludeDirs`: A list of directories in the local codebase to exclude from scanning for dependencies. 39 | - `import`: A list of packages to import. Each package can include: 40 | - `package`: The name of the package to import and the only non-optional item. Package names follow the same patterns the `go` tool does. That means: 41 | - Package names that map to a VCS remote location end in .git, .bzr, .hg, or .svn. For example, `example.com/foo/pkg.git/subpkg`. 42 | - GitHub, BitBucket, Launchpad, IBM Bluemix Services, and Go on Google Source are special cases that don't need the VCS extension. 43 | - `version`: A semantic version, semantic version range, branch, tag, or commit id to use. For more information see the [versioning documentation](versions.md). 44 | - `repo`: If the package name isn't the repo location or this is a private repository it can go here. The package will be checked out from the repo and put where the package name specifies. This allows using forks. 45 | - `vcs`: A VCS to use such as git, hg, bzr, or svn. This is only needed when the type cannot be detected from the name. For example, a repo ending in .git or on GitHub can be detected to be Git. For a repo on Bitbucket we can contact the API to discover the type. 46 | - `subpackages`: A record of packages being used within a repository. This does not include all packages within a repository but rather those being used. 47 | - `os`: A list of operating systems used for filtering. If set it will compare the current runtime OS to the one specified and only fetch the dependency if there is a match. If not set filtering is skipped. The names are the same used in build flags and `GOOS` environment variable. 48 | - `arch`: A list of architectures used for filtering. If set it will compare the current runtime architecture to the one specified and only fetch the dependency if there is a match. If not set filtering is skipped. The names are the same used in build flags and `GOARCH` environment variable. 49 | - `testImport`: A list of packages used in tests that are not already listed in `import`. Each package has the same details as those listed under import. 50 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/docs/importing.md: -------------------------------------------------------------------------------- 1 | # Importing 2 | 3 | Glide has limited support for importing from other formats. 4 | 5 | **Note:** If you'd like to help build importers, we'd love some pull 6 | requests. Just take a look at `cmd/godeps.git`. 7 | 8 | ## Godeps and Godeps-Git 9 | 10 | To import from Godeps or Godeps-Git format, run `glide godeps`. This 11 | will read the `glide.yaml`, then look for `Godeps` or `Godeps-Git` files 12 | to also read. It will then attempt to merge the packages in those files 13 | into the current YAML, printing the resulting YAML to standard out. 14 | 15 | The preferred procedure for merging: 16 | 17 | ``` 18 | $ glide godeps # look at the output and see if it's okay 19 | $ glide -q godeps > glide.yaml # Write the merged file 20 | ``` 21 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/docs/index.md: -------------------------------------------------------------------------------- 1 | # Glide: Vendor Package Management for Go 2 | 3 | [Glide](https://glide.sh) is a package manager for [Go](https://golang.org) that is conceptually similar to package managers for other languages such as Cargo for Rust, NPM for Node.js, Pip for Python, Bundler for Ruby, and so forth. 4 | 5 | Glide provides the following functionality: 6 | 7 | * Records dependency information in a `glide.yaml` file. This includes a name, version or version range, version control information for private repos or when the type cannot be detected, and more. 8 | * Tracks the specific revision each package is locked to in a `glide.lock` file. This enables reproducibly fetching the dependency tree. 9 | * Works with Semantic Versions and Semantic Version ranges. 10 | * Supports Git, Bzr, HG, and SVN. These are the same version control systems supported by `go get`. 11 | * Utilizes `vendor/` directories, known as the Vendor Experiment, so that different projects can have differing versions of the same dependencies. 12 | * Allows for aliasing packages which is useful for working with forks. 13 | * Import configuration from Godep, GPM, Gom, and GB. 14 | 15 | ## Installing Glide 16 | 17 | There are a few ways to install Glide. 18 | 19 | 1. Use the shell script to try an automatically install it. `curl https://glide.sh/get | sh` 20 | 2. Download a [versioned release](https://github.com/Masterminds/glide/releases). Glide releases are semantically versioned. 21 | 3. Use a system package manager to install Glide. For example, using `brew install glide` can be used if you're using [Homebrew](http://brew.sh) on Mac. 22 | 4. The latest development snapshot can be installed with `go get`. For example, `go get -u github.com/Masterminds/glide`. This is not a release version. 23 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/docs/plugins.md: -------------------------------------------------------------------------------- 1 | # Glide Plugins 2 | 3 | Glide supports a simple plugin system similar to Git. 4 | 5 | ## Existing Plugins 6 | 7 | Some plugins exist today for Glide including: 8 | 9 | * [glide-vc](https://github.com/sgotti/glide-vc) - The vendor cleaner allows you to strip files files not needed for building your application from the `vendor/` directory. 10 | * [glide-brew](https://github.com/heewa/glide-brew) - Convert Go deps managed by glide to Homebrew resources to help you make brew formulas for you Go programs. 11 | * [glide-hash](https://github.com/mattfarina/glide-hash) - Generates a hash of the `glide.yaml` file compatible with Glides internal hash. 12 | 13 | _Note, to add plugins to this list please create a pull request._ 14 | 15 | ## How Plugins Work 16 | 17 | When Glide encounters a subcommand that it does not know, it will try to delegate it to another executable according to the following rules. 18 | 19 | Example: 20 | 21 | ``` 22 | $ glide install # We know this command, so we execute it 23 | $ glide foo # We don't know this command, so we look for a suitable 24 | # plugin. 25 | ``` 26 | 27 | In the example above, when glide receives the command `foo`, which it does not know, it will do the following: 28 | 29 | 1. Transform the name from `foo` to `glide-foo` 30 | 2. Look on the system `$PATH` for `glide-foo`. If it finds a program by that name, execute it... 31 | 3. Or else, look at the current project's root for `glide-foo`. (That is, look in the same directory as `glide.yaml`). If found, execute it. 32 | 4. If no suitable command is found, exit with an error. 33 | 34 | ## Writing a Glide Plugin 35 | 36 | A Glide plugin can be written in any language you wish, provided that it can be executed from the command line as a subprocess of Glide. The example included with Glide is a simple Bash script. We could just as easily write Go, Python, Perl, or even Java code (with a wrapper) to 37 | execute. 38 | 39 | A glide plugin must be in one of two locations: 40 | 41 | 1. Somewhere on the PATH 42 | 2. In the same directory as `glide.yaml` 43 | 44 | It is recommended that system-wide Glide plugins go in `/usr/local/bin` or `$GOPATH/bin` while project-specific plugins go in the same directory as `glide.yaml`. 45 | 46 | ### Arguments and Flags 47 | 48 | Say Glide is executed like this: 49 | 50 | ``` 51 | $ glide foo -name=Matt myfile.txt 52 | ``` 53 | 54 | Glide will interpret this as a request to execute `glide-foo` with the arguments `-name=Matt myfile.txt`. It will not attempt to interpret those arguments or modify them in any way. 55 | 56 | Hypothetically, if Glide had a `-x` flag of its own, you could call this: 57 | 58 | ``` 59 | $ glide -x foo -name=Matt myfile.txt 60 | ``` 61 | 62 | In this case, glide would interpret and swollow the -x and pass the rest on to `glide-foo` as in the example above. 63 | 64 | ## Example Plugin 65 | 66 | File: glide-foo 67 | 68 | ```bash 69 | #!/bin/bash 70 | 71 | echo "Hello" 72 | ``` 73 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/docs/resolving-imports.md: -------------------------------------------------------------------------------- 1 | # Resolving Imports 2 | 3 | Glide scans an applications codebase to discover the projects to manage in the `vendor/` directory. This happens in a few different ways. Knowing how this works can help you understand what Glide is doing. 4 | 5 | ## At Initialization 6 | 7 | When you run `glide create` or `glide init` to create a `glide.yaml` file for a codebase Glide will scan your codebase to identify the imports. It does this by walking the filesystem to identify packages. In each package it reads the imports within the Go files. 8 | 9 | From this it will attempt to figure out the external packages. External packages are grouped by the root version control system repo with their sub-packages listed underneath. Figuring out the root version control repo compared with the packages underneath it follows the same rules for the `go` tool. 10 | 11 | 1. GitHub, Bitbucket, Launchpad, IBM Jazz, and go.googlesource.com are evaluated with special rules. We know or can talk to an API to learn about these repos. 12 | 2. If the package associated with the repo ends in `.git`, `.hg`, `.bzr`, or `.svn` this is used to determine the root and the type of version control system. 13 | 3. If the rules don't provide an answer a `go get` request occurs to try and lookup the information. 14 | 15 | Again, this is the same way `go` trying to determine an external location when you use `go get`. 16 | 17 | If the project has dependency configuration stored in a Godep, GPM, Gom, or GB file that information will be used to populate the version within the `glide.yaml` file. 18 | 19 | ## At Update 20 | 21 | When `glide update`, `glide up`, `glide get`, or `glide install` (when no `glide.lock` is present) Glide will attempt to discover the complete dependency tree. That is all dependencies including dependencies of dependencies of dependencies. 22 | 23 | ### The Default Option 24 | 25 | The default method is to walk the referenced import tree. The resolver starts by scanning the local application to get a list of imports. Then it looks at the specific package imports, scans the imported package for imports, and repeats the lookup cycle until the complete tree has been fetched. 26 | 27 | That means that only imports referenced in the source are fetched. 28 | 29 | When a version control repo is fetched it does fetch the complete repo. But, it doesn't scan all the packages in the repo for dependencies. Instead, only the packages referenced in the tree are scanned with the imports being followed. 30 | 31 | Along the way configuration stored in Glide, Godep, GPM, Gom, and GB files are used to work out the version to set and fetched repos to. The first version found while walking the import tree wins. 32 | 33 | ### All Possible Dependencies 34 | 35 | Using the `--all-dependencies` flag on `glide update` will change the behavior of the scan. Instead of walking the import tree it walks the filesystem and fetches all possible packages referenced everywhere. This downloads all packages in the tree. Even those not referenced in an applications source or in support of the applications imports. 36 | 37 | As in other cases, Glide, Godep, GPM, Gom, and GB files are used to set the version of the fetched repo. 38 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/docs/vendor.md: -------------------------------------------------------------------------------- 1 | # Vendor Directories 2 | 3 | With the release of Go 1.5 the `vendor/` directory was added to the resolution locations for a dependent package in addition to the `GOPATH` and `GOROOT`. Prior to Go 1.6 you needed to opt-in before Go would look there by setting the environment variable `GO15VENDOREXPERIMENT=1`. In Go 1.6 this is an opt-out feature. 4 | 5 | _Note, even if you use the `vendor/` directories your codebase needs to be inside the `GOPATH`. With the `go` toolchain there is no escaping the `GOPATH`._ 6 | 7 | The resolution locations for a dependent package are: 8 | 9 | * The `vendor/` directory within the current package. 10 | * Walk up the directory tree looking for the package in a parents `vendor/` directory. 11 | * Look for the package in the `GOPATH`. 12 | * Use the package in the `GOROOT` (where the standard library package reside) if present. 13 | 14 | ## Recommendations 15 | 16 | Having worked with the `vendor/` directories since they were first released we've come to some conclusions and recommendations. Glide tries to help you with these. 17 | 18 | 1. Libraries (codebases without a `main` package) should not store outside packages in a `vendor/` folder in their VCS unless they have a specific reason and understand why they're doing it. 19 | 2. In applications (codebases with a `main` package) there should only be one `vendor/` directory at the top level of the codebase. 20 | 21 | There are some important reasons for these recommendations. 22 | 23 | * Each instance of a package, even the same package at the same version, in the directory structure will be in the resulting binaries. If everyone stores their own dependencies separately this will quickly lead to **binary bloat**. 24 | * Instances of a type created from a package in one location are **not compatible** with the same package, even at the exact same version, in another location. [You can see for yourself](https://github.com/mattfarina/golang-broken-vendor). That means loggers, database connections, and other shared instances won't work. 25 | 26 | Because of this Glide flattens the dependency tree into a single top level `vendor/` directory. If a package happens to have some dependencies in their own `vendor/` folder the `go` tool will properly resolve that version. 27 | 28 | ## Why Use A `vendor` Directory? 29 | 30 | If we already have the `GOPATH` to store packages why is there a need for a `vendor/` directory? This is a perfectly valid question. 31 | 32 | What if multiple applications in the `GOPATH` use different versions of the same package? This is a valid problem that's both been encountered in Go applications and widely seen in languages that have been around for a lot longer. 33 | 34 | The `vendor/` directory allows differing codebases to have their own version available without having to be concerned with another codebase that needs a different version interfering with the version it needs. It provides a level of separation for each project. 35 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/docs/versions.md: -------------------------------------------------------------------------------- 1 | # Versions and Ranges 2 | 3 | Glide supports [Semantic Versions](http://semver.org), SemVer ranges, branches, tags, and commit ids as versions. 4 | 5 | ## Basic Ranges 6 | A simple range is in the form `> 1.2.3`. This tells Glide to use the latest versions that's after `1.2.3`. Glide has support for the following operators: 7 | 8 | * `=`: equal (aliased to no operator) 9 | * `!=`: not equal 10 | * `>`: greater than 11 | * `<`: less than 12 | * `>=`: greater than or equal to 13 | * `<=`: less than or equal to 14 | 15 | These can be combined. A `,` is an and operator and a `||` is an or operator. The or operators cause groups of and operators to be checked. For example, `">= 1.2, < 3.0.0 || >= 4.2.3"`. 16 | 17 | ## Hyphen Ranges 18 | 19 | There are multiple shortcuts to handle ranges and the first is hyphens ranges. These look like: 20 | 21 | * `1.2 - 1.4.5` which is equivalent to `>= 1.2, <= 1.4.5` 22 | * `2.3.4 - 4.5` which is equivalent to `>= 2.3.4, <= 4.5` 23 | 24 | ## Wildcards In Comparisons 25 | 26 | The `x`, `X`, and `*` characters can be used as a wildcard character. This works for all comparison operators. When used on the `=` operator it falls back to the patch level comparison (see tilde below). For example, 27 | 28 | * `1.2.x` is equivalent to `>= 1.2.0, < 1.3.0` 29 | * `>= 1.2.x` is equivalent to `>= 1.2.0` 30 | * `<= 2.x` is equivalent to `< 3` 31 | * `*` is equivalent to `>= 0.0.0` 32 | 33 | ## Tilde Range Comparisons (Patch) 34 | 35 | The tilde (`~`) comparison operator is for patch level ranges when a minor version is specified and major level changes when the minor number is missing. For example, 36 | 37 | * `~1.2.3` is equivalent to `>= 1.2.3, < 1.3.0` 38 | * `~1` is equivalent to `>= 1, < 2` 39 | * `~2.3` is equivalent to `>= 2.3, < 2.4` 40 | * `~1.2.x` is equivalent to `>= 1.2.0, < 1.3.0` 41 | * `~1.x` is equivalent to `>= 1, < 2` 42 | 43 | ## Caret Range Comparisons (Major) 44 | 45 | The caret (`^`) comparison operator is for major level changes. This is useful when comparisons of API versions as a major change is API breaking. For example, 46 | 47 | * `^1.2.3` is equivalent to `>= 1.2.3, < 2.0.0` 48 | * `^1.2.x` is equivalent to `>= 1.2.0, < 2.0.0` 49 | * `^2.3` is equivalent to `>= 2.3, < 3` 50 | * `^2.x` is equivalent to `>= 2.0.0, < 3` 51 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/gb/gb.go: -------------------------------------------------------------------------------- 1 | package gb 2 | 3 | import ( 4 | "encoding/json" 5 | "os" 6 | "path/filepath" 7 | 8 | "github.com/Masterminds/glide/cfg" 9 | "github.com/Masterminds/glide/msg" 10 | gpath "github.com/Masterminds/glide/path" 11 | "github.com/Masterminds/glide/util" 12 | ) 13 | 14 | // Has returns true if this dir has a GB-flavored manifest file. 15 | func Has(dir string) bool { 16 | path := filepath.Join(dir, "vendor/manifest") 17 | _, err := os.Stat(path) 18 | return err == nil 19 | } 20 | 21 | // Parse parses a GB-flavored manifest file. 22 | func Parse(dir string) ([]*cfg.Dependency, error) { 23 | path := filepath.Join(dir, "vendor/manifest") 24 | if fi, err := os.Stat(path); err != nil || fi.IsDir() { 25 | return []*cfg.Dependency{}, nil 26 | } 27 | 28 | msg.Info("Found GB manifest file in %s", gpath.StripBasepath(dir)) 29 | msg.Info("--> Parsing GB metadata...") 30 | buf := []*cfg.Dependency{} 31 | file, err := os.Open(path) 32 | if err != nil { 33 | return buf, err 34 | } 35 | defer file.Close() 36 | 37 | man := Manifest{} 38 | 39 | dec := json.NewDecoder(file) 40 | if err := dec.Decode(&man); err != nil { 41 | return buf, err 42 | } 43 | 44 | seen := map[string]bool{} 45 | 46 | for _, d := range man.Dependencies { 47 | pkg, sub := util.NormalizeName(d.Importpath) 48 | if _, ok := seen[pkg]; ok { 49 | if len(sub) == 0 { 50 | continue 51 | } 52 | for _, dep := range buf { 53 | if dep.Name == pkg { 54 | dep.Subpackages = append(dep.Subpackages, sub) 55 | } 56 | } 57 | } else { 58 | seen[pkg] = true 59 | dep := &cfg.Dependency{ 60 | Name: pkg, 61 | Reference: d.Revision, 62 | Repository: d.Repository, 63 | } 64 | if len(sub) > 0 { 65 | dep.Subpackages = []string{sub} 66 | } 67 | buf = append(buf, dep) 68 | } 69 | } 70 | return buf, nil 71 | } 72 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/gb/manifest.go: -------------------------------------------------------------------------------- 1 | // Package gb provides compatibility with GB manifests. 2 | package gb 3 | 4 | // This is lifted wholesale from GB's `vendor/manifest.go` file. 5 | // 6 | // gb's license is MIT-style. 7 | 8 | // Manifest represents the GB manifest file 9 | type Manifest struct { 10 | Version int `json:"version"` 11 | Dependencies []Dependency `json:"dependencies"` 12 | } 13 | 14 | // Dependency represents an individual dependency in the GB manifest file 15 | type Dependency struct { 16 | Importpath string `json:"importpath"` 17 | Repository string `json:"repository"` 18 | Revision string `json:"revision"` 19 | Branch string `json:"branch"` 20 | Path string `json:"path,omitempty"` 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/glide.lock: -------------------------------------------------------------------------------- 1 | hash: 67c5571c33bfcb663d32d2b40b9ce1f2a05a3fa2e9f442077277c2782195729c 2 | updated: 2016-08-11T14:22:17.773372627-04:00 3 | imports: 4 | - name: github.com/codegangsta/cli 5 | version: 1efa31f08b9333f1bd4882d61f9d668a70cd902e 6 | - name: github.com/Masterminds/semver 7 | version: 8d0431362b544d1a3536cca26684828866a7de09 8 | - name: github.com/Masterminds/vcs 9 | version: fbe9fb6ad5b5f35b3e82a7c21123cfc526cbf895 10 | - name: gopkg.in/yaml.v2 11 | version: e4d366fc3c7938e2958e662b4258c7a89e1f0e3e 12 | testImports: [] 13 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/glide.yaml: -------------------------------------------------------------------------------- 1 | package: github.com/Masterminds/glide 2 | homepage: https://glide.sh 3 | license: MIT 4 | owners: 5 | - name: Matt Butcher 6 | email: technosophos@gmail.com 7 | homepage: http://technosophos.com/ 8 | - name: Matt Farina 9 | email: matt@mattfarina.com 10 | homepage: https://www.mattfarina.com/ 11 | import: 12 | - package: gopkg.in/yaml.v2 13 | - package: github.com/Masterminds/vcs 14 | version: ^1.8.0 15 | - package: github.com/codegangsta/cli 16 | version: ^1.16.0 17 | - package: github.com/Masterminds/semver 18 | version: ^1.1.1 19 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/glide_test.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "testing" 5 | ) 6 | 7 | func TestCommandsNonEmpty(t *testing.T) { 8 | commands := commands() 9 | if len(commands) == 0 { 10 | t.Fail() 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/godep/godep.go: -------------------------------------------------------------------------------- 1 | // Package godep provides basic importing of Godep dependencies. 2 | // 3 | // This is not a complete implementation of Godep. 4 | package godep 5 | 6 | import ( 7 | "encoding/json" 8 | "os" 9 | "path/filepath" 10 | "strings" 11 | 12 | "github.com/Masterminds/glide/cfg" 13 | "github.com/Masterminds/glide/msg" 14 | gpath "github.com/Masterminds/glide/path" 15 | "github.com/Masterminds/glide/util" 16 | ) 17 | 18 | // This file contains commands for working with Godep. 19 | 20 | // The Godeps struct from Godep. 21 | // 22 | // https://raw.githubusercontent.com/tools/godep/master/dep.go 23 | // 24 | // We had to copy this because it's in the package main for Godep. 25 | type Godeps struct { 26 | ImportPath string 27 | GoVersion string 28 | Packages []string `json:",omitempty"` // Arguments to save, if any. 29 | Deps []Dependency 30 | 31 | outerRoot string 32 | } 33 | 34 | // Dependency is a modified version of Godep's Dependency struct. 35 | // It drops all of the unexported fields. 36 | type Dependency struct { 37 | ImportPath string 38 | Comment string `json:",omitempty"` // Description of commit, if present. 39 | Rev string // VCS-specific commit ID. 40 | } 41 | 42 | // Has is a command to detect if a package contains a Godeps.json file. 43 | func Has(dir string) bool { 44 | path := filepath.Join(dir, "Godeps/Godeps.json") 45 | _, err := os.Stat(path) 46 | return err == nil 47 | } 48 | 49 | // Parse parses a Godep's Godeps file. 50 | // 51 | // It returns the contents as a dependency array. 52 | func Parse(dir string) ([]*cfg.Dependency, error) { 53 | path := filepath.Join(dir, "Godeps/Godeps.json") 54 | if _, err := os.Stat(path); err != nil { 55 | return []*cfg.Dependency{}, nil 56 | } 57 | msg.Info("Found Godeps.json file in %s", gpath.StripBasepath(dir)) 58 | msg.Info("--> Parsing Godeps metadata...") 59 | 60 | buf := []*cfg.Dependency{} 61 | 62 | godeps := &Godeps{} 63 | 64 | // Get a handle to the file. 65 | file, err := os.Open(path) 66 | if err != nil { 67 | return buf, err 68 | } 69 | defer file.Close() 70 | 71 | dec := json.NewDecoder(file) 72 | if err := dec.Decode(godeps); err != nil { 73 | return buf, err 74 | } 75 | 76 | seen := map[string]bool{} 77 | for _, d := range godeps.Deps { 78 | pkg, sub := util.NormalizeName(d.ImportPath) 79 | if _, ok := seen[pkg]; ok { 80 | if len(sub) == 0 { 81 | continue 82 | } 83 | // Modify existing dep with additional subpackages. 84 | for _, dep := range buf { 85 | if dep.Name == pkg { 86 | dep.Subpackages = append(dep.Subpackages, sub) 87 | } 88 | } 89 | } else { 90 | seen[pkg] = true 91 | dep := &cfg.Dependency{Name: pkg, Reference: d.Rev} 92 | if sub != "" { 93 | dep.Subpackages = []string{sub} 94 | } 95 | buf = append(buf, dep) 96 | } 97 | } 98 | 99 | return buf, nil 100 | } 101 | 102 | // RemoveGodepSubpackages strips subpackages from a cfg.Config dependencies that 103 | // contain "Godeps/_workspace/src" as part of the path. 104 | func RemoveGodepSubpackages(c *cfg.Config) *cfg.Config { 105 | for _, d := range c.Imports { 106 | n := []string{} 107 | for _, v := range d.Subpackages { 108 | if !strings.HasPrefix(v, "Godeps/_workspace/src") { 109 | n = append(n, v) 110 | } 111 | } 112 | d.Subpackages = n 113 | } 114 | 115 | for _, d := range c.DevImports { 116 | n := []string{} 117 | for _, v := range d.Subpackages { 118 | if !strings.HasPrefix(v, "Godeps/_workspace/src") { 119 | n = append(n, v) 120 | } 121 | } 122 | d.Subpackages = n 123 | } 124 | 125 | return c 126 | } 127 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/godep/strip/strip.go: -------------------------------------------------------------------------------- 1 | // Package strip removes Godeps/_workspace and undoes the Godep rewrites. This 2 | // essentially removes the old style (pre-vendor) Godep vendoring. 3 | // 4 | // Note, this functionality is deprecated. Once more projects use the Godep 5 | // support for the core vendoring this will no longer be needed. 6 | package strip 7 | 8 | import ( 9 | "bytes" 10 | "go/ast" 11 | "go/parser" 12 | "go/printer" 13 | "go/token" 14 | "os" 15 | "path/filepath" 16 | "strconv" 17 | "strings" 18 | 19 | "github.com/Masterminds/glide/msg" 20 | ) 21 | 22 | var godepMark = map[string]bool{} 23 | 24 | var vPath = "vendor" 25 | 26 | // GodepWorkspace removes any Godeps/_workspace directories and makes sure 27 | // any rewrites are undone. 28 | // Note, this is not concuccency safe. 29 | func GodepWorkspace(v string) error { 30 | vPath = v 31 | if _, err := os.Stat(vPath); err != nil { 32 | if os.IsNotExist(err) { 33 | msg.Debug("Vendor directory does not exist.") 34 | } 35 | 36 | return err 37 | } 38 | 39 | err := filepath.Walk(vPath, stripGodepWorkspaceHandler) 40 | if err != nil { 41 | return err 42 | } 43 | 44 | // Walk the marked projects to make sure rewrites are undone. 45 | for k := range godepMark { 46 | msg.Info("Removing Godep rewrites for %s", k) 47 | err := filepath.Walk(k, rewriteGodepfilesHandler) 48 | if err != nil { 49 | return err 50 | } 51 | } 52 | 53 | return nil 54 | } 55 | 56 | func stripGodepWorkspaceHandler(path string, info os.FileInfo, err error) error { 57 | // Skip the base vendor directory 58 | if path == vPath { 59 | return nil 60 | } 61 | 62 | name := info.Name() 63 | p := filepath.Dir(path) 64 | pn := filepath.Base(p) 65 | if name == "_workspace" && pn == "Godeps" { 66 | if _, err := os.Stat(path); err == nil { 67 | if info.IsDir() { 68 | // Marking this location to make sure rewrites are undone. 69 | pp := filepath.Dir(p) 70 | godepMark[pp] = true 71 | 72 | msg.Info("Removing: %s", path) 73 | return os.RemoveAll(path) 74 | } 75 | 76 | msg.Debug("%s is not a directory. Skipping removal", path) 77 | return nil 78 | } 79 | } 80 | return nil 81 | } 82 | 83 | func rewriteGodepfilesHandler(path string, info os.FileInfo, err error) error { 84 | name := info.Name() 85 | 86 | if info.IsDir() { 87 | if name == "testdata" || name == "vendor" { 88 | return filepath.SkipDir 89 | } 90 | return nil 91 | } 92 | 93 | if e := filepath.Ext(path); e != ".go" { 94 | return nil 95 | } 96 | 97 | fset := token.NewFileSet() 98 | f, err := parser.ParseFile(fset, path, nil, parser.ParseComments) 99 | if err != nil { 100 | return err 101 | } 102 | 103 | var changed bool 104 | for _, s := range f.Imports { 105 | n, err := strconv.Unquote(s.Path.Value) 106 | if err != nil { 107 | return err 108 | } 109 | q := rewriteGodepImport(n) 110 | if q != name { 111 | s.Path.Value = strconv.Quote(q) 112 | changed = true 113 | } 114 | } 115 | if !changed { 116 | return nil 117 | } 118 | 119 | printerConfig := &printer.Config{Mode: printer.TabIndent | printer.UseSpaces, Tabwidth: 8} 120 | var buffer bytes.Buffer 121 | if err = printerConfig.Fprint(&buffer, fset, f); err != nil { 122 | return err 123 | } 124 | fset = token.NewFileSet() 125 | f, err = parser.ParseFile(fset, name, &buffer, parser.ParseComments) 126 | ast.SortImports(fset, f) 127 | tpath := path + ".temp" 128 | t, err := os.Create(tpath) 129 | if err != nil { 130 | return err 131 | } 132 | if err = printerConfig.Fprint(t, fset, f); err != nil { 133 | return err 134 | } 135 | if err = t.Close(); err != nil { 136 | return err 137 | } 138 | 139 | msg.Debug("Rewriting Godep imports for %s", path) 140 | 141 | // This is required before the rename on windows. 142 | if err = os.Remove(path); err != nil { 143 | return err 144 | } 145 | return os.Rename(tpath, path) 146 | } 147 | 148 | func rewriteGodepImport(n string) string { 149 | if !strings.Contains(n, "Godeps/_workspace/src") { 150 | return n 151 | } 152 | 153 | i := strings.LastIndex(n, "Godeps/_workspace/src") 154 | 155 | return strings.TrimPrefix(n[i:], "Godeps/_workspace/src/") 156 | } 157 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/godep/strip/strip_test.go: -------------------------------------------------------------------------------- 1 | package strip 2 | 3 | import "testing" 4 | 5 | func TestRewriteGodepImport(t *testing.T) { 6 | tests := map[string]string{ 7 | "github.com/Masterminds/glide/action": "github.com/Masterminds/glide/action", 8 | "github.com/tools/godep/Godeps/_workspace/src/github.com/kr/fs": "github.com/kr/fs", 9 | } 10 | 11 | for k, v := range tests { 12 | o := rewriteGodepImport(k) 13 | if o != v { 14 | t.Errorf("Incorrect Godep import path rewritten %s: %s", v, o) 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/gom/gom.go: -------------------------------------------------------------------------------- 1 | package gom 2 | 3 | import ( 4 | "errors" 5 | "os" 6 | "path/filepath" 7 | 8 | "github.com/Masterminds/glide/cfg" 9 | "github.com/Masterminds/glide/msg" 10 | gpath "github.com/Masterminds/glide/path" 11 | "github.com/Masterminds/glide/util" 12 | ) 13 | 14 | // Has returns true if this dir has a Gomfile. 15 | func Has(dir string) bool { 16 | path := filepath.Join(dir, "Gomfile") 17 | fi, err := os.Stat(path) 18 | return err == nil && !fi.IsDir() 19 | } 20 | 21 | // Parse parses a Gomfile. 22 | func Parse(dir string) ([]*cfg.Dependency, error) { 23 | path := filepath.Join(dir, "Gomfile") 24 | if fi, err := os.Stat(path); err != nil || fi.IsDir() { 25 | return []*cfg.Dependency{}, nil 26 | } 27 | 28 | msg.Info("Found Gomfile in %s", gpath.StripBasepath(dir)) 29 | msg.Info("--> Parsing Gomfile metadata...") 30 | buf := []*cfg.Dependency{} 31 | 32 | goms, err := parseGomfile(path) 33 | if err != nil { 34 | return []*cfg.Dependency{}, err 35 | } 36 | 37 | for _, gom := range goms { 38 | // Do we need to skip this dependency? 39 | if val, ok := gom.options["skipdep"]; ok && val.(string) == "true" { 40 | continue 41 | } 42 | 43 | // Check for custom cloning command 44 | if _, ok := gom.options["command"]; ok { 45 | return []*cfg.Dependency{}, errors.New("Glide does not support custom Gomfile commands") 46 | } 47 | 48 | // Check for groups/environments 49 | if val, ok := gom.options["group"]; ok { 50 | groups := toStringSlice(val) 51 | if !stringsContain(groups, "development") && !stringsContain(groups, "production") { 52 | // right now we only support development and production 53 | msg.Info("Skipping dependency '%s' because it isn't in the development or production group", gom.name) 54 | continue 55 | } 56 | } 57 | 58 | pkg, sub := util.NormalizeName(gom.name) 59 | 60 | dep := &cfg.Dependency{ 61 | Name: pkg, 62 | } 63 | 64 | if len(sub) > 0 { 65 | dep.Subpackages = []string{sub} 66 | } 67 | 68 | // Check for a specific revision 69 | if val, ok := gom.options["commit"]; ok { 70 | dep.Reference = val.(string) 71 | } 72 | if val, ok := gom.options["tag"]; ok { 73 | dep.Reference = val.(string) 74 | } 75 | if val, ok := gom.options["branch"]; ok { 76 | dep.Reference = val.(string) 77 | } 78 | 79 | // Parse goos and goarch 80 | if val, ok := gom.options["goos"]; ok { 81 | dep.Os = toStringSlice(val) 82 | } 83 | if val, ok := gom.options["goarch"]; ok { 84 | dep.Arch = toStringSlice(val) 85 | } 86 | 87 | buf = append(buf, dep) 88 | } 89 | 90 | return buf, nil 91 | } 92 | 93 | func stringsContain(v []string, key string) bool { 94 | for _, s := range v { 95 | if s == key { 96 | return true 97 | } 98 | } 99 | return false 100 | } 101 | 102 | func toStringSlice(v interface{}) []string { 103 | if v, ok := v.(string); ok { 104 | return []string{v} 105 | } 106 | 107 | if v, ok := v.([]string); ok { 108 | return v 109 | } 110 | 111 | return []string{} 112 | } 113 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/gom/parser.go: -------------------------------------------------------------------------------- 1 | package gom 2 | 3 | // This is copied + slightly adapted from gom's `gomfile.go` file. 4 | // 5 | // gom's license is MIT-style. 6 | 7 | import ( 8 | "bufio" 9 | "fmt" 10 | "io" 11 | "os" 12 | "regexp" 13 | "strings" 14 | ) 15 | 16 | var qx = `'[^']*'|"[^"]*"` 17 | var kx = `:[a-z][a-z0-9_]*` 18 | var ax = `(?:\s*` + kx + `\s*|,\s*` + kx + `\s*)` 19 | var reGroup = regexp.MustCompile(`\s*group\s+((?:` + kx + `\s*|,\s*` + kx + `\s*)*)\s*do\s*$`) 20 | var reEnd = regexp.MustCompile(`\s*end\s*$`) 21 | var reGom = regexp.MustCompile(`^\s*gom\s+(` + qx + `)\s*((?:,\s*` + kx + `\s*=>\s*(?:` + qx + `|\s*\[\s*` + ax + `*\s*\]\s*))*)$`) 22 | var reOptions = regexp.MustCompile(`(,\s*` + kx + `\s*=>\s*(?:` + qx + `|\s*\[\s*` + ax + `*\s*\]\s*)\s*)`) 23 | 24 | func unquote(name string) string { 25 | name = strings.TrimSpace(name) 26 | if len(name) > 2 { 27 | if (name[0] == '\'' && name[len(name)-1] == '\'') || (name[0] == '"' && name[len(name)-1] == '"') { 28 | return name[1 : len(name)-1] 29 | } 30 | } 31 | return name 32 | } 33 | 34 | func parseOptions(line string, options map[string]interface{}) { 35 | ss := reOptions.FindAllStringSubmatch(line, -1) 36 | reA := regexp.MustCompile(ax) 37 | for _, s := range ss { 38 | kvs := strings.SplitN(strings.TrimSpace(s[0])[1:], "=>", 2) 39 | kvs[0], kvs[1] = strings.TrimSpace(kvs[0]), strings.TrimSpace(kvs[1]) 40 | if kvs[1][0] == '[' { 41 | as := reA.FindAllStringSubmatch(kvs[1][1:len(kvs[1])-1], -1) 42 | a := []string{} 43 | for i := range as { 44 | it := strings.TrimSpace(as[i][0]) 45 | if strings.HasPrefix(it, ",") { 46 | it = strings.TrimSpace(it[1:]) 47 | } 48 | if strings.HasPrefix(it, ":") { 49 | it = strings.TrimSpace(it[1:]) 50 | } 51 | a = append(a, it) 52 | } 53 | options[kvs[0][1:]] = a 54 | } else { 55 | options[kvs[0][1:]] = unquote(kvs[1]) 56 | } 57 | } 58 | } 59 | 60 | // Gom represents configuration from Gom. 61 | type Gom struct { 62 | name string 63 | options map[string]interface{} 64 | } 65 | 66 | func parseGomfile(filename string) ([]Gom, error) { 67 | f, err := os.Open(filename + ".lock") 68 | if err != nil { 69 | f, err = os.Open(filename) 70 | if err != nil { 71 | return nil, err 72 | } 73 | } 74 | br := bufio.NewReader(f) 75 | 76 | goms := make([]Gom, 0) 77 | 78 | n := 0 79 | skip := 0 80 | valid := true 81 | var envs []string 82 | for { 83 | n++ 84 | lb, _, err := br.ReadLine() 85 | if err != nil { 86 | if err == io.EOF { 87 | return goms, nil 88 | } 89 | return nil, err 90 | } 91 | line := strings.TrimSpace(string(lb)) 92 | if line == "" || strings.HasPrefix(line, "#") { 93 | continue 94 | } 95 | 96 | name := "" 97 | options := make(map[string]interface{}) 98 | var items []string 99 | if reGroup.MatchString(line) { 100 | envs = strings.Split(reGroup.FindStringSubmatch(line)[1], ",") 101 | for i := range envs { 102 | envs[i] = strings.TrimSpace(envs[i])[1:] 103 | } 104 | valid = true 105 | continue 106 | } else if reEnd.MatchString(line) { 107 | if !valid { 108 | skip-- 109 | if skip < 0 { 110 | return nil, fmt.Errorf("Syntax Error at line %d", n) 111 | } 112 | } 113 | valid = false 114 | envs = nil 115 | continue 116 | } else if skip > 0 { 117 | continue 118 | } else if reGom.MatchString(line) { 119 | items = reGom.FindStringSubmatch(line)[1:] 120 | name = unquote(items[0]) 121 | parseOptions(items[1], options) 122 | } else { 123 | return nil, fmt.Errorf("Syntax Error at line %d", n) 124 | } 125 | if envs != nil { 126 | options["group"] = envs 127 | } 128 | goms = append(goms, Gom{name, options}) 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/gpm/gpm.go: -------------------------------------------------------------------------------- 1 | // Package gpm reads GPM's Godeps files. 2 | // 3 | // It is not a complete implementaton of GPM. 4 | package gpm 5 | 6 | import ( 7 | "bufio" 8 | "os" 9 | "path/filepath" 10 | "strings" 11 | 12 | "github.com/Masterminds/glide/cfg" 13 | "github.com/Masterminds/glide/msg" 14 | gpath "github.com/Masterminds/glide/path" 15 | ) 16 | 17 | // Has indicates whether a Godeps file exists. 18 | func Has(dir string) bool { 19 | path := filepath.Join(dir, "Godeps") 20 | _, err := os.Stat(path) 21 | return err == nil 22 | } 23 | 24 | // Parse parses a GPM-flavored Godeps file. 25 | func Parse(dir string) ([]*cfg.Dependency, error) { 26 | path := filepath.Join(dir, "Godeps") 27 | if i, err := os.Stat(path); err != nil { 28 | return []*cfg.Dependency{}, nil 29 | } else if i.IsDir() { 30 | msg.Info("Godeps is a directory. This is probably a Godep project.\n") 31 | return []*cfg.Dependency{}, nil 32 | } 33 | msg.Info("Found Godeps file in %s", gpath.StripBasepath(dir)) 34 | msg.Info("--> Parsing GPM metadata...") 35 | 36 | buf := []*cfg.Dependency{} 37 | 38 | file, err := os.Open(path) 39 | if err != nil { 40 | return buf, err 41 | } 42 | scanner := bufio.NewScanner(file) 43 | for scanner.Scan() { 44 | parts, ok := parseGodepsLine(scanner.Text()) 45 | if ok { 46 | dep := &cfg.Dependency{Name: parts[0]} 47 | if len(parts) > 1 { 48 | dep.Reference = parts[1] 49 | } 50 | buf = append(buf, dep) 51 | } 52 | } 53 | if err := scanner.Err(); err != nil { 54 | msg.Warn("Scan failed: %s\n", err) 55 | return buf, err 56 | } 57 | 58 | return buf, nil 59 | } 60 | 61 | func parseGodepsLine(line string) ([]string, bool) { 62 | line = strings.TrimSpace(line) 63 | 64 | if len(line) == 0 || strings.HasPrefix(line, "#") { 65 | return []string{}, false 66 | } 67 | 68 | return strings.Fields(line), true 69 | } 70 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/importer/importer.go: -------------------------------------------------------------------------------- 1 | // Package importer imports dependency configuration from Glide, Godep, GPM, GB and gom 2 | package importer 3 | 4 | import ( 5 | "io/ioutil" 6 | "os" 7 | "path/filepath" 8 | 9 | "github.com/Masterminds/glide/cfg" 10 | "github.com/Masterminds/glide/gb" 11 | "github.com/Masterminds/glide/godep" 12 | "github.com/Masterminds/glide/gom" 13 | "github.com/Masterminds/glide/gpm" 14 | ) 15 | 16 | var i = &DefaultImporter{} 17 | 18 | // Import uses the DefaultImporter to import from Glide, Godep, GPM, GB and gom. 19 | func Import(path string) (bool, []*cfg.Dependency, error) { 20 | return i.Import(path) 21 | } 22 | 23 | // Importer enables importing depenency configuration. 24 | type Importer interface { 25 | 26 | // Import imports dependency configuration. It returns: 27 | // - A bool if any configuration was found. 28 | // - []*cfg.Dependency containing dependency configuration if any is found. 29 | // - An error if one was reported. 30 | Import(path string) (bool, []*cfg.Dependency, error) 31 | } 32 | 33 | // DefaultImporter imports from Glide, Godep, GPM, GB and gom. 34 | type DefaultImporter struct{} 35 | 36 | // Import tries to import configuration from Glide, Godep, GPM, GB and gom. 37 | func (d *DefaultImporter) Import(path string) (bool, []*cfg.Dependency, error) { 38 | 39 | // Try importing from Glide first. 40 | p := filepath.Join(path, "glide.yaml") 41 | if _, err := os.Stat(p); err == nil { 42 | // We found glide configuration. 43 | yml, err := ioutil.ReadFile(p) 44 | if err != nil { 45 | return false, []*cfg.Dependency{}, err 46 | } 47 | conf, err := cfg.ConfigFromYaml(yml) 48 | if err != nil { 49 | return false, []*cfg.Dependency{}, err 50 | } 51 | return true, conf.Imports, nil 52 | } 53 | 54 | // Try importing from Godep 55 | if godep.Has(path) { 56 | deps, err := godep.Parse(path) 57 | if err != nil { 58 | return false, []*cfg.Dependency{}, err 59 | } 60 | return true, deps, nil 61 | } 62 | 63 | // Try importing from GPM 64 | if gpm.Has(path) { 65 | deps, err := gpm.Parse(path) 66 | if err != nil { 67 | return false, []*cfg.Dependency{}, err 68 | } 69 | return true, deps, nil 70 | } 71 | 72 | // Try importin from GB 73 | if gb.Has(path) { 74 | deps, err := gb.Parse(path) 75 | if err != nil { 76 | return false, []*cfg.Dependency{}, err 77 | } 78 | return true, deps, nil 79 | } 80 | 81 | // Try importing from gom 82 | if gom.Has(path) { 83 | deps, err := gom.Parse(path) 84 | if err != nil { 85 | return false, []*cfg.Dependency{}, err 86 | } 87 | return true, deps, nil 88 | } 89 | 90 | // When none are found. 91 | return false, []*cfg.Dependency{}, nil 92 | } 93 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/mirrors/cfg.go: -------------------------------------------------------------------------------- 1 | package mirrors 2 | 3 | import ( 4 | "io/ioutil" 5 | "sort" 6 | "strings" 7 | 8 | "gopkg.in/yaml.v2" 9 | ) 10 | 11 | // Mirrors contains global mirrors to local configuration 12 | type Mirrors struct { 13 | 14 | // Repos contains repo mirror configuration 15 | Repos MirrorRepos `yaml:"repos"` 16 | } 17 | 18 | // Marshal converts a Mirror instance to YAML 19 | func (ov *Mirrors) Marshal() ([]byte, error) { 20 | yml, err := yaml.Marshal(&ov) 21 | if err != nil { 22 | return []byte{}, err 23 | } 24 | return yml, nil 25 | } 26 | 27 | // WriteFile writes an mirrors.yaml file 28 | // 29 | // This is a convenience function that marshals the YAML and then writes it to 30 | // the given file. If the file exists, it will be clobbered. 31 | func (ov *Mirrors) WriteFile(opath string) error { 32 | o, err := ov.Marshal() 33 | if err != nil { 34 | return err 35 | } 36 | return ioutil.WriteFile(opath, o, 0666) 37 | } 38 | 39 | // ReadMirrorsFile loads the contents of an mirrors.yaml file. 40 | func ReadMirrorsFile(opath string) (*Mirrors, error) { 41 | yml, err := ioutil.ReadFile(opath) 42 | if err != nil { 43 | return nil, err 44 | } 45 | ov, err := FromYaml(yml) 46 | if err != nil { 47 | return nil, err 48 | } 49 | return ov, nil 50 | } 51 | 52 | // FromYaml returns an instance of Mirrors from YAML 53 | func FromYaml(yml []byte) (*Mirrors, error) { 54 | ov := &Mirrors{} 55 | err := yaml.Unmarshal([]byte(yml), &ov) 56 | return ov, err 57 | } 58 | 59 | // MarshalYAML is a hook for gopkg.in/yaml.v2. 60 | // It sorts mirror repos lexicographically for reproducibility. 61 | func (ov *Mirrors) MarshalYAML() (interface{}, error) { 62 | 63 | sort.Sort(ov.Repos) 64 | 65 | return ov, nil 66 | } 67 | 68 | // MirrorRepos is a slice of Mirror pointers 69 | type MirrorRepos []*MirrorRepo 70 | 71 | // Len returns the length of the MirrorRepos. This is needed for sorting with 72 | // the sort package. 73 | func (o MirrorRepos) Len() int { 74 | return len(o) 75 | } 76 | 77 | // Less is needed for the sort interface. It compares two MirrorRepos based on 78 | // their original value. 79 | func (o MirrorRepos) Less(i, j int) bool { 80 | 81 | // Names are normalized to lowercase because case affects sorting order. For 82 | // example, Masterminds comes before kylelemons. Making them lowercase 83 | // causes kylelemons to come first which is what is expected. 84 | return strings.ToLower(o[i].Original) < strings.ToLower(o[j].Original) 85 | } 86 | 87 | // Swap is needed for the sort interface. It swaps the position of two 88 | // MirrorRepos. 89 | func (o MirrorRepos) Swap(i, j int) { 90 | o[i], o[j] = o[j], o[i] 91 | } 92 | 93 | // MirrorRepo represents a single repo mirror 94 | type MirrorRepo struct { 95 | Original string `yaml:"original"` 96 | Repo string `yaml:"repo"` 97 | Vcs string `yaml:"vcs,omitempty"` 98 | } 99 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/mirrors/mirrors.go: -------------------------------------------------------------------------------- 1 | // Package mirrors handles managing mirrors in the running application 2 | package mirrors 3 | 4 | import ( 5 | "fmt" 6 | "os" 7 | "path/filepath" 8 | 9 | "github.com/Masterminds/glide/msg" 10 | gpath "github.com/Masterminds/glide/path" 11 | ) 12 | 13 | var mirrors map[string]*mirror 14 | 15 | func init() { 16 | mirrors = make(map[string]*mirror) 17 | } 18 | 19 | type mirror struct { 20 | Repo, Vcs string 21 | } 22 | 23 | // Get retrieves information about an mirror. It returns. 24 | // - bool if found 25 | // - new repo location 26 | // - vcs type 27 | func Get(k string) (bool, string, string) { 28 | o, f := mirrors[k] 29 | if !f { 30 | return false, "", "" 31 | } 32 | 33 | return true, o.Repo, o.Vcs 34 | } 35 | 36 | // Load pulls the mirrors into memory 37 | func Load() error { 38 | home := gpath.Home() 39 | 40 | op := filepath.Join(home, "mirrors.yaml") 41 | 42 | var ov *Mirrors 43 | if _, err := os.Stat(op); os.IsNotExist(err) { 44 | msg.Debug("No mirrors.yaml file exists") 45 | ov = &Mirrors{ 46 | Repos: make(MirrorRepos, 0), 47 | } 48 | return nil 49 | } else if err != nil { 50 | ov = &Mirrors{ 51 | Repos: make(MirrorRepos, 0), 52 | } 53 | return err 54 | } 55 | 56 | var err error 57 | ov, err = ReadMirrorsFile(op) 58 | if err != nil { 59 | return fmt.Errorf("Error reading existing mirrors.yaml file: %s", err) 60 | } 61 | 62 | msg.Info("Loading mirrors from mirrors.yaml file") 63 | for _, o := range ov.Repos { 64 | msg.Debug("Found mirror: %s to %s (%s)", o.Original, o.Repo, o.Vcs) 65 | no := &mirror{ 66 | Repo: o.Repo, 67 | Vcs: o.Vcs, 68 | } 69 | mirrors[o.Original] = no 70 | } 71 | 72 | return nil 73 | } 74 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/mirrors/mirrors_test.go: -------------------------------------------------------------------------------- 1 | package mirrors 2 | 3 | import "testing" 4 | 5 | var oyml = ` 6 | repos: 7 | - original: github.com/Masterminds/semver 8 | repo: file:///path/to/local/repo 9 | vcs: git 10 | - original: github.com/Masterminds/atest 11 | repo: github.com/example/atest 12 | ` 13 | 14 | var ooutyml = `repos: 15 | - original: github.com/Masterminds/atest 16 | repo: github.com/example/atest 17 | - original: github.com/Masterminds/semver 18 | repo: file:///path/to/local/repo 19 | vcs: git 20 | ` 21 | 22 | func TestSortMirrors(t *testing.T) { 23 | ov, err := FromYaml([]byte(oyml)) 24 | if err != nil { 25 | t.Error("Unable to read mirrors yaml") 26 | } 27 | 28 | out, err := ov.Marshal() 29 | if err != nil { 30 | t.Error("Unable to marshal mirrors yaml") 31 | } 32 | 33 | if string(out) != ooutyml { 34 | t.Error("Output mirrors sorting failed") 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/mkdocs.yml: -------------------------------------------------------------------------------- 1 | site_name: Glide Documentation 2 | pages: 3 | - Home: index.md 4 | - Getting Started: getting-started.md 5 | - The glide.yaml File: glide.yaml.md 6 | - Versions and Ranges: versions.md 7 | - Lock file: glide.lock.md 8 | - Commands: commands.md 9 | - Resolving Imports: resolving-imports.md 10 | - Vendor Directories: vendor.md 11 | - Plugins: plugins.md 12 | - F.A.Q.: faq.md 13 | theme: readthedocs 14 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/msg/out.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package msg 4 | 5 | import "fmt" 6 | 7 | // These contanstants map to color codes for shell scripts making them 8 | // human readable. 9 | const ( 10 | Blue = "0;34" 11 | Red = "0;31" 12 | Green = "0;32" 13 | Yellow = "0;33" 14 | Cyan = "0;36" 15 | Pink = "1;35" 16 | ) 17 | 18 | // Color returns a string in a certain color. The first argument is a string 19 | // containing the color code or a constant from the table above mapped to a code. 20 | // 21 | // The following will print the string "Foo" in yellow: 22 | // fmt.Print(Color(Yellow, "Foo")) 23 | func (m *Messenger) Color(code, msg string) string { 24 | if m.NoColor { 25 | return msg 26 | } 27 | return fmt.Sprintf("\033[%sm%s\033[m", code, msg) 28 | } 29 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/msg/out_windows.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | 3 | package msg 4 | 5 | // The color codes here are for compatibility with how Colors are used. Windows 6 | // colors have not been implemented yet. See https://github.com/Masterminds/glide/issues/158 7 | // for more detail. 8 | const ( 9 | Blue = "" 10 | Red = "" 11 | Green = "" 12 | Yellow = "" 13 | Cyan = "" 14 | Pink = "" 15 | ) 16 | 17 | // Color on windows returns no color. See 18 | // https://github.com/Masterminds/glide/issues/158 if you want to help. 19 | func (m *Messenger) Color(code, msg string) string { 20 | return msg 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/path/path_test.go: -------------------------------------------------------------------------------- 1 | package path 2 | 3 | import ( 4 | "os" 5 | "path/filepath" 6 | "testing" 7 | ) 8 | 9 | const testdata = "../testdata/path" 10 | 11 | func TestGlideWD(t *testing.T) { 12 | wd := filepath.Join(testdata, "a/b/c") 13 | found, err := GlideWD(wd) 14 | if err != nil { 15 | t.Errorf("Failed to get Glide directory: %s", err) 16 | } 17 | 18 | if found != filepath.Join(testdata, "a") { 19 | t.Errorf("Expected %s to match %s", found, filepath.Join(wd, "a")) 20 | } 21 | 22 | // This should fail 23 | wd = "/No/Such/Dir" 24 | found, err = GlideWD(wd) 25 | if err == nil { 26 | t.Errorf("Expected to get an error on a non-existent directory, not %s", found) 27 | } 28 | 29 | } 30 | 31 | func TestVendor(t *testing.T) { 32 | td, err := filepath.Abs(testdata) 33 | if err != nil { 34 | t.Fatal(err) 35 | } 36 | wd, _ := os.Getwd() 37 | 38 | os.Chdir(filepath.Join(td, "a/b/c")) 39 | res, err := Vendor() 40 | if err != nil { 41 | t.Errorf("Failed to resolve vendor directory: %s", err) 42 | } 43 | expect := filepath.Join(td, "a", "vendor") 44 | if res != expect { 45 | t.Errorf("Failed to find vendor: expected %s got %s", expect, res) 46 | } 47 | 48 | os.Chdir(filepath.Join(td, "x/y/z")) 49 | res, err = Vendor() 50 | if err != nil { 51 | t.Errorf("Failed to resolve vendor directory: %s", err) 52 | } 53 | expect = filepath.Join(td, "x", "symlinked_vendor") 54 | if res != expect { 55 | t.Errorf("Failed to find vendor: expected %s got %s", expect, res) 56 | } 57 | 58 | os.Chdir(wd) 59 | } 60 | func TestGlide(t *testing.T) { 61 | wd, _ := os.Getwd() 62 | td, err := filepath.Abs(testdata) 63 | if err != nil { 64 | t.Fatal(err) 65 | } 66 | os.Chdir(filepath.Join(td, "a/b/c")) 67 | res, err := Glide() 68 | if err != nil { 69 | t.Errorf("Failed to resolve vendor directory: %s", err) 70 | } 71 | expect := filepath.Join(td, "a", "glide.yaml") 72 | if res != expect { 73 | t.Errorf("Failed to find vendor: expected %s got %s", expect, res) 74 | } 75 | os.Chdir(wd) 76 | } 77 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/path/strip.go: -------------------------------------------------------------------------------- 1 | package path 2 | 3 | import ( 4 | "os" 5 | "path/filepath" 6 | 7 | "github.com/Masterminds/glide/godep/strip" 8 | "github.com/Masterminds/glide/msg" 9 | ) 10 | 11 | // StripVendor removes nested vendor and Godeps/_workspace/ directories. 12 | func StripVendor() error { 13 | searchPath, _ := Vendor() 14 | if _, err := os.Stat(searchPath); err != nil { 15 | if os.IsNotExist(err) { 16 | msg.Debug("Vendor directory does not exist.") 17 | } 18 | 19 | return err 20 | } 21 | 22 | err := filepath.Walk(searchPath, func(path string, info os.FileInfo, err error) error { 23 | // Skip the base vendor directory 24 | if path == searchPath { 25 | return nil 26 | } 27 | 28 | name := info.Name() 29 | if name == "vendor" { 30 | if _, err := os.Stat(path); err == nil { 31 | if info.IsDir() { 32 | msg.Info("Removing: %s", path) 33 | return os.RemoveAll(path) 34 | } 35 | 36 | msg.Debug("%s is not a directory. Skipping removal", path) 37 | return nil 38 | } 39 | } 40 | return nil 41 | }) 42 | if err != nil { 43 | return err 44 | } 45 | 46 | return strip.GodepWorkspace(searchPath) 47 | } 48 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/repo/repo.go: -------------------------------------------------------------------------------- 1 | // Package repo provides tools for working with VCS repositories. 2 | // 3 | // Glide manages repositories in the vendor directory by using the native VCS 4 | // systems of each repository upon which the code relies. 5 | package repo 6 | 7 | // concurrentWorkers is the number of workers to be used in concurrent operations. 8 | var concurrentWorkers = 20 9 | 10 | // UpdatingVendored indicates whether this run of Glide is updating a vendored vendor/ path. 11 | // 12 | // It is related to the --update-vendor flag for update and install. 13 | // 14 | // TODO: This is legacy, and maybe we should handle it differently. It should 15 | // be set either 0 or 1 times, and only at startup. 16 | //var UpdatingVendored bool = false 17 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/repo/semver.go: -------------------------------------------------------------------------------- 1 | package repo 2 | 3 | import ( 4 | "github.com/Masterminds/semver" 5 | "github.com/Masterminds/vcs" 6 | ) 7 | 8 | // Filter a list of versions to only included semantic versions. The response 9 | // is a mapping of the original version to the semantic version. 10 | func getSemVers(refs []string) []*semver.Version { 11 | sv := []*semver.Version{} 12 | for _, r := range refs { 13 | v, err := semver.NewVersion(r) 14 | if err == nil { 15 | sv = append(sv, v) 16 | } 17 | } 18 | 19 | return sv 20 | } 21 | 22 | // Get all the references for a repo. This includes the tags and branches. 23 | func getAllVcsRefs(repo vcs.Repo) ([]string, error) { 24 | tags, err := repo.Tags() 25 | if err != nil { 26 | return []string{}, err 27 | } 28 | 29 | branches, err := repo.Branches() 30 | if err != nil { 31 | return []string{}, err 32 | } 33 | 34 | return append(branches, tags...), nil 35 | } 36 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/repo/set_reference.go: -------------------------------------------------------------------------------- 1 | package repo 2 | 3 | import ( 4 | "sync" 5 | 6 | "github.com/Masterminds/glide/cache" 7 | "github.com/Masterminds/glide/cfg" 8 | "github.com/Masterminds/glide/msg" 9 | "github.com/codegangsta/cli" 10 | ) 11 | 12 | // SetReference is a command to set the VCS reference (commit id, tag, etc) for 13 | // a project. 14 | func SetReference(conf *cfg.Config, resolveTest bool) error { 15 | 16 | if len(conf.Imports) == 0 && len(conf.DevImports) == 0 { 17 | msg.Info("No references set.\n") 18 | return nil 19 | } 20 | 21 | done := make(chan struct{}, concurrentWorkers) 22 | in := make(chan *cfg.Dependency, concurrentWorkers) 23 | var wg sync.WaitGroup 24 | var lock sync.Mutex 25 | var returnErr error 26 | 27 | for i := 0; i < concurrentWorkers; i++ { 28 | go func(ch <-chan *cfg.Dependency) { 29 | for { 30 | select { 31 | case dep := <-ch: 32 | 33 | var loc string 34 | if dep.Repository != "" { 35 | loc = dep.Repository 36 | } else { 37 | loc = "https://" + dep.Name 38 | } 39 | key, err := cache.Key(loc) 40 | if err != nil { 41 | msg.Die(err.Error()) 42 | } 43 | cache.Lock(key) 44 | if err := VcsVersion(dep); err != nil { 45 | msg.Err("Failed to set version on %s to %s: %s\n", dep.Name, dep.Reference, err) 46 | 47 | // Capture the error while making sure the concurrent 48 | // operations don't step on each other. 49 | lock.Lock() 50 | if returnErr == nil { 51 | returnErr = err 52 | } else { 53 | returnErr = cli.NewMultiError(returnErr, err) 54 | } 55 | lock.Unlock() 56 | } 57 | cache.Unlock(key) 58 | wg.Done() 59 | case <-done: 60 | return 61 | } 62 | } 63 | }(in) 64 | } 65 | 66 | for _, dep := range conf.Imports { 67 | if !conf.HasIgnore(dep.Name) { 68 | wg.Add(1) 69 | in <- dep 70 | } 71 | } 72 | 73 | if resolveTest { 74 | for _, dep := range conf.DevImports { 75 | if !conf.HasIgnore(dep.Name) { 76 | wg.Add(1) 77 | in <- dep 78 | } 79 | } 80 | } 81 | 82 | wg.Wait() 83 | // Close goroutines setting the version 84 | for i := 0; i < concurrentWorkers; i++ { 85 | done <- struct{}{} 86 | } 87 | // close(done) 88 | // close(in) 89 | 90 | return returnErr 91 | } 92 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/repo/tracker.go: -------------------------------------------------------------------------------- 1 | package repo 2 | 3 | import ( 4 | "sync" 5 | ) 6 | 7 | // UpdateTracker holds a list of all the packages that have been updated from 8 | // an external source. This is a concurrency safe implementation. 9 | type UpdateTracker struct { 10 | sync.RWMutex 11 | 12 | updated map[string]bool 13 | } 14 | 15 | // NewUpdateTracker creates a new instance of UpdateTracker ready for use. 16 | func NewUpdateTracker() *UpdateTracker { 17 | u := &UpdateTracker{} 18 | u.updated = map[string]bool{} 19 | return u 20 | } 21 | 22 | // Add adds a name to the list of items being tracked. 23 | func (u *UpdateTracker) Add(name string) { 24 | u.Lock() 25 | u.updated[name] = true 26 | u.Unlock() 27 | } 28 | 29 | // Check returns if an item is on the list or not. 30 | func (u *UpdateTracker) Check(name string) bool { 31 | u.RLock() 32 | _, f := u.updated[name] 33 | u.RUnlock() 34 | return f 35 | } 36 | 37 | // Remove takes a package off the list 38 | func (u *UpdateTracker) Remove(name string) { 39 | u.Lock() 40 | delete(u.updated, name) 41 | u.Unlock() 42 | } 43 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/repo/tracker_test.go: -------------------------------------------------------------------------------- 1 | package repo 2 | 3 | import "testing" 4 | 5 | func TestUpdateTracker(t *testing.T) { 6 | tr := NewUpdateTracker() 7 | 8 | if f := tr.Check("github.com/foo/bar"); f != false { 9 | t.Error("Error, package Check passed on empty tracker") 10 | } 11 | 12 | tr.Add("github.com/foo/bar") 13 | 14 | if f := tr.Check("github.com/foo/bar"); f != true { 15 | t.Error("Error, failed to add package to tracker") 16 | } 17 | 18 | tr.Remove("github.com/foo/bar") 19 | 20 | if f := tr.Check("github.com/foo/bar"); f != false { 21 | t.Error("Error, failed to remove package from tracker") 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/testdata/name/glide.yaml: -------------------------------------------------------------------------------- 1 | package: technosophos.com/x/foo 2 | import: [] 3 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/testdata/name/glide2.yaml: -------------------------------------------------------------------------------- 1 | package: another/name 2 | import: [] 3 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/testdata/nv/a/foo.empty: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Masterminds/glide-report/2627ea83d5157dc73c40e6b4bef9673fa980cb58/vendor/github.com/Masterminds/glide/testdata/nv/a/foo.empty -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/testdata/nv/b/foo.empty: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Masterminds/glide-report/2627ea83d5157dc73c40e6b4bef9673fa980cb58/vendor/github.com/Masterminds/glide/testdata/nv/b/foo.empty -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/testdata/nv/c/foo.empty: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Masterminds/glide-report/2627ea83d5157dc73c40e6b4bef9673fa980cb58/vendor/github.com/Masterminds/glide/testdata/nv/c/foo.empty -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/testdata/path/a/b/c/placeholder.empty: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Masterminds/glide-report/2627ea83d5157dc73c40e6b4bef9673fa980cb58/vendor/github.com/Masterminds/glide/testdata/path/a/b/c/placeholder.empty -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/testdata/path/a/glide.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Masterminds/glide-report/2627ea83d5157dc73c40e6b4bef9673fa980cb58/vendor/github.com/Masterminds/glide/testdata/path/a/glide.yaml -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/testdata/path/x/glide.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Masterminds/glide-report/2627ea83d5157dc73c40e6b4bef9673fa980cb58/vendor/github.com/Masterminds/glide/testdata/path/x/glide.yaml -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/testdata/path/x/vendor: -------------------------------------------------------------------------------- 1 | symlinked_vendor -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/testdata/path/x/y/z/placeholder.empty: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Masterminds/glide-report/2627ea83d5157dc73c40e6b4bef9673fa980cb58/vendor/github.com/Masterminds/glide/testdata/path/x/y/z/placeholder.empty -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/testdata/plugin/glide-hello: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "Hello from the other glide" 3 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/testdata/rebuild/glide.yaml: -------------------------------------------------------------------------------- 1 | package: github.com/Masterminds/glide/testdata/plugin 2 | import: 3 | - package: example.com/x/foo 4 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/tree/tree_test.go: -------------------------------------------------------------------------------- 1 | /* Package tree contains functions for printing a dependency tree. 2 | 3 | The future of the tree functionality is uncertain, as it is neither core to 4 | the functionality of Glide, nor particularly complementary. Its principal use 5 | case is for debugging the generated dependency tree. 6 | 7 | Currently, the tree package builds its dependency tree in a slightly different 8 | way than the `dependency` package does. This should not make any practical 9 | difference, though code-wise it would be nice to change this over to use the 10 | `dependency` resolver. 11 | */ 12 | package tree 13 | 14 | import ( 15 | "container/list" 16 | "testing" 17 | ) 18 | 19 | func TestFindInTree(t *testing.T) { 20 | l := list.New() 21 | l.PushBack("github.com/Masterminds/glide") 22 | l.PushBack("github.com/Masterminds/vcs") 23 | l.PushBack("github.com/Masterminds/semver") 24 | 25 | f := findInList("foo", l) 26 | if f != false { 27 | t.Error("findInList found true instead of false") 28 | } 29 | 30 | f = findInList("github.com/Masterminds/vcs", l) 31 | if f != true { 32 | t.Error("findInList found false instead of true") 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/util/normalizename_test.go: -------------------------------------------------------------------------------- 1 | package util 2 | 3 | import ( 4 | "testing" 5 | ) 6 | 7 | func TestNormalizeName(t *testing.T) { 8 | packages := []struct { 9 | input string 10 | root string 11 | extra string 12 | }{ 13 | { 14 | input: "github.com/Masterminds/cookoo/web/io/foo", 15 | root: "github.com/Masterminds/cookoo", 16 | extra: "web/io/foo", 17 | }, 18 | { 19 | input: `github.com\Masterminds\cookoo\web\io\foo`, 20 | root: "github.com/Masterminds/cookoo", 21 | extra: "web/io/foo", 22 | }, 23 | { 24 | input: "golang.org/x/crypto/ssh", 25 | root: "golang.org/x/crypto", 26 | extra: "ssh", 27 | }, 28 | { 29 | input: "incomplete/example", 30 | root: "incomplete/example", 31 | extra: "", 32 | }, 33 | { 34 | input: "otherurl/example/root/sub", 35 | root: "otherurl/example/root", 36 | extra: "sub", 37 | }, 38 | { 39 | input: "net", 40 | root: "net", 41 | extra: "", 42 | }, 43 | } 44 | remotePackageCache["otherurl/example/root"] = "otherurl/example/root" 45 | 46 | for _, test := range packages { 47 | root, extra := NormalizeName(test.input) 48 | if root != test.root { 49 | t.Errorf("%s: Expected root '%s', got '%s'", test.input, test.root, root) 50 | } 51 | if extra != test.extra { 52 | t.Errorf("%s: Expected extra '%s', got '%s'", test.input, test.extra, extra) 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/glide/util/util_test.go: -------------------------------------------------------------------------------- 1 | package util 2 | 3 | import "testing" 4 | 5 | func TestGetRootFromPackage(t *testing.T) { 6 | urlList := map[string]string{ 7 | "github.com/Masterminds/VCSTestRepo": "github.com/Masterminds/VCSTestRepo", 8 | "bitbucket.org/mattfarina/testhgrepo": "bitbucket.org/mattfarina/testhgrepo", 9 | "launchpad.net/govcstestbzrrepo/trunk": "launchpad.net/govcstestbzrrepo/trunk", 10 | "launchpad.net/~mattfarina/+junk/mygovcstestbzrrepo": "launchpad.net/~mattfarina/+junk/mygovcstestbzrrepo", 11 | "launchpad.net/~mattfarina/+junk/mygovcstestbzrrepo/trunk": "launchpad.net/~mattfarina/+junk/mygovcstestbzrrepo", 12 | "git.launchpad.net/govcstestgitrepo": "git.launchpad.net/govcstestgitrepo", 13 | "git.launchpad.net/~mattfarina/+git/mygovcstestgitrepo": "git.launchpad.net/~mattfarina/+git/mygovcstestgitrepo", 14 | "hub.jazz.net/git/user/pkgname": "hub.jazz.net/git/user/pkgname", 15 | "hub.jazz.net/git/user/pkgname/subpkg/subpkg/subpkg": "hub.jazz.net/git/user/pkgname", 16 | "farbtastic.googlecode.com/svn/": "farbtastic.googlecode.com/svn/", 17 | "farbtastic.googlecode.com/svn/trunk": "farbtastic.googlecode.com/svn/trunk", 18 | "code.google.com/p/farbtastic": "code.google.com/p/farbtastic", 19 | "code.google.com/p/plotinum": "code.google.com/p/plotinum", 20 | "example.com/foo/bar.git": "example.com/foo/bar.git", 21 | "example.com/foo/bar.svn": "example.com/foo/bar.svn", 22 | "example.com/foo/bar/baz.bzr": "example.com/foo/bar/baz.bzr", 23 | "example.com/foo/bar/baz.hg": "example.com/foo/bar/baz.hg", 24 | "gopkg.in/mgo.v2": "gopkg.in/mgo.v2", 25 | "gopkg.in/mgo.v2/txn": "gopkg.in/mgo.v2", 26 | "gopkg.in/nowk/assert.v2": "gopkg.in/nowk/assert.v2", 27 | "gopkg.in/nowk/assert.v2/tests": "gopkg.in/nowk/assert.v2", 28 | "golang.org/x/net": "golang.org/x/net", 29 | "golang.org/x/net/context": "golang.org/x/net", 30 | } 31 | 32 | for u, c := range urlList { 33 | repo := GetRootFromPackage(u) 34 | if repo != c { 35 | t.Errorf("getRepoRootFromPackage expected %s but got %s", c, repo) 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/semver/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.3 5 | - 1.4 6 | - 1.5 7 | - tip 8 | 9 | # Setting sudo access to false will let Travis CI use containers rather than 10 | # VMs to run the tests. For more details see: 11 | # - http://docs.travis-ci.com/user/workers/container-based-infrastructure/ 12 | # - http://docs.travis-ci.com/user/workers/standard-infrastructure/ 13 | sudo: false 14 | 15 | notifications: 16 | irc: "irc.freenode.net#masterminds" 17 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/semver/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Release 1.1.1 (2016-06-30) 2 | 3 | ## Changed 4 | - Issue #9: Speed up version comparison performance (thanks @sdboyer) 5 | - Issue #8: Added benchmarks (thanks @sdboyer) 6 | - Updated Go Report Card URL to new location 7 | - Updated Readme to add code snippet formatting (thanks @mh-cbon) 8 | - Updating tagging to v[SemVer] structure for compatibility with other tools. 9 | 10 | # Release 1.1.0 (2016-03-11) 11 | 12 | - Issue #2: Implemented validation to provide reasons a versions failed a 13 | constraint. 14 | 15 | # Release 1.0.1 (2015-12-31) 16 | 17 | - Fixed #1: * constraint failing on valid versions. 18 | 19 | # Release 1.0.0 (2015-10-20) 20 | 21 | - Initial release 22 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/semver/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The Masterminds 2 | Copyright (C) 2014-2015, Matt Butcher and Matt Farina 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/semver/appveyor.yml: -------------------------------------------------------------------------------- 1 | version: build-{build}.{branch} 2 | 3 | clone_folder: C:\gopath\src\github.com\Masterminds\semver 4 | shallow_clone: true 5 | 6 | environment: 7 | GOPATH: C:\gopath 8 | 9 | platform: 10 | - x64 11 | 12 | install: 13 | - go version 14 | - go env 15 | 16 | build_script: 17 | - go install -v ./... 18 | 19 | test_script: 20 | - go test -v 21 | 22 | deploy: off 23 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/semver/benchmark_test.go: -------------------------------------------------------------------------------- 1 | package semver_test 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/Masterminds/semver" 7 | ) 8 | 9 | /* Constraint creation benchmarks */ 10 | 11 | func benchNewConstraint(c string, b *testing.B) { 12 | for i := 0; i < b.N; i++ { 13 | semver.NewConstraint(c) 14 | } 15 | } 16 | 17 | func BenchmarkNewConstraintUnary(b *testing.B) { 18 | benchNewConstraint("=2.0", b) 19 | } 20 | 21 | func BenchmarkNewConstraintTilde(b *testing.B) { 22 | benchNewConstraint("~2.0.0", b) 23 | } 24 | 25 | func BenchmarkNewConstraintCaret(b *testing.B) { 26 | benchNewConstraint("^2.0.0", b) 27 | } 28 | 29 | func BenchmarkNewConstraintWildcard(b *testing.B) { 30 | benchNewConstraint("1.x", b) 31 | } 32 | 33 | func BenchmarkNewConstraintRange(b *testing.B) { 34 | benchNewConstraint(">=2.1.x, <3.1.0", b) 35 | } 36 | 37 | func BenchmarkNewConstraintUnion(b *testing.B) { 38 | benchNewConstraint("~2.0.0 || =3.1.0", b) 39 | } 40 | 41 | /* Check benchmarks */ 42 | 43 | func benchCheckVersion(c, v string, b *testing.B) { 44 | version, _ := semver.NewVersion(v) 45 | constraint, _ := semver.NewConstraint(c) 46 | 47 | for i := 0; i < b.N; i++ { 48 | constraint.Check(version) 49 | } 50 | } 51 | 52 | func BenchmarkCheckVersionUnary(b *testing.B) { 53 | benchCheckVersion("=2.0", "2.0.0", b) 54 | } 55 | 56 | func BenchmarkCheckVersionTilde(b *testing.B) { 57 | benchCheckVersion("~2.0.0", "2.0.5", b) 58 | } 59 | 60 | func BenchmarkCheckVersionCaret(b *testing.B) { 61 | benchCheckVersion("^2.0.0", "2.1.0", b) 62 | } 63 | 64 | func BenchmarkCheckVersionWildcard(b *testing.B) { 65 | benchCheckVersion("1.x", "1.4.0", b) 66 | } 67 | 68 | func BenchmarkCheckVersionRange(b *testing.B) { 69 | benchCheckVersion(">=2.1.x, <3.1.0", "2.4.5", b) 70 | } 71 | 72 | func BenchmarkCheckVersionUnion(b *testing.B) { 73 | benchCheckVersion("~2.0.0 || =3.1.0", "3.1.0", b) 74 | } 75 | 76 | func benchValidateVersion(c, v string, b *testing.B) { 77 | version, _ := semver.NewVersion(v) 78 | constraint, _ := semver.NewConstraint(c) 79 | 80 | for i := 0; i < b.N; i++ { 81 | constraint.Validate(version) 82 | } 83 | } 84 | 85 | /* Validate benchmarks, including fails */ 86 | 87 | func BenchmarkValidateVersionUnary(b *testing.B) { 88 | benchValidateVersion("=2.0", "2.0.0", b) 89 | } 90 | 91 | func BenchmarkValidateVersionUnaryFail(b *testing.B) { 92 | benchValidateVersion("=2.0", "2.0.1", b) 93 | } 94 | 95 | func BenchmarkValidateVersionTilde(b *testing.B) { 96 | benchValidateVersion("~2.0.0", "2.0.5", b) 97 | } 98 | 99 | func BenchmarkValidateVersionTildeFail(b *testing.B) { 100 | benchValidateVersion("~2.0.0", "1.0.5", b) 101 | } 102 | 103 | func BenchmarkValidateVersionCaret(b *testing.B) { 104 | benchValidateVersion("^2.0.0", "2.1.0", b) 105 | } 106 | 107 | func BenchmarkValidateVersionCaretFail(b *testing.B) { 108 | benchValidateVersion("^2.0.0", "4.1.0", b) 109 | } 110 | 111 | func BenchmarkValidateVersionWildcard(b *testing.B) { 112 | benchValidateVersion("1.x", "1.4.0", b) 113 | } 114 | 115 | func BenchmarkValidateVersionWildcardFail(b *testing.B) { 116 | benchValidateVersion("1.x", "2.4.0", b) 117 | } 118 | 119 | func BenchmarkValidateVersionRange(b *testing.B) { 120 | benchValidateVersion(">=2.1.x, <3.1.0", "2.4.5", b) 121 | } 122 | 123 | func BenchmarkValidateVersionRangeFail(b *testing.B) { 124 | benchValidateVersion(">=2.1.x, <3.1.0", "1.4.5", b) 125 | } 126 | 127 | func BenchmarkValidateVersionUnion(b *testing.B) { 128 | benchValidateVersion("~2.0.0 || =3.1.0", "3.1.0", b) 129 | } 130 | 131 | func BenchmarkValidateVersionUnionFail(b *testing.B) { 132 | benchValidateVersion("~2.0.0 || =3.1.0", "3.1.1", b) 133 | } 134 | 135 | /* Version creation benchmarks */ 136 | 137 | func benchNewVersion(v string, b *testing.B) { 138 | for i := 0; i < b.N; i++ { 139 | semver.NewVersion(v) 140 | } 141 | } 142 | 143 | func BenchmarkNewVersionSimple(b *testing.B) { 144 | benchNewVersion("1.0.0", b) 145 | } 146 | 147 | func BenchmarkNewVersionPre(b *testing.B) { 148 | benchNewVersion("1.0.0-alpha", b) 149 | } 150 | 151 | func BenchmarkNewVersionMeta(b *testing.B) { 152 | benchNewVersion("1.0.0+metadata", b) 153 | } 154 | 155 | func BenchmarkNewVersionMetaDash(b *testing.B) { 156 | benchNewVersion("1.0.0+metadata-dash", b) 157 | } 158 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/semver/collection.go: -------------------------------------------------------------------------------- 1 | package semver 2 | 3 | // Collection is a collection of Version instances and implements the sort 4 | // interface. See the sort package for more details. 5 | // https://golang.org/pkg/sort/ 6 | type Collection []*Version 7 | 8 | // Len returns the length of a collection. The number of Version instances 9 | // on the slice. 10 | func (c Collection) Len() int { 11 | return len(c) 12 | } 13 | 14 | // Less is needed for the sort interface to compare two Version objects on the 15 | // slice. If checks if one is less than the other. 16 | func (c Collection) Less(i, j int) bool { 17 | return c[i].LessThan(c[j]) 18 | } 19 | 20 | // Swap is needed for the sort interface to replace the Version objects 21 | // at two different positions in the slice. 22 | func (c Collection) Swap(i, j int) { 23 | c[i], c[j] = c[j], c[i] 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/semver/collection_test.go: -------------------------------------------------------------------------------- 1 | package semver 2 | 3 | import ( 4 | "reflect" 5 | "sort" 6 | "testing" 7 | ) 8 | 9 | func TestCollection(t *testing.T) { 10 | raw := []string{ 11 | "1.2.3", 12 | "1.0", 13 | "1.3", 14 | "2", 15 | "0.4.2", 16 | } 17 | 18 | vs := make([]*Version, len(raw)) 19 | for i, r := range raw { 20 | v, err := NewVersion(r) 21 | if err != nil { 22 | t.Errorf("Error parsing version: %s", err) 23 | } 24 | 25 | vs[i] = v 26 | } 27 | 28 | sort.Sort(Collection(vs)) 29 | 30 | e := []string{ 31 | "0.4.2", 32 | "1.0.0", 33 | "1.2.3", 34 | "1.3.0", 35 | "2.0.0", 36 | } 37 | 38 | a := make([]string, len(vs)) 39 | for i, v := range vs { 40 | a[i] = v.String() 41 | } 42 | 43 | if !reflect.DeepEqual(a, e) { 44 | t.Error("Sorting Collection failed") 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/semver/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package semver provides the ability to work with Semantic Versions (http://semver.org) in Go. 3 | 4 | Specifically it provides the ability to: 5 | 6 | * Parse semantic versions 7 | * Sort semantic versions 8 | * Check if a semantic version fits within a set of constraints 9 | * Optionally work with a `v` prefix 10 | 11 | Parsing Semantic Versions 12 | 13 | To parse a semantic version use the `NewVersion` function. For example, 14 | 15 | v, err := semver.NewVersion("1.2.3-beta.1+build345") 16 | 17 | If there is an error the version wasn't parseable. The version object has methods 18 | to get the parts of the version, compare it to other versions, convert the 19 | version back into a string, and get the original string. For more details 20 | please see the documentation at https://godoc.org/github.com/Masterminds/semver. 21 | 22 | Sorting Semantic Versions 23 | 24 | A set of versions can be sorted using the `sort` package from the standard library. 25 | For example, 26 | 27 | raw := []string{"1.2.3", "1.0", "1.3", "2", "0.4.2",} 28 | vs := make([]*semver.Version, len(raw)) 29 | for i, r := range raw { 30 | v, err := semver.NewVersion(r) 31 | if err != nil { 32 | t.Errorf("Error parsing version: %s", err) 33 | } 34 | 35 | vs[i] = v 36 | } 37 | 38 | sort.Sort(semver.Collection(vs)) 39 | 40 | Checking Version Constraints 41 | 42 | Checking a version against version constraints is one of the most featureful 43 | parts of the package. 44 | 45 | c, err := semver.NewConstraint(">= 1.2.3") 46 | if err != nil { 47 | // Handle constraint not being parseable. 48 | } 49 | 50 | v, _ := semver.NewVersion("1.3") 51 | if err != nil { 52 | // Handle version not being parseable. 53 | } 54 | // Check if the version meets the constraints. The a variable will be true. 55 | a := c.Check(v) 56 | 57 | Basic Comparisons 58 | 59 | There are two elements to the comparisons. First, a comparison string is a list 60 | of comma separated and comparisons. These are then separated by || separated or 61 | comparisons. For example, `">= 1.2, < 3.0.0 || >= 4.2.3"` is looking for a 62 | comparison that's greater than or equal to 1.2 and less than 3.0.0 or is 63 | greater than or equal to 4.2.3. 64 | 65 | The basic comparisons are: 66 | 67 | * `=`: equal (aliased to no operator) 68 | * `!=`: not equal 69 | * `>`: greater than 70 | * `<`: less than 71 | * `>=`: greater than or equal to 72 | * `<=`: less than or equal to 73 | 74 | Hyphen Range Comparisons 75 | 76 | There are multiple methods to handle ranges and the first is hyphens ranges. 77 | These look like: 78 | 79 | * `1.2 - 1.4.5` which is equivalent to `>= 1.2, <= 1.4.5` 80 | * `2.3.4 - 4.5` which is equivalent to `>= 2.3.4, <= 4.5` 81 | 82 | Wildcards In Comparisons 83 | 84 | The `x`, `X`, and `*` characters can be used as a wildcard character. This works 85 | for all comparison operators. When used on the `=` operator it falls 86 | back to the pack level comparison (see tilde below). For example, 87 | 88 | * `1.2.x` is equivalent to `>= 1.2.0, < 1.3.0` 89 | * `>= 1.2.x` is equivalent to `>= 1.2.0` 90 | * `<= 2.x` is equivalent to `<= 3` 91 | * `*` is equivalent to `>= 0.0.0` 92 | 93 | Tilde Range Comparisons (Patch) 94 | 95 | The tilde (`~`) comparison operator is for patch level ranges when a minor 96 | version is specified and major level changes when the minor number is missing. 97 | For example, 98 | 99 | * `~1.2.3` is equivalent to `>= 1.2.3, < 1.3.0` 100 | * `~1` is equivalent to `>= 1, < 2` 101 | * `~2.3` is equivalent to `>= 2.3, < 2.4` 102 | * `~1.2.x` is equivalent to `>= 1.2.0, < 1.3.0` 103 | * `~1.x` is equivalent to `>= 1, < 2` 104 | 105 | Caret Range Comparisons (Major) 106 | 107 | The caret (`^`) comparison operator is for major level changes. This is useful 108 | when comparisons of API versions as a major change is API breaking. For example, 109 | 110 | * `^1.2.3` is equivalent to `>= 1.2.3, < 2.0.0` 111 | * `^1.2.x` is equivalent to `>= 1.2.0, < 2.0.0` 112 | * `^2.3` is equivalent to `>= 2.3, < 3` 113 | * `^2.x` is equivalent to `>= 2.0.0, < 3` 114 | */ 115 | package semver 116 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/vcs/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | *.prof 25 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/vcs/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.3 5 | - 1.4 6 | - 1.5 7 | - 1.6 8 | - tip 9 | 10 | before_script: 11 | - git version 12 | - svn --version 13 | 14 | # Setting sudo access to false will let Travis CI use containers rather than 15 | # VMs to run the tests. For more details see: 16 | # - http://docs.travis-ci.com/user/workers/container-based-infrastructure/ 17 | # - http://docs.travis-ci.com/user/workers/standard-infrastructure/ 18 | sudo: false 19 | 20 | notifications: 21 | webhooks: 22 | urls: 23 | - https://webhooks.gitter.im/e/06e3328629952dabe3e0 24 | on_success: change # options: [always|never|change] default: always 25 | on_failure: always # options: [always|never|change] default: always 26 | on_start: never # options: [always|never|change] default: always 27 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/vcs/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 1.8.0 (2016-06-29) 2 | 3 | ## Added 4 | - #43: Detect when tool (e.g., git, svn, etc) not installed 5 | - #49: Detect access denied and not found situations 6 | 7 | ## Changed 8 | - #48: Updated Go Report Gard url to new format 9 | - Refactored SVN handling to detect when not in a top level directory 10 | - Updating tagging to v[SemVer] structure for compatibility with other tools. 11 | 12 | ## Fixed 13 | - #45: Fixed hg's update method so that it pulls from remote before updates 14 | 15 | # 1.7.0 (2016-05-05) 16 | 17 | - Adds a glide.yaml file with some limited information. 18 | - Implements #37: Ability to export source as a directory. 19 | - Implements #36: Get current version-ish with Current method. This returns 20 | a branch (if on tip) or equivalent tip, a tag if on a tag, or a revision if 21 | on an individual revision. Note, the tip of branch is VCS specific so usage 22 | may require detecting VCS type. 23 | 24 | # 1.6.1 (2016-04-27) 25 | 26 | - Fixed #30: tags from commit should not have ^{} appended (seen in git) 27 | - Fixed #29: isDetachedHead fails with non-english locales (git) 28 | - Fixed #33: Access denied and not found http errors causing xml parsing errors 29 | 30 | # 1.6.0 (2016-04-18) 31 | 32 | - Issue #26: Added Init method to initialize a repo at the local location 33 | (thanks tony). 34 | - Issue #19: Added method to retrieve tags for a commit. 35 | - Issue #24: Reworked errors returned from common methods. Now differing 36 | VCS implementations return the same errors. The original VCS specific error 37 | is available on the error. See the docs for more details. 38 | - Issue #25: Export the function RunFromDir which runs VCS commands from the 39 | root of the local directory. This is useful for those that want to build and 40 | extend on top of the vcs package (thanks tony). 41 | - Issue #22: Added Ping command to test if remote location is present and 42 | accessible. 43 | 44 | # 1.5.1 (2016-03-23) 45 | 46 | - Fixing bug parsing some Git commit dates. 47 | 48 | # 1.5.0 (2016-03-22) 49 | 50 | - Add Travis CI testing for Go 1.6. 51 | - Issue #17: Add CommitInfo method allowing for a common way to get commit 52 | metadata from all VCS. 53 | - Autodetect types that have git@ or hg@ users. 54 | - Autodetect git+ssh, bzr+ssh, git, and svn+ssh scheme urls. 55 | - On Bitbucket for ssh style URLs retrieve the type from the URL. This allows 56 | for private repo type detection. 57 | - Issue #14: Autodetect ssh/scp style urls (thanks chonthu). 58 | 59 | # 1.4.1 (2016-03-07) 60 | 61 | - Fixes #16: some windows situations are unable to create parent directory. 62 | 63 | # 1.4.0 (2016-02-15) 64 | 65 | - Adding support for IBM JazzHub. 66 | 67 | # 1.3.1 (2016-01-27) 68 | 69 | - Issue #12: Failed to checkout Bzr repo when parent directory didn't 70 | exist (thanks cyrilleverrier). 71 | 72 | # 1.3.0 (2015-11-09) 73 | 74 | - Issue #9: Added Date method to get the date/time of latest commit (thanks kamilchm). 75 | 76 | # 1.2.0 (2015-10-29) 77 | 78 | - Adding IsDirty method to detect a checkout with uncommitted changes. 79 | 80 | # 1.1.4 (2015-10-28) 81 | 82 | - Fixed #8: Git IsReference not detecting branches that have not been checked 83 | out yet. 84 | 85 | # 1.1.3 (2015-10-21) 86 | 87 | - Fixing issue where there are multiple go-import statements for go redirects 88 | 89 | # 1.1.2 (2015-10-20) 90 | 91 | - Fixes #7: hg not checking out code when Get is called 92 | 93 | # 1.1.1 (2015-10-20) 94 | 95 | - Issue #6: Allow VCS commands to be run concurrently. 96 | 97 | # 1.1.0 (2015-10-19) 98 | 99 | - #5: Added output of failed command to returned errors. 100 | 101 | # 1.0.0 (2015-10-06) 102 | 103 | - Initial release. 104 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/vcs/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The Masterminds 2 | Copyright (C) 2014-2015, Matt Butcher and Matt Farina 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/vcs/README.md: -------------------------------------------------------------------------------- 1 | # VCS Repository Management for Go 2 | 3 | Manage repos in varying version control systems with ease through a common 4 | interface. 5 | 6 | [![Build Status](https://travis-ci.org/Masterminds/vcs.svg)](https://travis-ci.org/Masterminds/vcs) [![GoDoc](https://godoc.org/github.com/Masterminds/vcs?status.png)](https://godoc.org/github.com/Masterminds/vcs) [![Go Report Card](https://goreportcard.com/badge/github.com/Masterminds/vcs)](https://goreportcard.com/report/github.com/Masterminds/vcs) 7 | 8 | ## Quick Usage 9 | 10 | Quick usage: 11 | 12 | remote := "https://github.com/Masterminds/vcs" 13 | local, _ := ioutil.TempDir("", "go-vcs") 14 | repo, err := NewRepo(remote, local) 15 | 16 | In this case `NewRepo` will detect the VCS is Git and return a `GitRepo`. All of 17 | the repos implement the `Repo` interface with a common set of features between 18 | them. 19 | 20 | ## Supported VCS 21 | 22 | Git, SVN, Bazaar (Bzr), and Mercurial (Hg) are currently supported. They each 23 | have their own type (e.g., `GitRepo`) that follow a simple naming pattern. Each 24 | type implements the `Repo` interface and has a constructor (e.g., `NewGitRepo`). 25 | The constructors have the same signature as `NewRepo`. 26 | 27 | ## Features 28 | 29 | - Clone or checkout a repository depending on the version control system. 30 | - Pull updates to a repository. 31 | - Get the currently checked out commit id. 32 | - Checkout a commit id, branch, or tag (depending on the availability in the VCS). 33 | - Get a list of tags and branches in the VCS. 34 | - Check if a string value is a valid reference within the VCS. 35 | - More... 36 | 37 | For more details see [the documentation](https://godoc.org/github.com/Masterminds/vcs). 38 | 39 | ## Motivation 40 | 41 | The package `golang.org/x/tools/go/vcs` provides some valuable functionality 42 | for working with packages in repositories in varying source control management 43 | systems. That package, while useful and well tested, is designed with a specific 44 | purpose in mind. Our uses went beyond the scope of that package. To implement 45 | our scope we built a package that went beyond the functionality and scope 46 | of `golang.org/x/tools/go/vcs`. 47 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/vcs/errors.go: -------------------------------------------------------------------------------- 1 | package vcs 2 | 3 | import "errors" 4 | 5 | // The vcs package provides ways to work with errors that hide the underlying 6 | // implementation details but make them accessible if needed. For basic errors 7 | // that do not have underlying implementation specific details or the underlying 8 | // details are likely not necessairy there are errors for comparison. 9 | // 10 | // For example: 11 | // 12 | // ci, err := repo.CommitInfo("123") 13 | // if err == vcs.ErrRevisionUnavailable { 14 | // // The commit id was not available in the VCS. 15 | // } 16 | // 17 | // There are other times where getting the details are more useful. For example, 18 | // if you're performing a repo.Get() and an error occurs. In general you'll want 19 | // to consistently know it failed. But, you may want to know the underlying 20 | // details (opt-in) to them. For those cases there is a different form of error 21 | // handling. 22 | // 23 | // For example: 24 | // 25 | // err := repo.Get() 26 | // if err != nil { 27 | // // A RemoteError was returned. This has access to the output of the 28 | // // vcs command, original error, and has a consistent cross vcs message. 29 | // } 30 | // 31 | // The errors returned here can be used in type switches to detect the underlying 32 | // error. For example: 33 | // 34 | // switch err.(type) { 35 | // case *vcs.RemoteError: 36 | // // This an error connecting to a remote system. 37 | // } 38 | // 39 | // For more information on using type switches to detect error types you can 40 | // read the Go wiki at https://github.com/golang/go/wiki/Errors 41 | 42 | var ( 43 | // ErrWrongVCS is returned when an action is tried on the wrong VCS. 44 | ErrWrongVCS = errors.New("Wrong VCS detected") 45 | 46 | // ErrCannotDetectVCS is returned when VCS cannot be detected from URI string. 47 | ErrCannotDetectVCS = errors.New("Cannot detect VCS") 48 | 49 | // ErrWrongRemote occurs when the passed in remote does not match the VCS 50 | // configured endpoint. 51 | ErrWrongRemote = errors.New("The Remote does not match the VCS endpoint") 52 | 53 | // ErrRevisionUnavailable happens when commit revision information is 54 | // unavailable. 55 | ErrRevisionUnavailable = errors.New("Revision unavailable") 56 | ) 57 | 58 | // RemoteError is returned when an operation fails against a remote repo 59 | type RemoteError struct { 60 | vcsError 61 | } 62 | 63 | // NewRemoteError constructs a RemoteError 64 | func NewRemoteError(msg string, err error, out string) error { 65 | e := &RemoteError{} 66 | e.s = msg 67 | e.e = err 68 | e.o = out 69 | 70 | return e 71 | } 72 | 73 | // LocalError is returned when a local operation has an error 74 | type LocalError struct { 75 | vcsError 76 | } 77 | 78 | // NewLocalError constructs a LocalError 79 | func NewLocalError(msg string, err error, out string) error { 80 | e := &LocalError{} 81 | e.s = msg 82 | e.e = err 83 | e.o = out 84 | 85 | return e 86 | } 87 | 88 | type vcsError struct { 89 | s string 90 | e error // The original error 91 | o string // The output from executing the command 92 | } 93 | 94 | // Error implements the Error interface 95 | func (e *vcsError) Error() string { 96 | return e.s 97 | } 98 | 99 | // Original retrieves the underlying implementation specific error. 100 | func (e *vcsError) Original() error { 101 | return e.e 102 | } 103 | 104 | // Out retrieves the output of the original command that was run. 105 | func (e *vcsError) Out() string { 106 | return e.o 107 | } 108 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/vcs/errors_test.go: -------------------------------------------------------------------------------- 1 | package vcs 2 | 3 | import ( 4 | "errors" 5 | "testing" 6 | ) 7 | 8 | func TestNewRemoteError(t *testing.T) { 9 | base := errors.New("Foo error") 10 | out := "This is a test" 11 | msg := "remote error msg" 12 | 13 | e := NewRemoteError(msg, base, out) 14 | 15 | switch e.(type) { 16 | case *RemoteError: 17 | // This is the right error type 18 | default: 19 | t.Error("Wrong error type returned from NewRemoteError") 20 | } 21 | } 22 | 23 | func TestNewLocalError(t *testing.T) { 24 | base := errors.New("Foo error") 25 | out := "This is a test" 26 | msg := "local error msg" 27 | 28 | e := NewLocalError(msg, base, out) 29 | 30 | switch e.(type) { 31 | case *LocalError: 32 | // This is the right error type 33 | default: 34 | t.Error("Wrong error type returned from NewLocalError") 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/vcs/glide.yaml: -------------------------------------------------------------------------------- 1 | package: github.com/Masterminds/vcs 2 | homepage: https://github.com/Masterminds/vcs 3 | license: MIT 4 | owners: 5 | - name: Matt Farina 6 | email: matt@mattfarina.com 7 | homepage: https://www.mattfarina.com/ 8 | import: [] 9 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/vcs/repo_test.go: -------------------------------------------------------------------------------- 1 | package vcs 2 | 3 | import ( 4 | "fmt" 5 | "io/ioutil" 6 | "os" 7 | "testing" 8 | ) 9 | 10 | func ExampleNewRepo() { 11 | remote := "https://github.com/Masterminds/vcs" 12 | local, _ := ioutil.TempDir("", "go-vcs") 13 | repo, _ := NewRepo(remote, local) 14 | // Returns: instance of GitRepo 15 | 16 | repo.Vcs() 17 | // Returns Git as this is a Git repo 18 | 19 | err := repo.Get() 20 | // Pulls down a repo, or a checkout in the case of SVN, and returns an 21 | // error if that didn't happen successfully. 22 | if err != nil { 23 | fmt.Println(err) 24 | } 25 | 26 | err = repo.UpdateVersion("master") 27 | // Checkouts out a specific version. In most cases this can be a commit id, 28 | // branch, or tag. 29 | if err != nil { 30 | fmt.Println(err) 31 | } 32 | } 33 | 34 | func TestTypeSwitch(t *testing.T) { 35 | 36 | // To test repo type switching we checkout as SVN and then try to get it as 37 | // a git repo afterwards. 38 | tempDir, err := ioutil.TempDir("", "go-vcs-svn-tests") 39 | if err != nil { 40 | t.Error(err) 41 | } 42 | defer func() { 43 | err = os.RemoveAll(tempDir) 44 | if err != nil { 45 | t.Error(err) 46 | } 47 | }() 48 | 49 | repo, err := NewSvnRepo("https://github.com/Masterminds/VCSTestRepo/trunk", tempDir+"/VCSTestRepo") 50 | if err != nil { 51 | t.Error(err) 52 | } 53 | err = repo.Get() 54 | if err != nil { 55 | t.Errorf("Unable to checkout SVN repo for repo switching tests. Err was %s", err) 56 | } 57 | 58 | _, err = NewRepo("https://github.com/Masterminds/VCSTestRepo", tempDir+"/VCSTestRepo") 59 | if err != ErrWrongVCS { 60 | t.Errorf("Not detecting repo switch from SVN to Git") 61 | } 62 | } 63 | 64 | func TestDepInstalled(t *testing.T) { 65 | i := depInstalled("git") 66 | if i != true { 67 | t.Error("depInstalled not finding installed dep.") 68 | } 69 | 70 | i = depInstalled("thisreallyisntinstalled") 71 | if i != false { 72 | t.Error("depInstalled finding not installed dep.") 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/vcs/vcs_local_lookup.go: -------------------------------------------------------------------------------- 1 | package vcs 2 | 3 | import ( 4 | "os" 5 | ) 6 | 7 | // DetectVcsFromFS detects the type from the local path. 8 | // Is there a better way to do this? 9 | func DetectVcsFromFS(vcsPath string) (Type, error) { 10 | 11 | // When the local directory to the package doesn't exist 12 | // it's not yet downloaded so we can't detect the type 13 | // locally. 14 | if _, err := os.Stat(vcsPath); os.IsNotExist(err) { 15 | return "", ErrCannotDetectVCS 16 | } 17 | 18 | seperator := string(os.PathSeparator) 19 | 20 | // Walk through each of the different VCS types to see if 21 | // one can be detected. Do this is order of guessed popularity. 22 | if _, err := os.Stat(vcsPath + seperator + ".git"); err == nil { 23 | return Git, nil 24 | } 25 | if _, err := os.Stat(vcsPath + seperator + ".svn"); err == nil { 26 | return Svn, nil 27 | } 28 | if _, err := os.Stat(vcsPath + seperator + ".hg"); err == nil { 29 | return Hg, nil 30 | } 31 | if _, err := os.Stat(vcsPath + seperator + ".bzr"); err == nil { 32 | return Bzr, nil 33 | } 34 | 35 | // If one was not already detected than we default to not finding it. 36 | return "", ErrCannotDetectVCS 37 | 38 | } 39 | -------------------------------------------------------------------------------- /vendor/github.com/urfave/cli/.gitignore: -------------------------------------------------------------------------------- 1 | *.coverprofile 2 | node_modules/ 3 | -------------------------------------------------------------------------------- /vendor/github.com/urfave/cli/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | sudo: false 4 | 5 | cache: 6 | directories: 7 | - node_modules 8 | 9 | go: 10 | - 1.2.2 11 | - 1.3.3 12 | - 1.4 13 | - 1.5.4 14 | - 1.6.2 15 | - master 16 | 17 | matrix: 18 | allow_failures: 19 | - go: master 20 | include: 21 | - go: 1.6.2 22 | os: osx 23 | - go: 1.1.2 24 | install: go get -v . 25 | before_script: echo skipping gfmxr on $TRAVIS_GO_VERSION 26 | script: 27 | - ./runtests vet 28 | - ./runtests test 29 | 30 | before_script: 31 | - go get github.com/urfave/gfmxr/... 32 | - if [ ! -f node_modules/.bin/markdown-toc ] ; then 33 | npm install markdown-toc ; 34 | fi 35 | 36 | script: 37 | - ./runtests vet 38 | - ./runtests test 39 | - ./runtests gfmxr 40 | - ./runtests toc 41 | -------------------------------------------------------------------------------- /vendor/github.com/urfave/cli/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Jeremy Saenz & Contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/urfave/cli/altsrc/helpers_test.go: -------------------------------------------------------------------------------- 1 | package altsrc 2 | 3 | import ( 4 | "reflect" 5 | "testing" 6 | ) 7 | 8 | func expect(t *testing.T, a interface{}, b interface{}) { 9 | if !reflect.DeepEqual(b, a) { 10 | t.Errorf("Expected %#v (type %v) - Got %#v (type %v)", b, reflect.TypeOf(b), a, reflect.TypeOf(a)) 11 | } 12 | } 13 | 14 | func refute(t *testing.T, a interface{}, b interface{}) { 15 | if a == b { 16 | t.Errorf("Did not expect %v (type %v) - Got %v (type %v)", b, reflect.TypeOf(b), a, reflect.TypeOf(a)) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/urfave/cli/altsrc/input_source_context.go: -------------------------------------------------------------------------------- 1 | package altsrc 2 | 3 | import ( 4 | "time" 5 | 6 | "github.com/urfave/cli" 7 | ) 8 | 9 | // InputSourceContext is an interface used to allow 10 | // other input sources to be implemented as needed. 11 | type InputSourceContext interface { 12 | Int(name string) (int, error) 13 | Duration(name string) (time.Duration, error) 14 | Float64(name string) (float64, error) 15 | String(name string) (string, error) 16 | StringSlice(name string) ([]string, error) 17 | IntSlice(name string) ([]int, error) 18 | Generic(name string) (cli.Generic, error) 19 | Bool(name string) (bool, error) 20 | BoolT(name string) (bool, error) 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/urfave/cli/altsrc/yaml_file_loader.go: -------------------------------------------------------------------------------- 1 | // Disabling building of yaml support in cases where golang is 1.0 or 1.1 2 | // as the encoding library is not implemented or supported. 3 | 4 | // +build go1.2 5 | 6 | package altsrc 7 | 8 | import ( 9 | "fmt" 10 | "io/ioutil" 11 | "net/http" 12 | "net/url" 13 | "os" 14 | 15 | "github.com/urfave/cli" 16 | 17 | "gopkg.in/yaml.v2" 18 | ) 19 | 20 | type yamlSourceContext struct { 21 | FilePath string 22 | } 23 | 24 | // NewYamlSourceFromFile creates a new Yaml InputSourceContext from a filepath. 25 | func NewYamlSourceFromFile(file string) (InputSourceContext, error) { 26 | ysc := &yamlSourceContext{FilePath: file} 27 | var results map[interface{}]interface{} 28 | err := readCommandYaml(ysc.FilePath, &results) 29 | if err != nil { 30 | return nil, fmt.Errorf("Unable to load Yaml file '%s': inner error: \n'%v'", ysc.FilePath, err.Error()) 31 | } 32 | 33 | return &MapInputSource{valueMap: results}, nil 34 | } 35 | 36 | // NewYamlSourceFromFlagFunc creates a new Yaml InputSourceContext from a provided flag name and source context. 37 | func NewYamlSourceFromFlagFunc(flagFileName string) func(context *cli.Context) (InputSourceContext, error) { 38 | return func(context *cli.Context) (InputSourceContext, error) { 39 | filePath := context.String(flagFileName) 40 | return NewYamlSourceFromFile(filePath) 41 | } 42 | } 43 | 44 | func readCommandYaml(filePath string, container interface{}) (err error) { 45 | b, err := loadDataFrom(filePath) 46 | if err != nil { 47 | return err 48 | } 49 | 50 | err = yaml.Unmarshal(b, container) 51 | if err != nil { 52 | return err 53 | } 54 | 55 | err = nil 56 | return 57 | } 58 | 59 | func loadDataFrom(filePath string) ([]byte, error) { 60 | u, err := url.Parse(filePath) 61 | if err != nil { 62 | return nil, err 63 | } 64 | 65 | if u.Host != "" { // i have a host, now do i support the scheme? 66 | switch u.Scheme { 67 | case "http", "https": 68 | res, err := http.Get(filePath) 69 | if err != nil { 70 | return nil, err 71 | } 72 | return ioutil.ReadAll(res.Body) 73 | default: 74 | return nil, fmt.Errorf("scheme of %s is unsupported", filePath) 75 | } 76 | } else if u.Path != "" { // i dont have a host, but I have a path. I am a local file. 77 | if _, notFoundFileErr := os.Stat(filePath); notFoundFileErr != nil { 78 | return nil, fmt.Errorf("Cannot read from file: '%s' because it does not exist.", filePath) 79 | } 80 | return ioutil.ReadFile(filePath) 81 | } else { 82 | return nil, fmt.Errorf("unable to determine how to load from path %s", filePath) 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /vendor/github.com/urfave/cli/appveyor.yml: -------------------------------------------------------------------------------- 1 | version: "{build}" 2 | 3 | os: Windows Server 2012 R2 4 | 5 | clone_folder: c:\gopath\src\github.com\urfave\cli 6 | 7 | environment: 8 | GOPATH: C:\gopath 9 | GOVERSION: 1.6 10 | PYTHON: C:\Python27-x64 11 | PYTHON_VERSION: 2.7.x 12 | PYTHON_ARCH: 64 13 | GFMXR_DEBUG: 1 14 | 15 | install: 16 | - set PATH=%GOPATH%\bin;C:\go\bin;%PATH% 17 | - go version 18 | - go env 19 | - go get github.com/urfave/gfmxr/... 20 | - go get -v -t ./... 21 | 22 | build_script: 23 | - python runtests vet 24 | - python runtests test 25 | - python runtests gfmxr 26 | -------------------------------------------------------------------------------- /vendor/github.com/urfave/cli/autocomplete/bash_autocomplete: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | : ${PROG:=$(basename ${BASH_SOURCE})} 4 | 5 | _cli_bash_autocomplete() { 6 | local cur opts base 7 | COMPREPLY=() 8 | cur="${COMP_WORDS[COMP_CWORD]}" 9 | opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} --generate-bash-completion ) 10 | COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) 11 | return 0 12 | } 13 | 14 | complete -F _cli_bash_autocomplete $PROG 15 | -------------------------------------------------------------------------------- /vendor/github.com/urfave/cli/autocomplete/zsh_autocomplete: -------------------------------------------------------------------------------- 1 | autoload -U compinit && compinit 2 | autoload -U bashcompinit && bashcompinit 3 | 4 | script_dir=$(dirname $0) 5 | source ${script_dir}/bash_autocomplete 6 | -------------------------------------------------------------------------------- /vendor/github.com/urfave/cli/category.go: -------------------------------------------------------------------------------- 1 | package cli 2 | 3 | // CommandCategories is a slice of *CommandCategory. 4 | type CommandCategories []*CommandCategory 5 | 6 | // CommandCategory is a category containing commands. 7 | type CommandCategory struct { 8 | Name string 9 | Commands Commands 10 | } 11 | 12 | func (c CommandCategories) Less(i, j int) bool { 13 | return c[i].Name < c[j].Name 14 | } 15 | 16 | func (c CommandCategories) Len() int { 17 | return len(c) 18 | } 19 | 20 | func (c CommandCategories) Swap(i, j int) { 21 | c[i], c[j] = c[j], c[i] 22 | } 23 | 24 | // AddCommand adds a command to a category. 25 | func (c CommandCategories) AddCommand(category string, command Command) CommandCategories { 26 | for _, commandCategory := range c { 27 | if commandCategory.Name == category { 28 | commandCategory.Commands = append(commandCategory.Commands, command) 29 | return c 30 | } 31 | } 32 | return append(c, &CommandCategory{Name: category, Commands: []Command{command}}) 33 | } 34 | 35 | // VisibleCommands returns a slice of the Commands with Hidden=false 36 | func (c *CommandCategory) VisibleCommands() []Command { 37 | ret := []Command{} 38 | for _, command := range c.Commands { 39 | if !command.Hidden { 40 | ret = append(ret, command) 41 | } 42 | } 43 | return ret 44 | } 45 | -------------------------------------------------------------------------------- /vendor/github.com/urfave/cli/cli.go: -------------------------------------------------------------------------------- 1 | // Package cli provides a minimal framework for creating and organizing command line 2 | // Go applications. cli is designed to be easy to understand and write, the most simple 3 | // cli application can be written as follows: 4 | // func main() { 5 | // cli.NewApp().Run(os.Args) 6 | // } 7 | // 8 | // Of course this application does not do much, so let's make this an actual application: 9 | // func main() { 10 | // app := cli.NewApp() 11 | // app.Name = "greet" 12 | // app.Usage = "say a greeting" 13 | // app.Action = func(c *cli.Context) error { 14 | // println("Greetings") 15 | // } 16 | // 17 | // app.Run(os.Args) 18 | // } 19 | package cli 20 | -------------------------------------------------------------------------------- /vendor/github.com/urfave/cli/command_test.go: -------------------------------------------------------------------------------- 1 | package cli 2 | 3 | import ( 4 | "errors" 5 | "flag" 6 | "fmt" 7 | "io/ioutil" 8 | "strings" 9 | "testing" 10 | ) 11 | 12 | func TestCommandFlagParsing(t *testing.T) { 13 | cases := []struct { 14 | testArgs []string 15 | skipFlagParsing bool 16 | expectedErr error 17 | }{ 18 | {[]string{"blah", "blah", "-break"}, false, errors.New("flag provided but not defined: -break")}, // Test normal "not ignoring flags" flow 19 | {[]string{"blah", "blah"}, true, nil}, // Test SkipFlagParsing without any args that look like flags 20 | {[]string{"blah", "-break"}, true, nil}, // Test SkipFlagParsing with random flag arg 21 | {[]string{"blah", "-help"}, true, nil}, // Test SkipFlagParsing with "special" help flag arg 22 | } 23 | 24 | for _, c := range cases { 25 | app := NewApp() 26 | app.Writer = ioutil.Discard 27 | set := flag.NewFlagSet("test", 0) 28 | set.Parse(c.testArgs) 29 | 30 | context := NewContext(app, set, nil) 31 | 32 | command := Command{ 33 | Name: "test-cmd", 34 | Aliases: []string{"tc"}, 35 | Usage: "this is for testing", 36 | Description: "testing", 37 | Action: func(_ *Context) error { return nil }, 38 | } 39 | 40 | command.SkipFlagParsing = c.skipFlagParsing 41 | 42 | err := command.Run(context) 43 | 44 | expect(t, err, c.expectedErr) 45 | expect(t, []string(context.Args()), c.testArgs) 46 | } 47 | } 48 | 49 | func TestCommand_Run_DoesNotOverwriteErrorFromBefore(t *testing.T) { 50 | app := NewApp() 51 | app.Commands = []Command{ 52 | { 53 | Name: "bar", 54 | Before: func(c *Context) error { 55 | return fmt.Errorf("before error") 56 | }, 57 | After: func(c *Context) error { 58 | return fmt.Errorf("after error") 59 | }, 60 | }, 61 | } 62 | 63 | err := app.Run([]string{"foo", "bar"}) 64 | if err == nil { 65 | t.Fatalf("expected to receive error from Run, got none") 66 | } 67 | 68 | if !strings.Contains(err.Error(), "before error") { 69 | t.Errorf("expected text of error from Before method, but got none in \"%v\"", err) 70 | } 71 | if !strings.Contains(err.Error(), "after error") { 72 | t.Errorf("expected text of error from After method, but got none in \"%v\"", err) 73 | } 74 | } 75 | 76 | func TestCommand_OnUsageError_WithWrongFlagValue(t *testing.T) { 77 | app := NewApp() 78 | app.Commands = []Command{ 79 | { 80 | Name: "bar", 81 | Flags: []Flag{ 82 | IntFlag{Name: "flag"}, 83 | }, 84 | OnUsageError: func(c *Context, err error, _ bool) error { 85 | if !strings.HasPrefix(err.Error(), "invalid value \"wrong\"") { 86 | t.Errorf("Expect an invalid value error, but got \"%v\"", err) 87 | } 88 | return errors.New("intercepted: " + err.Error()) 89 | }, 90 | }, 91 | } 92 | 93 | err := app.Run([]string{"foo", "bar", "--flag=wrong"}) 94 | if err == nil { 95 | t.Fatalf("expected to receive error from Run, got none") 96 | } 97 | 98 | if !strings.HasPrefix(err.Error(), "intercepted: invalid value") { 99 | t.Errorf("Expect an intercepted error, but got \"%v\"", err) 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /vendor/github.com/urfave/cli/errors.go: -------------------------------------------------------------------------------- 1 | package cli 2 | 3 | import ( 4 | "fmt" 5 | "io" 6 | "os" 7 | "strings" 8 | ) 9 | 10 | // OsExiter is the function used when the app exits. If not set defaults to os.Exit. 11 | var OsExiter = os.Exit 12 | 13 | // ErrWriter is used to write errors to the user. This can be anything 14 | // implementing the io.Writer interface and defaults to os.Stderr. 15 | var ErrWriter io.Writer = os.Stderr 16 | 17 | // MultiError is an error that wraps multiple errors. 18 | type MultiError struct { 19 | Errors []error 20 | } 21 | 22 | // NewMultiError creates a new MultiError. Pass in one or more errors. 23 | func NewMultiError(err ...error) MultiError { 24 | return MultiError{Errors: err} 25 | } 26 | 27 | // Error implents the error interface. 28 | func (m MultiError) Error() string { 29 | errs := make([]string, len(m.Errors)) 30 | for i, err := range m.Errors { 31 | errs[i] = err.Error() 32 | } 33 | 34 | return strings.Join(errs, "\n") 35 | } 36 | 37 | // ExitCoder is the interface checked by `App` and `Command` for a custom exit 38 | // code 39 | type ExitCoder interface { 40 | error 41 | ExitCode() int 42 | } 43 | 44 | // ExitError fulfills both the builtin `error` interface and `ExitCoder` 45 | type ExitError struct { 46 | exitCode int 47 | message string 48 | } 49 | 50 | // NewExitError makes a new *ExitError 51 | func NewExitError(message string, exitCode int) *ExitError { 52 | return &ExitError{ 53 | exitCode: exitCode, 54 | message: message, 55 | } 56 | } 57 | 58 | // Error returns the string message, fulfilling the interface required by 59 | // `error` 60 | func (ee *ExitError) Error() string { 61 | return ee.message 62 | } 63 | 64 | // ExitCode returns the exit code, fulfilling the interface required by 65 | // `ExitCoder` 66 | func (ee *ExitError) ExitCode() int { 67 | return ee.exitCode 68 | } 69 | 70 | // HandleExitCoder checks if the error fulfills the ExitCoder interface, and if 71 | // so prints the error to stderr (if it is non-empty) and calls OsExiter with the 72 | // given exit code. If the given error is a MultiError, then this func is 73 | // called on all members of the Errors slice. 74 | func HandleExitCoder(err error) { 75 | if err == nil { 76 | return 77 | } 78 | 79 | if exitErr, ok := err.(ExitCoder); ok { 80 | if err.Error() != "" { 81 | fmt.Fprintln(ErrWriter, err) 82 | } 83 | OsExiter(exitErr.ExitCode()) 84 | return 85 | } 86 | 87 | if multiErr, ok := err.(MultiError); ok { 88 | for _, merr := range multiErr.Errors { 89 | HandleExitCoder(merr) 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /vendor/github.com/urfave/cli/errors_test.go: -------------------------------------------------------------------------------- 1 | package cli 2 | 3 | import ( 4 | "errors" 5 | "os" 6 | "testing" 7 | ) 8 | 9 | func TestHandleExitCoder_nil(t *testing.T) { 10 | exitCode := 0 11 | called := false 12 | 13 | OsExiter = func(rc int) { 14 | exitCode = rc 15 | called = true 16 | } 17 | 18 | defer func() { OsExiter = os.Exit }() 19 | 20 | HandleExitCoder(nil) 21 | 22 | expect(t, exitCode, 0) 23 | expect(t, called, false) 24 | } 25 | 26 | func TestHandleExitCoder_ExitCoder(t *testing.T) { 27 | exitCode := 0 28 | called := false 29 | 30 | OsExiter = func(rc int) { 31 | exitCode = rc 32 | called = true 33 | } 34 | 35 | defer func() { OsExiter = os.Exit }() 36 | 37 | HandleExitCoder(NewExitError("galactic perimeter breach", 9)) 38 | 39 | expect(t, exitCode, 9) 40 | expect(t, called, true) 41 | } 42 | 43 | func TestHandleExitCoder_MultiErrorWithExitCoder(t *testing.T) { 44 | exitCode := 0 45 | called := false 46 | 47 | OsExiter = func(rc int) { 48 | exitCode = rc 49 | called = true 50 | } 51 | 52 | defer func() { OsExiter = os.Exit }() 53 | 54 | exitErr := NewExitError("galactic perimeter breach", 9) 55 | err := NewMultiError(errors.New("wowsa"), errors.New("egad"), exitErr) 56 | HandleExitCoder(err) 57 | 58 | expect(t, exitCode, 9) 59 | expect(t, called, true) 60 | } 61 | -------------------------------------------------------------------------------- /vendor/github.com/urfave/cli/funcs.go: -------------------------------------------------------------------------------- 1 | package cli 2 | 3 | // BashCompleteFunc is an action to execute when the bash-completion flag is set 4 | type BashCompleteFunc func(*Context) 5 | 6 | // BeforeFunc is an action to execute before any subcommands are run, but after 7 | // the context is ready if a non-nil error is returned, no subcommands are run 8 | type BeforeFunc func(*Context) error 9 | 10 | // AfterFunc is an action to execute after any subcommands are run, but after the 11 | // subcommand has finished it is run even if Action() panics 12 | type AfterFunc func(*Context) error 13 | 14 | // ActionFunc is the action to execute when no subcommands are specified 15 | type ActionFunc func(*Context) error 16 | 17 | // CommandNotFoundFunc is executed if the proper command cannot be found 18 | type CommandNotFoundFunc func(*Context, string) 19 | 20 | // OnUsageErrorFunc is executed if an usage error occurs. This is useful for displaying 21 | // customized usage error messages. This function is able to replace the 22 | // original error messages. If this function is not set, the "Incorrect usage" 23 | // is displayed and the execution is interrupted. 24 | type OnUsageErrorFunc func(context *Context, err error, isSubcommand bool) error 25 | 26 | // FlagStringFunc is used by the help generation to display a flag, which is 27 | // expected to be a single line. 28 | type FlagStringFunc func(Flag) string 29 | -------------------------------------------------------------------------------- /vendor/github.com/urfave/cli/helpers_test.go: -------------------------------------------------------------------------------- 1 | package cli 2 | 3 | import ( 4 | "os" 5 | "reflect" 6 | "runtime" 7 | "strings" 8 | "testing" 9 | ) 10 | 11 | var ( 12 | wd, _ = os.Getwd() 13 | ) 14 | 15 | func expect(t *testing.T, a interface{}, b interface{}) { 16 | _, fn, line, _ := runtime.Caller(1) 17 | fn = strings.Replace(fn, wd+"/", "", -1) 18 | 19 | if !reflect.DeepEqual(a, b) { 20 | t.Errorf("(%s:%d) Expected %v (type %v) - Got %v (type %v)", fn, line, b, reflect.TypeOf(b), a, reflect.TypeOf(a)) 21 | } 22 | } 23 | 24 | func refute(t *testing.T, a interface{}, b interface{}) { 25 | if reflect.DeepEqual(a, b) { 26 | t.Errorf("Did not expect %v (type %v) - Got %v (type %v)", b, reflect.TypeOf(b), a, reflect.TypeOf(a)) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /vendor/github.com/urfave/cli/runtests: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | from __future__ import print_function 3 | 4 | import argparse 5 | import os 6 | import sys 7 | import tempfile 8 | 9 | from subprocess import check_call, check_output 10 | 11 | 12 | PACKAGE_NAME = os.environ.get( 13 | 'CLI_PACKAGE_NAME', 'github.com/urfave/cli' 14 | ) 15 | 16 | 17 | def main(sysargs=sys.argv[:]): 18 | targets = { 19 | 'vet': _vet, 20 | 'test': _test, 21 | 'gfmxr': _gfmxr, 22 | 'toc': _toc, 23 | } 24 | 25 | parser = argparse.ArgumentParser() 26 | parser.add_argument( 27 | 'target', nargs='?', choices=tuple(targets.keys()), default='test' 28 | ) 29 | args = parser.parse_args(sysargs[1:]) 30 | 31 | targets[args.target]() 32 | return 0 33 | 34 | 35 | def _test(): 36 | if check_output('go version'.split()).split()[2] < 'go1.2': 37 | _run('go test -v .'.split()) 38 | return 39 | 40 | coverprofiles = [] 41 | for subpackage in ['', 'altsrc']: 42 | coverprofile = 'cli.coverprofile' 43 | if subpackage != '': 44 | coverprofile = '{}.coverprofile'.format(subpackage) 45 | 46 | coverprofiles.append(coverprofile) 47 | 48 | _run('go test -v'.split() + [ 49 | '-coverprofile={}'.format(coverprofile), 50 | ('{}/{}'.format(PACKAGE_NAME, subpackage)).rstrip('/') 51 | ]) 52 | 53 | combined_name = _combine_coverprofiles(coverprofiles) 54 | _run('go tool cover -func={}'.format(combined_name).split()) 55 | os.remove(combined_name) 56 | 57 | 58 | def _gfmxr(): 59 | _run(['gfmxr', '-c', str(_gfmxr_count()), '-s', 'README.md']) 60 | 61 | 62 | def _vet(): 63 | _run('go vet ./...'.split()) 64 | 65 | 66 | def _toc(): 67 | _run(['node_modules/.bin/markdown-toc', '-i', 'README.md']) 68 | _run(['git', 'diff', '--quiet']) 69 | 70 | 71 | def _run(command): 72 | print('runtests: {}'.format(' '.join(command)), file=sys.stderr) 73 | check_call(command) 74 | 75 | 76 | def _gfmxr_count(): 77 | with open('README.md') as infile: 78 | lines = infile.read().splitlines() 79 | return len(filter(_is_go_runnable, lines)) 80 | 81 | 82 | def _is_go_runnable(line): 83 | return line.startswith('package main') 84 | 85 | 86 | def _combine_coverprofiles(coverprofiles): 87 | combined = tempfile.NamedTemporaryFile( 88 | suffix='.coverprofile', delete=False 89 | ) 90 | combined.write('mode: set\n') 91 | 92 | for coverprofile in coverprofiles: 93 | with open(coverprofile, 'r') as infile: 94 | for line in infile.readlines(): 95 | if not line.startswith('mode: '): 96 | combined.write(line) 97 | 98 | combined.flush() 99 | name = combined.name 100 | combined.close() 101 | return name 102 | 103 | 104 | if __name__ == '__main__': 105 | sys.exit(main()) 106 | -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v2/LICENSE.libyaml: -------------------------------------------------------------------------------- 1 | The following files were ported to Go from C files of libyaml, and thus 2 | are still covered by their original copyright and license: 3 | 4 | apic.go 5 | emitterc.go 6 | parserc.go 7 | readerc.go 8 | scannerc.go 9 | writerc.go 10 | yamlh.go 11 | yamlprivateh.go 12 | 13 | Copyright (c) 2006 Kirill Simonov 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy of 16 | this software and associated documentation files (the "Software"), to deal in 17 | the Software without restriction, including without limitation the rights to 18 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 19 | of the Software, and to permit persons to whom the Software is furnished to do 20 | so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v2/README.md: -------------------------------------------------------------------------------- 1 | # YAML support for the Go language 2 | 3 | Introduction 4 | ------------ 5 | 6 | The yaml package enables Go programs to comfortably encode and decode YAML 7 | values. It was developed within [Canonical](https://www.canonical.com) as 8 | part of the [juju](https://juju.ubuntu.com) project, and is based on a 9 | pure Go port of the well-known [libyaml](http://pyyaml.org/wiki/LibYAML) 10 | C library to parse and generate YAML data quickly and reliably. 11 | 12 | Compatibility 13 | ------------- 14 | 15 | The yaml package supports most of YAML 1.1 and 1.2, including support for 16 | anchors, tags, map merging, etc. Multi-document unmarshalling is not yet 17 | implemented, and base-60 floats from YAML 1.1 are purposefully not 18 | supported since they're a poor design and are gone in YAML 1.2. 19 | 20 | Installation and usage 21 | ---------------------- 22 | 23 | The import path for the package is *gopkg.in/yaml.v2*. 24 | 25 | To install it, run: 26 | 27 | go get gopkg.in/yaml.v2 28 | 29 | API documentation 30 | ----------------- 31 | 32 | If opened in a browser, the import path itself leads to the API documentation: 33 | 34 | * [https://gopkg.in/yaml.v2](https://gopkg.in/yaml.v2) 35 | 36 | API stability 37 | ------------- 38 | 39 | The package API for yaml v2 will remain stable as described in [gopkg.in](https://gopkg.in). 40 | 41 | 42 | License 43 | ------- 44 | 45 | The yaml package is licensed under the LGPL with an exception that allows it to be linked statically. Please see the LICENSE file for details. 46 | 47 | 48 | Example 49 | ------- 50 | 51 | ```Go 52 | package main 53 | 54 | import ( 55 | "fmt" 56 | "log" 57 | 58 | "gopkg.in/yaml.v2" 59 | ) 60 | 61 | var data = ` 62 | a: Easy! 63 | b: 64 | c: 2 65 | d: [3, 4] 66 | ` 67 | 68 | type T struct { 69 | A string 70 | B struct { 71 | RenamedC int `yaml:"c"` 72 | D []int `yaml:",flow"` 73 | } 74 | } 75 | 76 | func main() { 77 | t := T{} 78 | 79 | err := yaml.Unmarshal([]byte(data), &t) 80 | if err != nil { 81 | log.Fatalf("error: %v", err) 82 | } 83 | fmt.Printf("--- t:\n%v\n\n", t) 84 | 85 | d, err := yaml.Marshal(&t) 86 | if err != nil { 87 | log.Fatalf("error: %v", err) 88 | } 89 | fmt.Printf("--- t dump:\n%s\n\n", string(d)) 90 | 91 | m := make(map[interface{}]interface{}) 92 | 93 | err = yaml.Unmarshal([]byte(data), &m) 94 | if err != nil { 95 | log.Fatalf("error: %v", err) 96 | } 97 | fmt.Printf("--- m:\n%v\n\n", m) 98 | 99 | d, err = yaml.Marshal(&m) 100 | if err != nil { 101 | log.Fatalf("error: %v", err) 102 | } 103 | fmt.Printf("--- m dump:\n%s\n\n", string(d)) 104 | } 105 | ``` 106 | 107 | This example will generate the following output: 108 | 109 | ``` 110 | --- t: 111 | {Easy! {2 [3 4]}} 112 | 113 | --- t dump: 114 | a: Easy! 115 | b: 116 | c: 2 117 | d: [3, 4] 118 | 119 | 120 | --- m: 121 | map[a:Easy! b:map[c:2 d:[3 4]]] 122 | 123 | --- m dump: 124 | a: Easy! 125 | b: 126 | c: 2 127 | d: 128 | - 3 129 | - 4 130 | ``` 131 | 132 | -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v2/sorter.go: -------------------------------------------------------------------------------- 1 | package yaml 2 | 3 | import ( 4 | "reflect" 5 | "unicode" 6 | ) 7 | 8 | type keyList []reflect.Value 9 | 10 | func (l keyList) Len() int { return len(l) } 11 | func (l keyList) Swap(i, j int) { l[i], l[j] = l[j], l[i] } 12 | func (l keyList) Less(i, j int) bool { 13 | a := l[i] 14 | b := l[j] 15 | ak := a.Kind() 16 | bk := b.Kind() 17 | for (ak == reflect.Interface || ak == reflect.Ptr) && !a.IsNil() { 18 | a = a.Elem() 19 | ak = a.Kind() 20 | } 21 | for (bk == reflect.Interface || bk == reflect.Ptr) && !b.IsNil() { 22 | b = b.Elem() 23 | bk = b.Kind() 24 | } 25 | af, aok := keyFloat(a) 26 | bf, bok := keyFloat(b) 27 | if aok && bok { 28 | if af != bf { 29 | return af < bf 30 | } 31 | if ak != bk { 32 | return ak < bk 33 | } 34 | return numLess(a, b) 35 | } 36 | if ak != reflect.String || bk != reflect.String { 37 | return ak < bk 38 | } 39 | ar, br := []rune(a.String()), []rune(b.String()) 40 | for i := 0; i < len(ar) && i < len(br); i++ { 41 | if ar[i] == br[i] { 42 | continue 43 | } 44 | al := unicode.IsLetter(ar[i]) 45 | bl := unicode.IsLetter(br[i]) 46 | if al && bl { 47 | return ar[i] < br[i] 48 | } 49 | if al || bl { 50 | return bl 51 | } 52 | var ai, bi int 53 | var an, bn int64 54 | for ai = i; ai < len(ar) && unicode.IsDigit(ar[ai]); ai++ { 55 | an = an*10 + int64(ar[ai]-'0') 56 | } 57 | for bi = i; bi < len(br) && unicode.IsDigit(br[bi]); bi++ { 58 | bn = bn*10 + int64(br[bi]-'0') 59 | } 60 | if an != bn { 61 | return an < bn 62 | } 63 | if ai != bi { 64 | return ai < bi 65 | } 66 | return ar[i] < br[i] 67 | } 68 | return len(ar) < len(br) 69 | } 70 | 71 | // keyFloat returns a float value for v if it is a number/bool 72 | // and whether it is a number/bool or not. 73 | func keyFloat(v reflect.Value) (f float64, ok bool) { 74 | switch v.Kind() { 75 | case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: 76 | return float64(v.Int()), true 77 | case reflect.Float32, reflect.Float64: 78 | return v.Float(), true 79 | case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: 80 | return float64(v.Uint()), true 81 | case reflect.Bool: 82 | if v.Bool() { 83 | return 1, true 84 | } 85 | return 0, true 86 | } 87 | return 0, false 88 | } 89 | 90 | // numLess returns whether a < b. 91 | // a and b must necessarily have the same kind. 92 | func numLess(a, b reflect.Value) bool { 93 | switch a.Kind() { 94 | case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: 95 | return a.Int() < b.Int() 96 | case reflect.Float32, reflect.Float64: 97 | return a.Float() < b.Float() 98 | case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: 99 | return a.Uint() < b.Uint() 100 | case reflect.Bool: 101 | return !a.Bool() && b.Bool() 102 | } 103 | panic("not a number") 104 | } 105 | -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v2/suite_test.go: -------------------------------------------------------------------------------- 1 | package yaml_test 2 | 3 | import ( 4 | . "gopkg.in/check.v1" 5 | "testing" 6 | ) 7 | 8 | func Test(t *testing.T) { TestingT(t) } 9 | 10 | type S struct{} 11 | 12 | var _ = Suite(&S{}) 13 | -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v2/writerc.go: -------------------------------------------------------------------------------- 1 | package yaml 2 | 3 | // Set the writer error and return false. 4 | func yaml_emitter_set_writer_error(emitter *yaml_emitter_t, problem string) bool { 5 | emitter.error = yaml_WRITER_ERROR 6 | emitter.problem = problem 7 | return false 8 | } 9 | 10 | // Flush the output buffer. 11 | func yaml_emitter_flush(emitter *yaml_emitter_t) bool { 12 | if emitter.write_handler == nil { 13 | panic("write handler not set") 14 | } 15 | 16 | // Check if the buffer is empty. 17 | if emitter.buffer_pos == 0 { 18 | return true 19 | } 20 | 21 | // If the output encoding is UTF-8, we don't need to recode the buffer. 22 | if emitter.encoding == yaml_UTF8_ENCODING { 23 | if err := emitter.write_handler(emitter, emitter.buffer[:emitter.buffer_pos]); err != nil { 24 | return yaml_emitter_set_writer_error(emitter, "write error: "+err.Error()) 25 | } 26 | emitter.buffer_pos = 0 27 | return true 28 | } 29 | 30 | // Recode the buffer into the raw buffer. 31 | var low, high int 32 | if emitter.encoding == yaml_UTF16LE_ENCODING { 33 | low, high = 0, 1 34 | } else { 35 | high, low = 1, 0 36 | } 37 | 38 | pos := 0 39 | for pos < emitter.buffer_pos { 40 | // See the "reader.c" code for more details on UTF-8 encoding. Note 41 | // that we assume that the buffer contains a valid UTF-8 sequence. 42 | 43 | // Read the next UTF-8 character. 44 | octet := emitter.buffer[pos] 45 | 46 | var w int 47 | var value rune 48 | switch { 49 | case octet&0x80 == 0x00: 50 | w, value = 1, rune(octet&0x7F) 51 | case octet&0xE0 == 0xC0: 52 | w, value = 2, rune(octet&0x1F) 53 | case octet&0xF0 == 0xE0: 54 | w, value = 3, rune(octet&0x0F) 55 | case octet&0xF8 == 0xF0: 56 | w, value = 4, rune(octet&0x07) 57 | } 58 | for k := 1; k < w; k++ { 59 | octet = emitter.buffer[pos+k] 60 | value = (value << 6) + (rune(octet) & 0x3F) 61 | } 62 | pos += w 63 | 64 | // Write the character. 65 | if value < 0x10000 { 66 | var b [2]byte 67 | b[high] = byte(value >> 8) 68 | b[low] = byte(value & 0xFF) 69 | emitter.raw_buffer = append(emitter.raw_buffer, b[0], b[1]) 70 | } else { 71 | // Write the character using a surrogate pair (check "reader.c"). 72 | var b [4]byte 73 | value -= 0x10000 74 | b[high] = byte(0xD8 + (value >> 18)) 75 | b[low] = byte((value >> 10) & 0xFF) 76 | b[high+2] = byte(0xDC + ((value >> 8) & 0xFF)) 77 | b[low+2] = byte(value & 0xFF) 78 | emitter.raw_buffer = append(emitter.raw_buffer, b[0], b[1], b[2], b[3]) 79 | } 80 | } 81 | 82 | // Write the raw buffer. 83 | if err := emitter.write_handler(emitter, emitter.raw_buffer); err != nil { 84 | return yaml_emitter_set_writer_error(emitter, "write error: "+err.Error()) 85 | } 86 | emitter.buffer_pos = 0 87 | emitter.raw_buffer = emitter.raw_buffer[:0] 88 | return true 89 | } 90 | --------------------------------------------------------------------------------