diff options
Diffstat (limited to 'vendor/github.com/hashicorp')
-rw-r--r-- | vendor/github.com/hashicorp/golang-lru/.gitignore | 23 | ||||
-rw-r--r-- | vendor/github.com/hashicorp/golang-lru/README.md | 25 | ||||
-rw-r--r-- | vendor/github.com/hashicorp/hcl/.gitignore | 9 | ||||
-rw-r--r-- | vendor/github.com/hashicorp/hcl/.travis.yml | 13 | ||||
-rw-r--r-- | vendor/github.com/hashicorp/hcl/Makefile | 18 | ||||
-rw-r--r-- | vendor/github.com/hashicorp/hcl/README.md | 125 | ||||
-rw-r--r-- | vendor/github.com/hashicorp/hcl/appveyor.yml | 19 | ||||
-rw-r--r-- | vendor/github.com/hashicorp/hcl/hcl/fmtcmd/fmtcmd.go | 162 | ||||
-rw-r--r-- | vendor/github.com/hashicorp/hcl/testhelper/unix2dos.go | 15 |
9 files changed, 232 insertions, 177 deletions
diff --git a/vendor/github.com/hashicorp/golang-lru/.gitignore b/vendor/github.com/hashicorp/golang-lru/.gitignore new file mode 100644 index 00000000..83656241 --- /dev/null +++ b/vendor/github.com/hashicorp/golang-lru/.gitignore @@ -0,0 +1,23 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test diff --git a/vendor/github.com/hashicorp/golang-lru/README.md b/vendor/github.com/hashicorp/golang-lru/README.md new file mode 100644 index 00000000..33e58cfa --- /dev/null +++ b/vendor/github.com/hashicorp/golang-lru/README.md @@ -0,0 +1,25 @@ +golang-lru +========== + +This provides the `lru` package which implements a fixed-size +thread safe LRU cache. It is based on the cache in Groupcache. + +Documentation +============= + +Full docs are available on [Godoc](http://godoc.org/github.com/hashicorp/golang-lru) + +Example +======= + +Using the LRU is very simple: + +```go +l, _ := New(128) +for i := 0; i < 256; i++ { + l.Add(i, nil) +} +if l.Len() != 128 { + panic(fmt.Sprintf("bad len: %v", l.Len())) +} +``` diff --git a/vendor/github.com/hashicorp/hcl/.gitignore b/vendor/github.com/hashicorp/hcl/.gitignore new file mode 100644 index 00000000..15586a2b --- /dev/null +++ b/vendor/github.com/hashicorp/hcl/.gitignore @@ -0,0 +1,9 @@ +y.output
+
+# ignore intellij files
+.idea
+*.iml
+*.ipr
+*.iws
+
+*.test
diff --git a/vendor/github.com/hashicorp/hcl/.travis.yml b/vendor/github.com/hashicorp/hcl/.travis.yml new file mode 100644 index 00000000..cb63a321 --- /dev/null +++ b/vendor/github.com/hashicorp/hcl/.travis.yml @@ -0,0 +1,13 @@ +sudo: false + +language: go + +go: + - 1.x + - tip + +branches: + only: + - master + +script: make test diff --git a/vendor/github.com/hashicorp/hcl/Makefile b/vendor/github.com/hashicorp/hcl/Makefile new file mode 100644 index 00000000..84fd743f --- /dev/null +++ b/vendor/github.com/hashicorp/hcl/Makefile @@ -0,0 +1,18 @@ +TEST?=./...
+
+default: test
+
+fmt: generate
+ go fmt ./...
+
+test: generate
+ go get -t ./...
+ go test $(TEST) $(TESTARGS)
+
+generate:
+ go generate ./...
+
+updatedeps:
+ go get -u golang.org/x/tools/cmd/stringer
+
+.PHONY: default generate test updatedeps
diff --git a/vendor/github.com/hashicorp/hcl/README.md b/vendor/github.com/hashicorp/hcl/README.md new file mode 100644 index 00000000..c8223326 --- /dev/null +++ b/vendor/github.com/hashicorp/hcl/README.md @@ -0,0 +1,125 @@ +# HCL + +[![GoDoc](https://godoc.org/github.com/hashicorp/hcl?status.png)](https://godoc.org/github.com/hashicorp/hcl) [![Build Status](https://travis-ci.org/hashicorp/hcl.svg?branch=master)](https://travis-ci.org/hashicorp/hcl) + +HCL (HashiCorp Configuration Language) is a configuration language built +by HashiCorp. The goal of HCL is to build a structured configuration language +that is both human and machine friendly for use with command-line tools, but +specifically targeted towards DevOps tools, servers, etc. + +HCL is also fully JSON compatible. That is, JSON can be used as completely +valid input to a system expecting HCL. This helps makes systems +interoperable with other systems. + +HCL is heavily inspired by +[libucl](https://github.com/vstakhov/libucl), +nginx configuration, and others similar. + +## Why? + +A common question when viewing HCL is to ask the question: why not +JSON, YAML, etc.? + +Prior to HCL, the tools we built at [HashiCorp](http://www.hashicorp.com) +used a variety of configuration languages from full programming languages +such as Ruby to complete data structure languages such as JSON. What we +learned is that some people wanted human-friendly configuration languages +and some people wanted machine-friendly languages. + +JSON fits a nice balance in this, but is fairly verbose and most +importantly doesn't support comments. With YAML, we found that beginners +had a really hard time determining what the actual structure was, and +ended up guessing more often than not whether to use a hyphen, colon, etc. +in order to represent some configuration key. + +Full programming languages such as Ruby enable complex behavior +a configuration language shouldn't usually allow, and also forces +people to learn some set of Ruby. + +Because of this, we decided to create our own configuration language +that is JSON-compatible. Our configuration language (HCL) is designed +to be written and modified by humans. The API for HCL allows JSON +as an input so that it is also machine-friendly (machines can generate +JSON instead of trying to generate HCL). + +Our goal with HCL is not to alienate other configuration languages. +It is instead to provide HCL as a specialized language for our tools, +and JSON as the interoperability layer. + +## Syntax + +For a complete grammar, please see the parser itself. A high-level overview +of the syntax and grammar is listed here. + + * Single line comments start with `#` or `//` + + * Multi-line comments are wrapped in `/*` and `*/`. Nested block comments + are not allowed. A multi-line comment (also known as a block comment) + terminates at the first `*/` found. + + * Values are assigned with the syntax `key = value` (whitespace doesn't + matter). The value can be any primitive: a string, number, boolean, + object, or list. + + * Strings are double-quoted and can contain any UTF-8 characters. + Example: `"Hello, World"` + + * Multi-line strings start with `<<EOF` at the end of a line, and end + with `EOF` on its own line ([here documents](https://en.wikipedia.org/wiki/Here_document)). + Any text may be used in place of `EOF`. Example: +``` +<<FOO +hello +world +FOO +``` + + * Numbers are assumed to be base 10. If you prefix a number with 0x, + it is treated as a hexadecimal. If it is prefixed with 0, it is + treated as an octal. Numbers can be in scientific notation: "1e10". + + * Boolean values: `true`, `false` + + * Arrays can be made by wrapping it in `[]`. Example: + `["foo", "bar", 42]`. Arrays can contain primitives, + other arrays, and objects. As an alternative, lists + of objects can be created with repeated blocks, using + this structure: + + ```hcl + service { + key = "value" + } + + service { + key = "value" + } + ``` + +Objects and nested objects are created using the structure shown below: + +``` +variable "ami" { + description = "the AMI to use" +} +``` +This would be equivalent to the following json: +``` json +{ + "variable": { + "ami": { + "description": "the AMI to use" + } + } +} +``` + +## Thanks + +Thanks to: + + * [@vstakhov](https://github.com/vstakhov) - The original libucl parser + and syntax that HCL was based off of. + + * [@fatih](https://github.com/fatih) - The rewritten HCL parser + in pure Go (no goyacc) and support for a printer. diff --git a/vendor/github.com/hashicorp/hcl/appveyor.yml b/vendor/github.com/hashicorp/hcl/appveyor.yml new file mode 100644 index 00000000..4db0b711 --- /dev/null +++ b/vendor/github.com/hashicorp/hcl/appveyor.yml @@ -0,0 +1,19 @@ +version: "build-{branch}-{build}" +image: Visual Studio 2015 +clone_folder: c:\gopath\src\github.com\hashicorp\hcl +environment: + GOPATH: c:\gopath +init: + - git config --global core.autocrlf false +install: +- cmd: >- + echo %Path% + + go version + + go env + + go get -t ./... + +build_script: +- cmd: go test -v ./... diff --git a/vendor/github.com/hashicorp/hcl/hcl/fmtcmd/fmtcmd.go b/vendor/github.com/hashicorp/hcl/hcl/fmtcmd/fmtcmd.go deleted file mode 100644 index 2380d71e..00000000 --- a/vendor/github.com/hashicorp/hcl/hcl/fmtcmd/fmtcmd.go +++ /dev/null @@ -1,162 +0,0 @@ -// Derivative work from: -// - https://golang.org/src/cmd/gofmt/gofmt.go -// - https://github.com/fatih/hclfmt - -package fmtcmd - -import ( - "bytes" - "errors" - "fmt" - "io" - "io/ioutil" - "os" - "os/exec" - "path/filepath" - "strings" - - "github.com/hashicorp/hcl/hcl/printer" -) - -var ( - ErrWriteStdin = errors.New("cannot use write option with standard input") -) - -type Options struct { - List bool // list files whose formatting differs - Write bool // write result to (source) file instead of stdout - Diff bool // display diffs of formatting changes -} - -func isValidFile(f os.FileInfo, extensions []string) bool { - if !f.IsDir() && !strings.HasPrefix(f.Name(), ".") { - for _, ext := range extensions { - if strings.HasSuffix(f.Name(), "."+ext) { - return true - } - } - } - - return false -} - -// If in == nil, the source is the contents of the file with the given filename. -func processFile(filename string, in io.Reader, out io.Writer, stdin bool, opts Options) error { - if in == nil { - f, err := os.Open(filename) - if err != nil { - return err - } - defer f.Close() - in = f - } - - src, err := ioutil.ReadAll(in) - if err != nil { - return err - } - - res, err := printer.Format(src) - if err != nil { - return fmt.Errorf("In %s: %s", filename, err) - } - - if !bytes.Equal(src, res) { - // formatting has changed - if opts.List { - fmt.Fprintln(out, filename) - } - if opts.Write { - err = ioutil.WriteFile(filename, res, 0644) - if err != nil { - return err - } - } - if opts.Diff { - data, err := diff(src, res) - if err != nil { - return fmt.Errorf("computing diff: %s", err) - } - fmt.Fprintf(out, "diff a/%s b/%s\n", filename, filename) - out.Write(data) - } - } - - if !opts.List && !opts.Write && !opts.Diff { - _, err = out.Write(res) - } - - return err -} - -func walkDir(path string, extensions []string, stdout io.Writer, opts Options) error { - visitFile := func(path string, f os.FileInfo, err error) error { - if err == nil && isValidFile(f, extensions) { - err = processFile(path, nil, stdout, false, opts) - } - return err - } - - return filepath.Walk(path, visitFile) -} - -func Run( - paths, extensions []string, - stdin io.Reader, - stdout io.Writer, - opts Options, -) error { - if len(paths) == 0 { - if opts.Write { - return ErrWriteStdin - } - if err := processFile("<standard input>", stdin, stdout, true, opts); err != nil { - return err - } - return nil - } - - for _, path := range paths { - switch dir, err := os.Stat(path); { - case err != nil: - return err - case dir.IsDir(): - if err := walkDir(path, extensions, stdout, opts); err != nil { - return err - } - default: - if err := processFile(path, nil, stdout, false, opts); err != nil { - return err - } - } - } - - return nil -} - -func diff(b1, b2 []byte) (data []byte, err error) { - f1, err := ioutil.TempFile("", "") - if err != nil { - return - } - defer os.Remove(f1.Name()) - defer f1.Close() - - f2, err := ioutil.TempFile("", "") - if err != nil { - return - } - defer os.Remove(f2.Name()) - defer f2.Close() - - f1.Write(b1) - f2.Write(b2) - - data, err = exec.Command("diff", "-u", f1.Name(), f2.Name()).CombinedOutput() - if len(data) > 0 { - // diff exits with a non-zero status when the files don't match. - // Ignore that failure as long as we get output. - err = nil - } - return -} diff --git a/vendor/github.com/hashicorp/hcl/testhelper/unix2dos.go b/vendor/github.com/hashicorp/hcl/testhelper/unix2dos.go deleted file mode 100644 index 827ac6f1..00000000 --- a/vendor/github.com/hashicorp/hcl/testhelper/unix2dos.go +++ /dev/null @@ -1,15 +0,0 @@ -package testhelper - -import ( - "runtime" - "strings" -) - -// Converts the line endings when on Windows -func Unix2dos(unix string) string { - if runtime.GOOS != "windows" { - return unix - } - - return strings.Replace(unix, "\n", "\r\n", -1) -} |