terraform/vendor/github.com/hashicorp/go-getter
Paul Hinze 6fe2703665 Vendor all dependencies w/ Godep
* Remove `make updatedeps` from Travis build. We'll follow up with more
   specific plans around dependency updating in subsequent PRs.
 * Update all `make` targets to set `GO15VENDOREXPERIMENT=1` and to
   filter out `/vendor/` from `./...` where appropriate.
 * Temporarily remove `vet` from the `make test` target until we can
   figure out how to get it to not vet `vendor/`. (Initial
   experimentation failed to yield the proper incantation.)

Everything is pinned to current master, with the exception of:

 * Azure/azure-sdk-for-go which is pinned before the breaking change today
 * aws/aws-sdk-go which is pinned to the most recent tag

The documentation still needs to be updated, which we can do in a follow
up PR. The goal here is to unblock release.
2016-01-29 15:08:48 -06:00
..
helper/url Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
test-fixtures Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
.travis.yml Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
LICENSE Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
README.md Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
Vagrantfile Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
client.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
copy_dir.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
decompress.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
decompress_bzip2.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
decompress_bzip2_test.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
decompress_gzip.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
decompress_gzip_test.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
decompress_tbz2.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
decompress_tbz2_test.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
decompress_testing.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
decompress_tgz.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
decompress_tgz_test.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
decompress_zip.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
decompress_zip_test.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
detect.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
detect_bitbucket.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
detect_bitbucket_test.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
detect_file.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
detect_file_test.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
detect_github.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
detect_github_test.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
detect_s3.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
detect_s3_test.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
detect_test.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
folder_storage.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
folder_storage_test.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
get.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
get_file.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
get_file_test.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
get_git.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
get_git_test.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
get_hg.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
get_hg_test.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
get_http.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
get_http_test.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
get_mock.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
get_s3.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
get_s3_test.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
get_test.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
module_test.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
source.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
source_test.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
storage.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00

README.md

go-getter

Build Status Go Documentation

go-getter is a library for Go (golang) for downloading files or directories from various sources using a URL as the primary form of input.

The power of this library is being flexible in being able to download from a number of different sources (file paths, Git, HTTP, Mercurial, etc.) using a single string as input. This removes the burden of knowing how to download from a variety of sources from the implementer.

The concept of a detector automatically turns invalid URLs into proper URLs. For example: "github.com/hashicorp/go-getter" would turn into a Git URL. Or "./foo" would turn into a file URL. These are extensible.

This library is used by Terraform for downloading modules, Otto for dependencies and Appfile imports, and Nomad for downloading binaries.

Installation and Usage

Package documentation can be found on GoDoc.

Installation can be done with a normal go get:

$ go get github.com/hashicorp/go-getter

URL Format

go-getter uses a single string URL as input to downlaod from a variety of protocols. go-getter has various "tricks" with this URL to do certain things. This section documents the URL format.

Supported Protocols and Detectors

Protocols are used to download files/directories using a specific mechanism. Example protocols are Git and HTTP.

Detectors are used to transform a valid or invalid URL into another URL if it matches a certain pattern. Example: "github.com/user/repo" is automatically transformed into a fully valid Git URL. This allows go-getter to be very user friendly.

go-getter out of the box supports the following protocols. Additional protocols can be augmented at runtime by implementing the Getter interface.

  • Local files
  • Git
  • Mercurial
  • HTTP
  • Amazon S3

In addition to the above protocols, go-getter has what are called "detectors." These take a URL and attempt to automatically choose the best protocol for it, which might involve even changing the protocol. The following detection is built-in by default:

  • File paths such as "./foo" are automatically changed to absolute file URLs.
  • GitHub URLs, such as "github.com/mitchellh/vagrant" are automatically changed to Git protocol over HTTP.
  • BitBucket URLs, such as "bitbucket.org/mitchellh/vagrant" are automatically changed to a Git or mercurial protocol using the BitBucket API.

Forced Protocol

In some cases, the protocol to use is ambiguous depending on the source URL. For example, "http://github.com/mitchellh/vagrant.git" could reference an HTTP URL or a Git URL. Forced protocol syntax is used to disambiguate this URL.

Forced protocol can be done by prefixing the URL with the protocol followed by double colons. For example: git::http://github.com/mitchellh/vagrant.git would download the given HTTP URL using the Git protocol.

Forced protocols will also override any detectors.

In the absense of a forced protocol, detectors may be run on the URL, transforming the protocol anyways. The above example would've used the Git protocol either way since the Git detector would've detected it was a GitHub URL.

Checksumming

For file downloads of any protocol, go-getter can automatically verify a checksum for you. Note that checksumming only works for downloading files, not directories, but checksumming will work for any protocol.

To checksum a file, append a checksum query parameter to the URL. The paramter value should be in the format of type:value, where type is "md5", "sha1", "sha256", or "sha512". The "value" should be the actual checksum value. go-getter will parse out this query parameter automatically and use it to verify the checksum. An example URL is shown below:

./foo.txt?checksum=md5:b7d96c89d09d9e204f5fedc4d5d55b21

The checksum query parameter is never sent to the backend protocol implementation. It is used at a higher level by go-getter itself.

Unarchiving

go-getter will automatically unarchive files into a file or directory based on the extension of the file being requested (over any protocol). This works for both file and directory downloads.

go-getter looks for an archive query parameter to specify the format of the archive. If this isn't specified, go-getter will use the extension of the path to see if it appears archived. Unarchiving can be explicitly disabled by setting the archive query parameter to false.

The following archive formats are supported:

  • tar.gz and tgz
  • tar.bz2 and tbz2
  • zip
  • gz
  • bz2

For example, an example URL is shown below:

./foo.zip

This will automatically be inferred to be a ZIP file and will be extracted. You can also be explicit about the archive type:

./some/other/path?archive=zip

And finally, you can disable archiving completely:

./some/path?archive=false

You can combine unarchiving with the other features of go-getter such as checksumming. The special archive query parameter will be removed from the URL before going to the final protocol downloader.