From 083772f5fab49c6e44e06d4d8d846537838bd46b Mon Sep 17 00:00:00 2001 From: Joel Diaz Date: Tue, 19 Feb 2019 15:21:25 -0500 Subject: [PATCH] move to static list of passthrough creds in preparation for moving the credentialsrequests manifests out of this repo (and into each coresponding repo's own location), remove the CredentialsRequest manifests and (for now) keep a static list in pkg/controller/utils/utils.go (to continue to allow annotating mint vs passthrough) remove go-bindata dependency --- Gopkg.lock | 11 - Gopkg.toml | 1 - Makefile | 2 - hack/update-bindata.sh | 20 -- ...perator_03_cred-openshift-cluster-api.yaml | 31 -- ...tial-operator_03_cred-openshift-image-.txt | 1 - ...ator_03_cred-openshift-image-registry.yaml | 35 --- ...ntial-operator_03_cred-openshift-image.txt | 1 - ...al-operator_03_cred-openshift-ingress.yaml | 23 -- pkg/controller/assets/bindata.go | 106 ------- pkg/controller/utils/utils.go | 90 ++++-- .../jteeuwen/go-bindata/CONTRIBUTING.md | 79 ----- vendor/github.com/jteeuwen/go-bindata/LICENSE | 3 - .../github.com/jteeuwen/go-bindata/README.md | 189 ----------- .../github.com/jteeuwen/go-bindata/asset.go | 19 -- .../jteeuwen/go-bindata/bytewriter.go | 44 --- .../github.com/jteeuwen/go-bindata/config.go | 192 ------------ .../github.com/jteeuwen/go-bindata/convert.go | 200 ------------ .../github.com/jteeuwen/go-bindata/debug.go | 65 ---- vendor/github.com/jteeuwen/go-bindata/doc.go | 129 -------- .../go-bindata/go-bindata/AppendSliceValue.go | 22 -- .../jteeuwen/go-bindata/go-bindata/main.go | 102 ------ .../jteeuwen/go-bindata/go-bindata/version.go | 31 -- .../github.com/jteeuwen/go-bindata/release.go | 295 ------------------ .../jteeuwen/go-bindata/stringwriter.go | 36 --- .../go-bindata/testdata/in/a/test.asset | 1 - .../go-bindata/testdata/in/b/test.asset | 1 - .../go-bindata/testdata/in/c/test.asset | 1 - .../go-bindata/testdata/in/test.asset | 1 - .../testdata/out/compress-memcopy.go | 86 ----- .../testdata/out/compress-nomemcopy.go | 88 ------ .../jteeuwen/go-bindata/testdata/out/debug.go | 80 ----- .../testdata/out/nocompress-memcopy.go | 46 --- .../testdata/out/nocompress-nomemcopy.go | 70 ----- vendor/github.com/jteeuwen/go-bindata/toc.go | 195 ------------ 35 files changed, 66 insertions(+), 2230 deletions(-) delete mode 100755 hack/update-bindata.sh delete mode 100644 manifests/0000_30_cloud-credential-operator_03_cred-openshift-cluster-api.yaml delete mode 100644 manifests/0000_30_cloud-credential-operator_03_cred-openshift-image-.txt delete mode 100644 manifests/0000_30_cloud-credential-operator_03_cred-openshift-image-registry.yaml delete mode 100644 manifests/0000_30_cloud-credential-operator_03_cred-openshift-image.txt delete mode 100644 manifests/0000_30_cloud-credential-operator_03_cred-openshift-ingress.yaml delete mode 100644 pkg/controller/assets/bindata.go delete mode 100644 vendor/github.com/jteeuwen/go-bindata/CONTRIBUTING.md delete mode 100644 vendor/github.com/jteeuwen/go-bindata/LICENSE delete mode 100644 vendor/github.com/jteeuwen/go-bindata/README.md delete mode 100644 vendor/github.com/jteeuwen/go-bindata/asset.go delete mode 100644 vendor/github.com/jteeuwen/go-bindata/bytewriter.go delete mode 100644 vendor/github.com/jteeuwen/go-bindata/config.go delete mode 100644 vendor/github.com/jteeuwen/go-bindata/convert.go delete mode 100644 vendor/github.com/jteeuwen/go-bindata/debug.go delete mode 100644 vendor/github.com/jteeuwen/go-bindata/doc.go delete mode 100644 vendor/github.com/jteeuwen/go-bindata/go-bindata/AppendSliceValue.go delete mode 100644 vendor/github.com/jteeuwen/go-bindata/go-bindata/main.go delete mode 100644 vendor/github.com/jteeuwen/go-bindata/go-bindata/version.go delete mode 100644 vendor/github.com/jteeuwen/go-bindata/release.go delete mode 100644 vendor/github.com/jteeuwen/go-bindata/stringwriter.go delete mode 100644 vendor/github.com/jteeuwen/go-bindata/testdata/in/a/test.asset delete mode 100644 vendor/github.com/jteeuwen/go-bindata/testdata/in/b/test.asset delete mode 100644 vendor/github.com/jteeuwen/go-bindata/testdata/in/c/test.asset delete mode 100644 vendor/github.com/jteeuwen/go-bindata/testdata/in/test.asset delete mode 100644 vendor/github.com/jteeuwen/go-bindata/testdata/out/compress-memcopy.go delete mode 100644 vendor/github.com/jteeuwen/go-bindata/testdata/out/compress-nomemcopy.go delete mode 100644 vendor/github.com/jteeuwen/go-bindata/testdata/out/debug.go delete mode 100644 vendor/github.com/jteeuwen/go-bindata/testdata/out/nocompress-memcopy.go delete mode 100644 vendor/github.com/jteeuwen/go-bindata/testdata/out/nocompress-nomemcopy.go delete mode 100644 vendor/github.com/jteeuwen/go-bindata/toc.go diff --git a/Gopkg.lock b/Gopkg.lock index 8d30df4ec..5f6c1b491 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -284,14 +284,6 @@ revision = "1624edc4454b8682399def8740d46db5e4362ba4" version = "v1.1.5" -[[projects]] - digest = "1:9f45b3f05c749a97b1423b5e7874cd19ae0452db5d107468e2d7d9c805435df0" - name = "github.com/jteeuwen/go-bindata" - packages = ["."] - pruneopts = "T" - revision = "bbd0c6e271208dce66d8fda4bc536453cd27fc4a" - version = "v3.0.7" - [[projects]] digest = "1:0a69a1c0db3591fcefb47f115b224592c8dfa4368b7ba9fae509d5e16cdc95c8" name = "github.com/konsorten/go-windows-terminal-sequences" @@ -976,7 +968,6 @@ "pkg/client/config", "pkg/client/fake", "pkg/controller", - "pkg/controller/controllerutil", "pkg/event", "pkg/handler", "pkg/internal/controller", @@ -1062,7 +1053,6 @@ "github.com/ghodss/yaml", "github.com/golang/glog", "github.com/golang/mock/gomock", - "github.com/jteeuwen/go-bindata", "github.com/onsi/ginkgo", "github.com/onsi/gomega", "github.com/openshift/api/config/v1", @@ -1099,7 +1089,6 @@ "sigs.k8s.io/controller-runtime/pkg/client/config", "sigs.k8s.io/controller-runtime/pkg/client/fake", "sigs.k8s.io/controller-runtime/pkg/controller", - "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil", "sigs.k8s.io/controller-runtime/pkg/event", "sigs.k8s.io/controller-runtime/pkg/handler", "sigs.k8s.io/controller-runtime/pkg/manager", diff --git a/Gopkg.toml b/Gopkg.toml index 6c216d1ed..736385d86 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -1,7 +1,6 @@ required = [ "github.com/aws/aws-sdk-go", "github.com/emicklei/go-restful", - "github.com/jteeuwen/go-bindata", "github.com/onsi/ginkgo", # for test framework "github.com/onsi/gomega", # for test matchers "github.com/stretchr/testify/assert", diff --git a/Makefile b/Makefile index 03d34cbc7..cde0bd700 100644 --- a/Makefile +++ b/Makefile @@ -54,8 +54,6 @@ vet: # Generate code generate: go generate ./pkg/... ./cmd/... - # generate static assets - hack/update-bindata.sh # Build the image with buildah .PHONY: buildah-build diff --git a/hack/update-bindata.sh b/hack/update-bindata.sh deleted file mode 100755 index 761ce068e..000000000 --- a/hack/update-bindata.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -set -e - -SRC_DIR="$(git rev-parse --show-toplevel)" - -OUTPUT_FILE="${OUTPUT_FILE:-./pkg/controller/assets/bindata.go}" - -# ensure go-bindata -cd "${SRC_DIR}" -go build -o ./bin/go-bindata ./vendor/github.com/jteeuwen/go-bindata/go-bindata - -"./bin/go-bindata" \ - -nocompress \ - -pkg "assets" \ - -o "${OUTPUT_FILE}" \ - -ignore "OWNERS" \ - -ignore ".*\.sw.?" \ - ./config/samples/... && \ -gofmt -s -w "${OUTPUT_FILE}" diff --git a/manifests/0000_30_cloud-credential-operator_03_cred-openshift-cluster-api.yaml b/manifests/0000_30_cloud-credential-operator_03_cred-openshift-cluster-api.yaml deleted file mode 100644 index c88da7aee..000000000 --- a/manifests/0000_30_cloud-credential-operator_03_cred-openshift-cluster-api.yaml +++ /dev/null @@ -1,31 +0,0 @@ -apiVersion: cloudcredential.openshift.io/v1beta1 -kind: CredentialsRequest -metadata: - labels: - controller-tools.k8s.io: "1.0" - name: openshift-cluster-api - namespace: openshift-cloud-credential-operator -spec: - secretRef: - name: aws-cloud-credentials - namespace: openshift-cluster-api - providerSpec: - apiVersion: cloudcredential.openshift.io/v1beta1 - kind: AWSProviderSpec - statementEntries: - - effect: Allow - action: - - ec2:DescribeImages - - ec2:DescribeVpcs - - ec2:DescribeSubnets - - ec2:DescribeAvailabilityZones - - ec2:DescribeSecurityGroups - - ec2:RunInstances - - ec2:DescribeInstances - - ec2:TerminateInstances - - elasticloadbalancing:RegisterInstancesWithLoadBalancer - - elasticloadbalancing:DescribeLoadBalancers - - elasticloadbalancing:DescribeTargetGroups - - elasticloadbalancing:RegisterTargets - resource: "*" ---- diff --git a/manifests/0000_30_cloud-credential-operator_03_cred-openshift-image-.txt b/manifests/0000_30_cloud-credential-operator_03_cred-openshift-image-.txt deleted file mode 100644 index 4f6ad8a84..000000000 --- a/manifests/0000_30_cloud-credential-operator_03_cred-openshift-image-.txt +++ /dev/null @@ -1 +0,0 @@ -0000_29_cloud-credential-operator_03_cred-openshift-image-registry \ No newline at end of file diff --git a/manifests/0000_30_cloud-credential-operator_03_cred-openshift-image-registry.yaml b/manifests/0000_30_cloud-credential-operator_03_cred-openshift-image-registry.yaml deleted file mode 100644 index 3b370ff95..000000000 --- a/manifests/0000_30_cloud-credential-operator_03_cred-openshift-image-registry.yaml +++ /dev/null @@ -1,35 +0,0 @@ -apiVersion: cloudcredential.openshift.io/v1beta1 -kind: CredentialsRequest -metadata: - labels: - controller-tools.k8s.io: "1.0" - name: openshift-image-registry - namespace: openshift-cloud-credential-operator -spec: - secretRef: - name: installer-cloud-credentials - namespace: openshift-image-registry - providerSpec: - apiVersion: cloudcredential.openshift.io/v1beta1 - kind: AWSProviderSpec - statementEntries: - - effect: Allow - action: - - s3:CreateBucket - - s3:DeleteBucket - - s3:PutBucketTagging - - s3:GetBucketTagging - - s3:PutEncryptionConfiguration - - s3:GetEncryptionConfiguration - - s3:PutLifecycleConfiguration - - s3:GetLifecycleConfiguration - - s3:GetBucketLocation - - s3:ListBucket - - s3:HeadBucket - - s3:GetObject - - s3:PutObject - - s3:DeleteObject - - s3:ListBucketMultipartUploads - - s3:AbortMultipartUpload - resource: "*" ---- diff --git a/manifests/0000_30_cloud-credential-operator_03_cred-openshift-image.txt b/manifests/0000_30_cloud-credential-operator_03_cred-openshift-image.txt deleted file mode 100644 index 715bbcc97..000000000 --- a/manifests/0000_30_cloud-credential-operator_03_cred-openshift-image.txt +++ /dev/null @@ -1 +0,0 @@ -0000_29_cloud-credential-operator_03_cred-openshift-image- \ No newline at end of file diff --git a/manifests/0000_30_cloud-credential-operator_03_cred-openshift-ingress.yaml b/manifests/0000_30_cloud-credential-operator_03_cred-openshift-ingress.yaml deleted file mode 100644 index 18115b62c..000000000 --- a/manifests/0000_30_cloud-credential-operator_03_cred-openshift-ingress.yaml +++ /dev/null @@ -1,23 +0,0 @@ -apiVersion: cloudcredential.openshift.io/v1beta1 -kind: CredentialsRequest -metadata: - labels: - controller-tools.k8s.io: "1.0" - name: openshift-ingress - namespace: openshift-cloud-credential-operator -spec: - secretRef: - name: cloud-credentials - namespace: openshift-ingress-operator - providerSpec: - apiVersion: cloudcredential.openshift.io/v1beta1 - kind: AWSProviderSpec - statementEntries: - - effect: Allow - action: - - elasticloadbalancing:DescribeLoadBalancers - - route53:ListHostedZones - - route53:ChangeResourceRecordSets - - tag:GetResources - resource: "*" ---- diff --git a/pkg/controller/assets/bindata.go b/pkg/controller/assets/bindata.go deleted file mode 100644 index ff3ed87aa..000000000 --- a/pkg/controller/assets/bindata.go +++ /dev/null @@ -1,106 +0,0 @@ -package assets - -import ( - "fmt" - "strings" -) - -var _config_samples_credminter_v1_credentialsrequest_yaml = []byte(`apiVersion: cloudcredential.openshift.io/v1beta1 -kind: CredentialsRequest -metadata: - labels: - controller-tools.k8s.io: "1.0" - name: openshift-image-registry -spec: - secretRef: - name: installer-cloud-credentials - namespace: myproject2 - providerSpec: - apiVersion: cloudcredential.openshift.io/v1beta1 - kind: AWSProviderSpec - statementEntries: - - effect: Allow - action: - - s3:CreateBucket - - s3:DeleteBucket - resource: "*" ---- - -`) - -func config_samples_credminter_v1_credentialsrequest_yaml() ([]byte, error) { - return _config_samples_credminter_v1_credentialsrequest_yaml, nil -} - -// Asset loads and returns the asset for the given name. -// It returns an error if the asset could not be found or -// could not be loaded. -func Asset(name string) ([]byte, error) { - cannonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[cannonicalName]; ok { - return f() - } - return nil, fmt.Errorf("Asset %s not found", name) -} - -// AssetNames returns the names of the assets. -func AssetNames() []string { - names := make([]string, 0, len(_bindata)) - for name := range _bindata { - names = append(names, name) - } - return names -} - -// _bindata is a table, holding each asset generator, mapped to its name. -var _bindata = map[string]func() ([]byte, error){ - "config/samples/credminter_v1_credentialsrequest.yaml": config_samples_credminter_v1_credentialsrequest_yaml, -} - -// AssetDir returns the file names below a certain -// directory embedded in the file by go-bindata. -// For example if you run go-bindata on data/... and data contains the -// following hierarchy: -// data/ -// foo.txt -// img/ -// a.png -// b.png -// then AssetDir("data") would return []string{"foo.txt", "img"} -// AssetDir("data/img") would return []string{"a.png", "b.png"} -// AssetDir("foo.txt") and AssetDir("notexist") would return an error -// AssetDir("") will return []string{"data"}. -func AssetDir(name string) ([]string, error) { - node := _bintree - if len(name) != 0 { - cannonicalName := strings.Replace(name, "\\", "/", -1) - pathList := strings.Split(cannonicalName, "/") - for _, p := range pathList { - node = node.Children[p] - if node == nil { - return nil, fmt.Errorf("Asset %s not found", name) - } - } - } - if node.Func != nil { - return nil, fmt.Errorf("Asset %s not found", name) - } - rv := make([]string, 0, len(node.Children)) - for name := range node.Children { - rv = append(rv, name) - } - return rv, nil -} - -type _bintree_t struct { - Func func() ([]byte, error) - Children map[string]*_bintree_t -} - -var _bintree = &_bintree_t{nil, map[string]*_bintree_t{ - "config": {nil, map[string]*_bintree_t{ - "samples": {nil, map[string]*_bintree_t{ - "credminter_v1_credentialsrequest.yaml": {config_samples_credminter_v1_credentialsrequest_yaml, map[string]*_bintree_t{}}, - }}, - }}, -}} diff --git a/pkg/controller/utils/utils.go b/pkg/controller/utils/utils.go index 53f293c04..59972edf5 100644 --- a/pkg/controller/utils/utils.go +++ b/pkg/controller/utils/utils.go @@ -7,7 +7,6 @@ import ( ccv1beta1 "github.com/openshift/cloud-credential-operator/pkg/apis/cloudcredential/v1beta1" ccaws "github.com/openshift/cloud-credential-operator/pkg/aws" - "github.com/openshift/cloud-credential-operator/pkg/controller/assets" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/iam" @@ -19,7 +18,7 @@ import ( // credMintingActions is a list of AWS verbs needed to run in the mode where the // cloud-credential-operator can mint new creds to satisfy CredentialRequest CRDs var ( - CredMintingActions = []string{ + credMintingActions = []string{ "iam:CreateAccessKey", "iam:CreateUser", "iam:DeleteAccessKey", @@ -32,6 +31,66 @@ var ( "iam:SimulatePrincipalPolicy", // needed so we can verify the above list of course } + credPassthroughActions = []string{ + // so we can query whether we have the below list of creds + "iam:GetUser", + "iam:SimulatePrincipalPolicy", + + // openshift-ingress + "elasticloadbalancing:DescribeLoadBalancers", + "route53:ListHostedZones", + "route53:ChangeResourceRecordSets", + "tag:GetResources", + + // openshift-image-registry + "s3:CreateBucket", + "s3:DeleteBucket", + "s3:PutBucketTagging", + "s3:GetBucketTagging", + "s3:PutEncryptionConfiguration", + "s3:GetEncryptionConfiguration", + "s3:PutLifecycleConfiguration", + "s3:GetLifecycleConfiguration", + "s3:GetBucketLocation", + "s3:ListBucket", + "s3:HeadBucket", + "s3:GetObject", + "s3:PutObject", + "s3:DeleteObject", + "s3:ListBucketMultipartUploads", + "s3:AbortMultipartUpload", + + // openshift-cluster-api + "ec2:DescribeImages", + "ec2:DescribeVpcs", + "ec2:DescribeSubnets", + "ec2:DescribeAvailabilityZones", + "ec2:DescribeSecurityGroups", + "ec2:RunInstances", + "ec2:DescribeInstances", + "ec2:TerminateInstances", + "elasticloadbalancing:RegisterInstancesWithLoadBalancer", + "elasticloadbalancing:DescribeLoadBalancers", + "elasticloadbalancing:DescribeTargetGroups", + "elasticloadbalancing:RegisterTargets", + "ec2:DescribeVpcs", + "ec2:DescribeSubnets", + "ec2:DescribeAvailabilityZones", + "ec2:DescribeSecurityGroups", + "ec2:RunInstances", + "ec2:DescribeInstances", + "ec2:TerminateInstances", + "elasticloadbalancing:RegisterInstancesWithLoadBalancer", + "elasticloadbalancing:DescribeLoadBalancers", + "elasticloadbalancing:DescribeTargetGroups", + "elasticloadbalancing:RegisterTargets", + + // iam-ro + "iam:GetUser", + "iam:GetUserPolicy", + "iam:ListAccessKeys", + } + credentailRequestScheme = runtime.NewScheme() credentialRequestCodec = serializer.NewCodecFactory(credentailRequestScheme) ) @@ -44,7 +103,7 @@ func init() { // CheckCloudCredCreation will see whether we have enough permissions to create new sub-creds func CheckCloudCredCreation(awsClient ccaws.Client, logger log.FieldLogger) (bool, error) { - return CheckPermissionsAgainstActions(awsClient, CredMintingActions, logger) + return CheckPermissionsAgainstActions(awsClient, credMintingActions, logger) } // CheckPermissionsUsingQueryClient will use queryClient to query whether the credentials in targetClient can perform the actions @@ -112,28 +171,11 @@ func CheckPermissionsAgainstActions(awsClient ccaws.Client, actionList []string, } // CheckCloudCredPassthrough will see if the provided creds are good enough to pass through -// to other components as-is based on the generated list of permissions needed from the static -// manifests in the repo +// to other components as-is based on the static list of permissions needed by the various +// users of CredentialsRequests +// TODO: move away from static list (to dynamic passthrough validation?) func CheckCloudCredPassthrough(awsClient ccaws.Client, logger log.FieldLogger) (bool, error) { - statementList := []ccv1beta1.StatementEntry{} - - // Read in the static assets containing all the needed CredentialRequests/permissions - assetList := assets.AssetNames() - for _, oneAsset := range assetList { - crBytes, err := assets.Asset(oneAsset) - if err != nil { - return false, fmt.Errorf("error parsing CredentialRequest object: %v", err) - } - - statements, err := getCredentialRequestStatements(crBytes) - if err != nil { - return false, fmt.Errorf("error processing CredentialRequest: %v", err) - } - - statementList = append(statementList, statements...) - } - - return CheckPermissionsAgainstStatementList(awsClient, statementList, logger) + return CheckPermissionsAgainstActions(awsClient, credPassthroughActions, logger) } func readCredentialRequest(cr []byte) (*ccv1beta1.CredentialsRequest, error) { diff --git a/vendor/github.com/jteeuwen/go-bindata/CONTRIBUTING.md b/vendor/github.com/jteeuwen/go-bindata/CONTRIBUTING.md deleted file mode 100644 index e0732f54e..000000000 --- a/vendor/github.com/jteeuwen/go-bindata/CONTRIBUTING.md +++ /dev/null @@ -1,79 +0,0 @@ -## Contribution guidelines. - -So you wish to contribute to this project? Fantastic! -Here are a few guidelines to help you do this in a -streamlined fashion. - - -## Bug reports - -When supplying a bug report, please consider the following guidelines. -These serve to make it easier for us to address the issue and find a solution. -Most of these are pretty self-evident, but sometimes it is still necessary -to reiterate them. - -* Be clear in the way you express the problem. Use simple language and - just enough of it to clearly define the issue. Not everyone is a native - English speaker. And while most can handle themselves pretty well, - it helps to stay away from more esoteric vocabulary. - - Be patient with non-native English speakers. If their bug reports - or comments are hard to understand, just ask for clarification. - Do not start guessing at their meaning, as this may just lead to - more confusion and misunderstandings. -* Clearly define any information which is relevant to the problem. - This includes library versions, operating system and any other - external dependencies which may be needed. -* Where applicable, provide a step-by-step listing of the way to - reproduce the problem. Make sure this is the simplest possible - way to do so. Omit any and all unneccesary steps, because they may - just complicate our understanding of the real problem. - If need be, create a whole new code project on your local machine, - which specifically tries to create the problem you are running into; - nothing more, nothing less. - - Include this program in the bug report. It often suffices to paste - the code in a [Gist](https://gist.github.com) or on the - [Go playground](http://play.golang.org). -* If possible, provide us with a listing of the steps you have already - undertaken to solve the problem. This can save us a great deal of - wasted time, trying out solutions you have already covered. - - -## Pull requests - -Bug reports are great. Supplying fixes to bugs is even better. -When submitting a pull request, the following guidelines are -good to keep in mind: - -* `go fmt`: **Always** run your code through `go fmt`, before - committing it. Code has to be readable by many different - people. And the only way this will be as painless as possible, - is if we all stick to the same code style. - - Some of our projects may have automated build-servers hooked up - to commit hooks. These will vet any submitted code and determine - if it meets a set of properties. One of which is code formatting. - These servers will outright deny a submission which has not been - run through `go fmt`, even if the code itself is correct. - - We try to maintain a zero-tolerance policy on this matter, - because consistently formatted code makes life a great deal - easier for everyone involved. -* Commit log messages: When committing changes, do so often and - clearly -- Even if you have changed only 1 character in a code - comment. This means that commit log messages should clearly state - exactly what the change does and why. If it fixes a known issue, - then mention the issue number in the commit log. E.g.: - - > Fixes return value for `foo/boo.Baz()` to be consistent with - > the rest of the API. This addresses issue #32 - - Do not pile a lot of unrelated changes into a single commit. - Pick and choose only those changes for a single commit, which are - directly related. We would much rather see a hundred commits - saying nothing but `"Runs go fmt"` in between any real fixes - than have these style changes embedded in those real fixes. - It creates a lot of noise when trying to review code. - - diff --git a/vendor/github.com/jteeuwen/go-bindata/LICENSE b/vendor/github.com/jteeuwen/go-bindata/LICENSE deleted file mode 100644 index c07a9311f..000000000 --- a/vendor/github.com/jteeuwen/go-bindata/LICENSE +++ /dev/null @@ -1,3 +0,0 @@ -This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication -license. Its contents can be found at: -http://creativecommons.org/publicdomain/zero/1.0 diff --git a/vendor/github.com/jteeuwen/go-bindata/README.md b/vendor/github.com/jteeuwen/go-bindata/README.md deleted file mode 100644 index 903e02314..000000000 --- a/vendor/github.com/jteeuwen/go-bindata/README.md +++ /dev/null @@ -1,189 +0,0 @@ -## bindata - -This package converts any file into managable Go source code. Useful for -embedding binary data into a go program. The file data is optionally gzip -compressed before being converted to a raw byte slice. - -It comes with a command line tool in the `go-bindata` sub directory. -This tool offers a set of command line options, used to customize the -output being generated. - - -### Installation - -To install the library and command line program, use the following: - - go get github.com/jteeuwen/go-bindata/... - - -### Usage - -Conversion is done on one or more sets of files. They are all embedded in a new -Go source file, along with a table of contents and an `Asset` function, -which allows quick access to the asset, based on its name. - -The simplest invocation generates a `bindata.go` file in the current -working directory. It includes all assets from the `data` directory. - - $ go-bindata data/ - -To include all input sub-directories recursively, use the elipsis postfix -as defined for Go import paths. Otherwise it will only consider assets in the -input directory itself. - - $ go-bindata data/... - -To specify the name of the output file being generated, we use the following: - - $ go-bindata -o myfile.go data/ - -Multiple input directories can be specified if necessary. - - $ go-bindata dir1/... /path/to/dir2/... dir3 - - -The following paragraphs detail some of the command line options which can be -supplied to `go-bindata`. Refer to the `testdata/out` directory for various -output examples from the assets in `testdata/in`. Each example uses different -command line options. - -To ignore files, pass in regexes using -ignore, for example: - - $ go-bindata -ignore=\\.gitignore data/... - -### Accessing an asset - -To access asset data, we use the `Asset(string) ([]byte, error)` function which -is included in the generated output. - - data, err := Asset("pub/style/foo.css") - if err != nil { - // Asset was not found. - } - - // use asset data - - -### Debug vs Release builds - -When invoking the program with the `-debug` flag, the generated code does -not actually include the asset data. Instead, it generates function stubs -which load the data from the original file on disk. The asset API remains -identical between debug and release builds, so your code will not have to -change. - -This is useful during development when you expect the assets to change often. -The host application using these assets uses the same API in both cases and -will not have to care where the actual data comes from. - -An example is a Go webserver with some embedded, static web content like -HTML, JS and CSS files. While developing it, you do not want to rebuild the -whole server and restart it every time you make a change to a bit of -javascript. You just want to build and launch the server once. Then just press -refresh in the browser to see those changes. Embedding the assets with the -`debug` flag allows you to do just that. When you are finished developing and -ready for deployment, just re-invoke `go-bindata` without the `-debug` flag. -It will now embed the latest version of the assets. - - -### Lower memory footprint - -Using the `-nomemcopy` flag, will alter the way the output file is generated. -It will employ a hack that allows us to read the file data directly from -the compiled program's `.rodata` section. This ensures that when we call -call our generated function, we omit unnecessary memcopies. - -The downside of this, is that it requires dependencies on the `reflect` and -`unsafe` packages. These may be restricted on platforms like AppEngine and -thus prevent you from using this mode. - -Another disadvantage is that the byte slice we create, is strictly read-only. -For most use-cases this is not a problem, but if you ever try to alter the -returned byte slice, a runtime panic is thrown. Use this mode only on target -platforms where memory constraints are an issue. - -The default behaviour is to use the old code generation method. This -prevents the two previously mentioned issues, but will employ at least one -extra memcopy and thus increase memory requirements. - -For instance, consider the following two examples: - -This would be the default mode, using an extra memcopy but gives a safe -implementation without dependencies on `reflect` and `unsafe`: - -```go -func myfile() []byte { - return []byte{0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a} -} -``` - -Here is the same functionality, but uses the `.rodata` hack. -The byte slice returned from this example can not be written to without -generating a runtime error. - -```go -var _myfile = "\x89\x50\x4e\x47\x0d\x0a\x1a" - -func myfile() []byte { - var empty [0]byte - sx := (*reflect.StringHeader)(unsafe.Pointer(&_myfile)) - b := empty[:] - bx := (*reflect.SliceHeader)(unsafe.Pointer(&b)) - bx.Data = sx.Data - bx.Len = len(_myfile) - bx.Cap = bx.Len - return b -} -``` - - -### Optional compression - -When the `-nocompress` flag is given, the supplied resource is *not* GZIP -compressed before being turned into Go code. The data should still be accessed -through a function call, so nothing changes in the usage of the generated file. - -This feature is useful if you do not care for compression, or the supplied -resource is already compressed. Doing it again would not add any value and may -even increase the size of the data. - -The default behaviour of the program is to use compression. - - -### Path prefix stripping - -The keys used in the `_bindata` map, are the same as the input file name -passed to `go-bindata`. This includes the path. In most cases, this is not -desireable, as it puts potentially sensitive information in your code base. -For this purpose, the tool supplies another command line flag `-prefix`. -This accepts a portion of a path name, which should be stripped off from -the map keys and function names. - -For example, running without the `-prefix` flag, we get: - - $ go-bindata /path/to/templates/ - - _bindata["/path/to/templates/foo.html"] = path_to_templates_foo_html - -Running with the `-prefix` flag, we get: - - $ go-bindata -prefix "/path/to/" /path/to/templates/ - - _bindata["templates/foo.html"] = templates_foo_html - - -### Build tags - -With the optional `-tags` flag, you can specify any go build tags that -must be fulfilled for the output file to be included in a build. This -is useful when including binary data in multiple formats, where the desired -format is specified at build time with the appropriate tags. - -The tags are appended to a `// +build` line in the beginning of the output file -and must follow the build tags syntax specified by the go tool. - -### Related projects - -[go-bindata-assetfs](https://github.com/elazarl/go-bindata-assetfs#readme) - -implements `http.FileSystem` interface. Allows you to serve assets with `net/http`. - diff --git a/vendor/github.com/jteeuwen/go-bindata/asset.go b/vendor/github.com/jteeuwen/go-bindata/asset.go deleted file mode 100644 index 51771a88e..000000000 --- a/vendor/github.com/jteeuwen/go-bindata/asset.go +++ /dev/null @@ -1,19 +0,0 @@ -// This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication -// license. Its contents can be found at: -// http://creativecommons.org/publicdomain/zero/1.0/ - -package bindata - -// Asset holds information about a single asset to be processed. -type Asset struct { - Path string // Full file path. - Name string // Key used in TOC -- name by which asset is referenced. - Func string // Function name for the procedure returning the asset contents. -} - -// Implement sort.Interface for []Asset based on Path field -type ByPath []Asset - -func (v ByPath) Len() int { return len(v) } -func (v ByPath) Swap(i, j int) { v[i], v[j] = v[j], v[i] } -func (v ByPath) Less(i, j int) bool { return v[i].Path < v[j].Path } diff --git a/vendor/github.com/jteeuwen/go-bindata/bytewriter.go b/vendor/github.com/jteeuwen/go-bindata/bytewriter.go deleted file mode 100644 index 05d6d6780..000000000 --- a/vendor/github.com/jteeuwen/go-bindata/bytewriter.go +++ /dev/null @@ -1,44 +0,0 @@ -// This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication -// license. Its contents can be found at: -// http://creativecommons.org/publicdomain/zero/1.0/ - -package bindata - -import ( - "fmt" - "io" -) - -var ( - newline = []byte{'\n'} - dataindent = []byte{'\t', '\t'} - space = []byte{' '} -) - -type ByteWriter struct { - io.Writer - c int -} - -func (w *ByteWriter) Write(p []byte) (n int, err error) { - if len(p) == 0 { - return - } - - for n = range p { - if w.c%12 == 0 { - w.Writer.Write(newline) - w.Writer.Write(dataindent) - w.c = 0 - } else { - w.Writer.Write(space) - } - - fmt.Fprintf(w.Writer, "0x%02x,", p[n]) - w.c++ - } - - n++ - - return -} diff --git a/vendor/github.com/jteeuwen/go-bindata/config.go b/vendor/github.com/jteeuwen/go-bindata/config.go deleted file mode 100644 index 2b05389f5..000000000 --- a/vendor/github.com/jteeuwen/go-bindata/config.go +++ /dev/null @@ -1,192 +0,0 @@ -// This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication -// license. Its contents can be found at: -// http://creativecommons.org/publicdomain/zero/1.0/ - -package bindata - -import ( - "fmt" - "os" - "path/filepath" - "regexp" -) - -// InputConfig defines options on a asset directory to be convert. -type InputConfig struct { - // Path defines a directory containing asset files to be included - // in the generated output. - Path string - - // Recusive defines whether subdirectories of Path - // should be recursively included in the conversion. - Recursive bool -} - -// Config defines a set of options for the asset conversion. -type Config struct { - // Name of the package to use. Defaults to 'main'. - Package string - - // Tags specify a set of optional build tags, which should be - // included in the generated output. The tags are appended to a - // `// +build` line in the beginning of the output file - // and must follow the build tags syntax specified by the go tool. - Tags string - - // Input defines the directory path, containing all asset files as - // well as whether to recursively process assets in any sub directories. - Input []InputConfig - - // Output defines the output file for the generated code. - // If left empty, this defaults to 'bindata.go' in the current - // working directory. - Output string - - // Prefix defines a path prefix which should be stripped from all - // file names when generating the keys in the table of contents. - // For example, running without the `-prefix` flag, we get: - // - // $ go-bindata /path/to/templates - // go_bindata["/path/to/templates/foo.html"] = _path_to_templates_foo_html - // - // Running with the `-prefix` flag, we get: - // - // $ go-bindata -prefix "/path/to/" /path/to/templates/foo.html - // go_bindata["templates/foo.html"] = templates_foo_html - Prefix string - - // NoMemCopy will alter the way the output file is generated. - // - // It will employ a hack that allows us to read the file data directly from - // the compiled program's `.rodata` section. This ensures that when we call - // call our generated function, we omit unnecessary mem copies. - // - // The downside of this, is that it requires dependencies on the `reflect` and - // `unsafe` packages. These may be restricted on platforms like AppEngine and - // thus prevent you from using this mode. - // - // Another disadvantage is that the byte slice we create, is strictly read-only. - // For most use-cases this is not a problem, but if you ever try to alter the - // returned byte slice, a runtime panic is thrown. Use this mode only on target - // platforms where memory constraints are an issue. - // - // The default behaviour is to use the old code generation method. This - // prevents the two previously mentioned issues, but will employ at least one - // extra memcopy and thus increase memory requirements. - // - // For instance, consider the following two examples: - // - // This would be the default mode, using an extra memcopy but gives a safe - // implementation without dependencies on `reflect` and `unsafe`: - // - // func myfile() []byte { - // return []byte{0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a} - // } - // - // Here is the same functionality, but uses the `.rodata` hack. - // The byte slice returned from this example can not be written to without - // generating a runtime error. - // - // var _myfile = "\x89\x50\x4e\x47\x0d\x0a\x1a" - // - // func myfile() []byte { - // var empty [0]byte - // sx := (*reflect.StringHeader)(unsafe.Pointer(&_myfile)) - // b := empty[:] - // bx := (*reflect.SliceHeader)(unsafe.Pointer(&b)) - // bx.Data = sx.Data - // bx.Len = len(_myfile) - // bx.Cap = bx.Len - // return b - // } - NoMemCopy bool - - // NoCompress means the assets are /not/ GZIP compressed before being turned - // into Go code. The generated function will automatically unzip - // the file data when called. Defaults to false. - NoCompress bool - - // Perform a debug build. This generates an asset file, which - // loads the asset contents directly from disk at their original - // location, instead of embedding the contents in the code. - // - // This is mostly useful if you anticipate that the assets are - // going to change during your development cycle. You will always - // want your code to access the latest version of the asset. - // Only in release mode, will the assets actually be embedded - // in the code. The default behaviour is Release mode. - Debug bool - - // Recursively process all assets in the input directory and its - // sub directories. This defaults to false, so only files in the - // input directory itself are read. - Recursive bool - - // Ignores any filenames matching the regex pattern specified, e.g. - // path/to/file.ext will ignore only that file, or \\.gitignore - // will match any .gitignore file. - // - // This parameter can be provided multiple times. - Ignore []*regexp.Regexp -} - -// NewConfig returns a default configuration struct. -func NewConfig() *Config { - c := new(Config) - c.Package = "main" - c.NoMemCopy = false - c.NoCompress = false - c.Debug = false - c.Recursive = false - c.Output = "./bindata.go" - c.Ignore = make([]*regexp.Regexp, 0) - return c -} - -// validate ensures the config has sane values. -// Part of which means checking if certain file/directory paths exist. -func (c *Config) validate() error { - if len(c.Package) == 0 { - return fmt.Errorf("Missing package name") - } - - for _, input := range c.Input { - _, err := os.Lstat(input.Path) - if err != nil { - return fmt.Errorf("Failed to stat input path '%s': %v", input.Path, err) - } - } - - if len(c.Output) == 0 { - cwd, err := os.Getwd() - if err != nil { - return fmt.Errorf("Unable to determine current working directory.") - } - - c.Output = filepath.Join(cwd, "bindata.go") - } - - stat, err := os.Lstat(c.Output) - if err != nil { - if !os.IsNotExist(err) { - return fmt.Errorf("Output path: %v", err) - } - - // File does not exist. This is fine, just make - // sure the directory it is to be in exists. - dir, _ := filepath.Split(c.Output) - if dir != "" { - err = os.MkdirAll(dir, 0744) - - if err != nil { - return fmt.Errorf("Create output directory: %v", err) - } - } - } - - if stat != nil && stat.IsDir() { - return fmt.Errorf("Output path is a directory.") - } - - return nil -} diff --git a/vendor/github.com/jteeuwen/go-bindata/convert.go b/vendor/github.com/jteeuwen/go-bindata/convert.go deleted file mode 100644 index 335ca624b..000000000 --- a/vendor/github.com/jteeuwen/go-bindata/convert.go +++ /dev/null @@ -1,200 +0,0 @@ -// This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication -// license. Its contents can be found at: -// http://creativecommons.org/publicdomain/zero/1.0/ - -package bindata - -import ( - "bufio" - "fmt" - "os" - "path/filepath" - "regexp" - "sort" - "strings" - "unicode" -) - -// Translate reads assets from an input directory, converts them -// to Go code and writes new files to the output specified -// in the given configuration. -func Translate(c *Config) error { - var toc []Asset - - // Ensure our configuration has sane values. - err := c.validate() - if err != nil { - return err - } - - // Locate all the assets. - for _, input := range c.Input { - err = findFiles(input.Path, c.Prefix, input.Recursive, &toc, c.Ignore) - if err != nil { - return err - } - } - - // Sort to make output stable between invocations - sort.Sort(ByPath(toc)) - - // Create output file. - fd, err := os.Create(c.Output) - if err != nil { - return err - } - - defer fd.Close() - - // Create a buffered writer for better performance. - bfd := bufio.NewWriter(fd) - defer bfd.Flush() - - // Write build tags, if applicable. - if len(c.Tags) > 0 { - _, err = fmt.Fprintf(bfd, "// +build %s\n\n", c.Tags) - if err != nil { - return err - } - } - - // Write package declaration. - _, err = fmt.Fprintf(bfd, "package %s\n\n", c.Package) - if err != nil { - return err - } - - // Write assets. - if c.Debug { - err = writeDebug(bfd, toc) - } else { - err = writeRelease(bfd, c, toc) - } - - if err != nil { - return err - } - - // Write table of contents - if err := writeTOC(bfd, toc); err != nil { - return err - } - // Write hierarchical tree of assets - return writeTOCTree(bfd, toc) -} - -// findFiles recursively finds all the file paths in the given directory tree. -// They are added to the given map as keys. Values will be safe function names -// for each file, which will be used when generating the output code. -func findFiles(dir, prefix string, recursive bool, toc *[]Asset, ignore []*regexp.Regexp) error { - if len(prefix) > 0 { - dir, _ = filepath.Abs(dir) - prefix, _ = filepath.Abs(prefix) - prefix = filepath.ToSlash(prefix) - } - - fi, err := os.Stat(dir) - if err != nil { - return err - } - - var list []os.FileInfo - - if !fi.IsDir() { - dir = "" - list = []os.FileInfo{fi} - } else { - fd, err := os.Open(dir) - if err != nil { - return err - } - - defer fd.Close() - - list, err = fd.Readdir(0) - if err != nil { - return err - } - } - - knownFuncs := make(map[string]int) - - for _, file := range list { - var asset Asset - asset.Path = filepath.Join(dir, file.Name()) - asset.Name = filepath.ToSlash(asset.Path) - - ignoring := false - for _, re := range ignore { - if re.MatchString(asset.Path) { - ignoring = true - break - } - } - if ignoring { - continue - } - - if file.IsDir() { - if recursive { - findFiles(asset.Path, prefix, recursive, toc, ignore) - } - continue - } - - if strings.HasPrefix(asset.Name, prefix) { - asset.Name = asset.Name[len(prefix):] - } - - // If we have a leading slash, get rid of it. - if len(asset.Name) > 0 && asset.Name[0] == '/' { - asset.Name = asset.Name[1:] - } - - // This shouldn't happen. - if len(asset.Name) == 0 { - return fmt.Errorf("Invalid file: %v", asset.Path) - } - - asset.Func = safeFunctionName(asset.Name, knownFuncs) - asset.Path, _ = filepath.Abs(asset.Path) - *toc = append(*toc, asset) - } - - return nil -} - -var regFuncName = regexp.MustCompile(`[^a-zA-Z0-9_]`) - -// safeFunctionName converts the given name into a name -// which qualifies as a valid function identifier. It -// also compares against a known list of functions to -// prevent conflict based on name translation. -func safeFunctionName(name string, knownFuncs map[string]int) string { - name = strings.ToLower(name) - name = regFuncName.ReplaceAllString(name, "_") - - // Get rid of "__" instances for niceness. - for strings.Index(name, "__") > -1 { - name = strings.Replace(name, "__", "_", -1) - } - - // Leading underscores are silly (unless they prefix a digit (see below)). - for len(name) > 1 && name[0] == '_' { - name = name[1:] - } - - // Identifier can't start with a digit. - if unicode.IsDigit(rune(name[0])) { - name = "_" + name - } - - if num, ok := knownFuncs[name]; ok { - knownFuncs[name] = num + 1 - name = fmt.Sprintf("%s%d", name, num) - } else { - knownFuncs[name] = 2 - } - - return name -} diff --git a/vendor/github.com/jteeuwen/go-bindata/debug.go b/vendor/github.com/jteeuwen/go-bindata/debug.go deleted file mode 100644 index 5e69469d7..000000000 --- a/vendor/github.com/jteeuwen/go-bindata/debug.go +++ /dev/null @@ -1,65 +0,0 @@ -// This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication -// license. Its contents can be found at: -// http://creativecommons.org/publicdomain/zero/1.0/ - -package bindata - -import ( - "fmt" - "io" -) - -// writeDebug writes the debug code file. -func writeDebug(w io.Writer, toc []Asset) error { - err := writeDebugHeader(w) - if err != nil { - return err - } - - for i := range toc { - err = writeDebugAsset(w, &toc[i]) - if err != nil { - return err - } - } - - return nil -} - -// writeDebugHeader writes output file headers. -// This targets debug builds. -func writeDebugHeader(w io.Writer) error { - _, err := fmt.Fprintf(w, `import ( - "fmt" - "io/ioutil" - "strings" -) - -// bindata_read reads the given file from disk. It returns an error on failure. -func bindata_read(path, name string) ([]byte, error) { - buf, err := ioutil.ReadFile(path) - if err != nil { - err = fmt.Errorf("Error reading asset %%s at %%s: %%v", name, path, err) - } - return buf, err -} - -`) - return err -} - -// writeDebugAsset write a debug entry for the given asset. -// A debug entry is simply a function which reads the asset from -// the original file (e.g.: from disk). -func writeDebugAsset(w io.Writer, asset *Asset) error { - _, err := fmt.Fprintf(w, `// %s reads file data from disk. It returns an error on failure. -func %s() ([]byte, error) { - return bindata_read( - %q, - %q, - ) -} - -`, asset.Func, asset.Func, asset.Path, asset.Name) - return err -} diff --git a/vendor/github.com/jteeuwen/go-bindata/doc.go b/vendor/github.com/jteeuwen/go-bindata/doc.go deleted file mode 100644 index 09ead1e3b..000000000 --- a/vendor/github.com/jteeuwen/go-bindata/doc.go +++ /dev/null @@ -1,129 +0,0 @@ -// This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication -// license. Its contents can be found at: -// http://creativecommons.org/publicdomain/zero/1.0/ - -/* -bindata converts any file into managable Go source code. Useful for -embedding binary data into a go program. The file data is optionally gzip -compressed before being converted to a raw byte slice. - -The following paragraphs cover some of the customization options -which can be specified in the Config struct, which must be passed into -the Translate() call. - - -Debug vs Release builds - -When used with the `Debug` option, the generated code does not actually include -the asset data. Instead, it generates function stubs which load the data from -the original file on disk. The asset API remains identical between debug and -release builds, so your code will not have to change. - -This is useful during development when you expect the assets to change often. -The host application using these assets uses the same API in both cases and -will not have to care where the actual data comes from. - -An example is a Go webserver with some embedded, static web content like -HTML, JS and CSS files. While developing it, you do not want to rebuild the -whole server and restart it every time you make a change to a bit of -javascript. You just want to build and launch the server once. Then just press -refresh in the browser to see those changes. Embedding the assets with the -`debug` flag allows you to do just that. When you are finished developing and -ready for deployment, just re-invoke `go-bindata` without the `-debug` flag. -It will now embed the latest version of the assets. - - -Lower memory footprint - -The `NoMemCopy` option will alter the way the output file is generated. -It will employ a hack that allows us to read the file data directly from -the compiled program's `.rodata` section. This ensures that when we call -call our generated function, we omit unnecessary memcopies. - -The downside of this, is that it requires dependencies on the `reflect` and -`unsafe` packages. These may be restricted on platforms like AppEngine and -thus prevent you from using this mode. - -Another disadvantage is that the byte slice we create, is strictly read-only. -For most use-cases this is not a problem, but if you ever try to alter the -returned byte slice, a runtime panic is thrown. Use this mode only on target -platforms where memory constraints are an issue. - -The default behaviour is to use the old code generation method. This -prevents the two previously mentioned issues, but will employ at least one -extra memcopy and thus increase memory requirements. - -For instance, consider the following two examples: - -This would be the default mode, using an extra memcopy but gives a safe -implementation without dependencies on `reflect` and `unsafe`: - - func myfile() []byte { - return []byte{0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a} - } - -Here is the same functionality, but uses the `.rodata` hack. -The byte slice returned from this example can not be written to without -generating a runtime error. - - var _myfile = "\x89\x50\x4e\x47\x0d\x0a\x1a" - - func myfile() []byte { - var empty [0]byte - sx := (*reflect.StringHeader)(unsafe.Pointer(&_myfile)) - b := empty[:] - bx := (*reflect.SliceHeader)(unsafe.Pointer(&b)) - bx.Data = sx.Data - bx.Len = len(_myfile) - bx.Cap = bx.Len - return b - } - - -Optional compression - -The NoCompress option indicates that the supplied assets are *not* GZIP -compressed before being turned into Go code. The data should still be accessed -through a function call, so nothing changes in the API. - -This feature is useful if you do not care for compression, or the supplied -resource is already compressed. Doing it again would not add any value and may -even increase the size of the data. - -The default behaviour of the program is to use compression. - - -Path prefix stripping - -The keys used in the `_bindata` map are the same as the input file name -passed to `go-bindata`. This includes the path. In most cases, this is not -desireable, as it puts potentially sensitive information in your code base. -For this purpose, the tool supplies another command line flag `-prefix`. -This accepts a portion of a path name, which should be stripped off from -the map keys and function names. - -For example, running without the `-prefix` flag, we get: - - $ go-bindata /path/to/templates/ - - _bindata["/path/to/templates/foo.html"] = path_to_templates_foo_html - -Running with the `-prefix` flag, we get: - - $ go-bindata -prefix "/path/to/" /path/to/templates/ - - _bindata["templates/foo.html"] = templates_foo_html - - -Build tags - -With the optional Tags field, you can specify any go build tags that -must be fulfilled for the output file to be included in a build. This -is useful when including binary data in multiple formats, where the desired -format is specified at build time with the appropriate tags. - -The tags are appended to a `// +build` line in the beginning of the output file -and must follow the build tags syntax specified by the go tool. - -*/ -package bindata diff --git a/vendor/github.com/jteeuwen/go-bindata/go-bindata/AppendSliceValue.go b/vendor/github.com/jteeuwen/go-bindata/go-bindata/AppendSliceValue.go deleted file mode 100644 index f5da49596..000000000 --- a/vendor/github.com/jteeuwen/go-bindata/go-bindata/AppendSliceValue.go +++ /dev/null @@ -1,22 +0,0 @@ -package main - -import "strings" - -// borrowed from https://github.com/hashicorp/serf/blob/master/command/agent/flag_slice_value.go - -// AppendSliceValue implements the flag.Value interface and allows multiple -// calls to the same variable to append a list. -type AppendSliceValue []string - -func (s *AppendSliceValue) String() string { - return strings.Join(*s, ",") -} - -func (s *AppendSliceValue) Set(value string) error { - if *s == nil { - *s = make([]string, 0, 1) - } - - *s = append(*s, value) - return nil -} diff --git a/vendor/github.com/jteeuwen/go-bindata/go-bindata/main.go b/vendor/github.com/jteeuwen/go-bindata/go-bindata/main.go deleted file mode 100644 index 2b93d3372..000000000 --- a/vendor/github.com/jteeuwen/go-bindata/go-bindata/main.go +++ /dev/null @@ -1,102 +0,0 @@ -// This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication -// license. Its contents can be found at: -// http://creativecommons.org/publicdomain/zero/1.0/ - -package main - -import ( - "flag" - "fmt" - "github.com/jteeuwen/go-bindata" - "os" - "path/filepath" - "regexp" - "strings" -) - -func main() { - cfg := parseArgs() - err := bindata.Translate(cfg) - - if err != nil { - fmt.Fprintf(os.Stderr, "bindata: %v\n", err) - os.Exit(1) - } -} - -// parseArgs create s a new, filled configuration instance -// by reading and parsing command line options. -// -// This function exits the program with an error, if -// any of the command line options are incorrect. -func parseArgs() *bindata.Config { - var version bool - - c := bindata.NewConfig() - - flag.Usage = func() { - fmt.Printf("Usage: %s [options] \n\n", os.Args[0]) - flag.PrintDefaults() - } - - flag.BoolVar(&c.Debug, "debug", c.Debug, "Do not embed the assets, but provide the embedding API. Contents will still be loaded from disk.") - flag.StringVar(&c.Tags, "tags", c.Tags, "Optional set of build tags to include.") - flag.StringVar(&c.Prefix, "prefix", c.Prefix, "Optional path prefix to strip off asset names.") - flag.StringVar(&c.Package, "pkg", c.Package, "Package name to use in the generated code.") - flag.BoolVar(&c.NoMemCopy, "nomemcopy", c.NoMemCopy, "Use a .rodata hack to get rid of unnecessary memcopies. Refer to the documentation to see what implications this carries.") - flag.BoolVar(&c.NoCompress, "nocompress", c.NoCompress, "Assets will *not* be GZIP compressed when this flag is specified.") - flag.StringVar(&c.Output, "o", c.Output, "Optional name of the output file to be generated.") - flag.BoolVar(&version, "version", false, "Displays version information.") - - ignore := make([]string, 0) - flag.Var((*AppendSliceValue)(&ignore), "ignore", "Regex pattern to ignore") - - flag.Parse() - - patterns := make([]*regexp.Regexp, 0) - for _, pattern := range ignore { - patterns = append(patterns, regexp.MustCompile(pattern)) - } - c.Ignore = patterns - - if version { - fmt.Printf("%s\n", Version()) - os.Exit(0) - } - - // Make sure we have input paths. - if flag.NArg() == 0 { - fmt.Fprintf(os.Stderr, "Missing \n\n") - flag.Usage() - os.Exit(1) - } - - // Create input configurations. - c.Input = make([]bindata.InputConfig, flag.NArg()) - for i := range c.Input { - c.Input[i] = parseInput(flag.Arg(i)) - } - - return c -} - -// parseRecursive determines whether the given path has a recrusive indicator and -// returns a new path with the recursive indicator chopped off if it does. -// -// ex: -// /path/to/foo/... -> (/path/to/foo, true) -// /path/to/bar -> (/path/to/bar, false) -func parseInput(path string) bindata.InputConfig { - if strings.HasSuffix(path, "/...") { - return bindata.InputConfig{ - Path: filepath.Clean(path[:len(path)-4]), - Recursive: true, - } - } else { - return bindata.InputConfig{ - Path: filepath.Clean(path), - Recursive: false, - } - } - -} diff --git a/vendor/github.com/jteeuwen/go-bindata/go-bindata/version.go b/vendor/github.com/jteeuwen/go-bindata/go-bindata/version.go deleted file mode 100644 index a12508ede..000000000 --- a/vendor/github.com/jteeuwen/go-bindata/go-bindata/version.go +++ /dev/null @@ -1,31 +0,0 @@ -// This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication -// license. Its contents can be found at: -// http://creativecommons.org/publicdomain/zero/1.0/ - -package main - -import ( - "fmt" - "runtime" -) - -const ( - AppName = "go-bindata" - AppVersionMajor = 3 - AppVersionMinor = 1 -) - -// revision part of the program version. -// This will be set automatically at build time like so: -// -// go build -ldflags "-X main.AppVersionRev `date -u +%s`" -var AppVersionRev string - -func Version() string { - if len(AppVersionRev) == 0 { - AppVersionRev = "0" - } - - return fmt.Sprintf("%s %d.%d.%s (Go runtime %s).\nCopyright (c) 2010-2013, Jim Teeuwen.", - AppName, AppVersionMajor, AppVersionMinor, AppVersionRev, runtime.Version()) -} diff --git a/vendor/github.com/jteeuwen/go-bindata/release.go b/vendor/github.com/jteeuwen/go-bindata/release.go deleted file mode 100644 index 527d92806..000000000 --- a/vendor/github.com/jteeuwen/go-bindata/release.go +++ /dev/null @@ -1,295 +0,0 @@ -// This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication -// license. Its contents can be found at: -// http://creativecommons.org/publicdomain/zero/1.0/ - -package bindata - -import ( - "bytes" - "compress/gzip" - "fmt" - "io" - "io/ioutil" - "os" - "unicode/utf8" -) - -// writeRelease writes the release code file. -func writeRelease(w io.Writer, c *Config, toc []Asset) error { - err := writeReleaseHeader(w, c) - if err != nil { - return err - } - - for i := range toc { - err = writeReleaseAsset(w, c, &toc[i]) - if err != nil { - return err - } - } - - return nil -} - -// writeReleaseHeader writes output file headers. -// This targets release builds. -func writeReleaseHeader(w io.Writer, c *Config) error { - if c.NoCompress { - if c.NoMemCopy { - return header_uncompressed_nomemcopy(w) - } else { - return header_uncompressed_memcopy(w) - } - } else { - if c.NoMemCopy { - return header_compressed_nomemcopy(w) - } else { - return header_compressed_memcopy(w) - } - } -} - -// writeReleaseAsset write a release entry for the given asset. -// A release entry is a function which embeds and returns -// the file's byte content. -func writeReleaseAsset(w io.Writer, c *Config, asset *Asset) error { - fd, err := os.Open(asset.Path) - if err != nil { - return err - } - - defer fd.Close() - - if c.NoCompress { - if c.NoMemCopy { - return uncompressed_nomemcopy(w, asset, fd) - } else { - return uncompressed_memcopy(w, asset, fd) - } - } else { - if c.NoMemCopy { - return compressed_nomemcopy(w, asset, fd) - } else { - return compressed_memcopy(w, asset, fd) - } - } -} - -// sanitize prepares a valid UTF-8 string as a raw string constant. -// Based on https://code.google.com/p/go/source/browse/godoc/static/makestatic.go?repo=tools -func sanitize(b []byte) []byte { - // Replace ` with `+"`"+` - b = bytes.Replace(b, []byte("`"), []byte("`+\"`\"+`"), -1) - - // Replace BOM with `+"\xEF\xBB\xBF"+` - // (A BOM is valid UTF-8 but not permitted in Go source files. - // I wouldn't bother handling this, but for some insane reason - // jquery.js has a BOM somewhere in the middle.) - return bytes.Replace(b, []byte("\xEF\xBB\xBF"), []byte("`+\"\\xEF\\xBB\\xBF\"+`"), -1) -} - -func header_compressed_nomemcopy(w io.Writer) error { - _, err := fmt.Fprintf(w, `import ( - "bytes" - "compress/gzip" - "fmt" - "io" - "reflect" - "strings" - "unsafe" -) - -func bindata_read(data, name string) ([]byte, error) { - var empty [0]byte - sx := (*reflect.StringHeader)(unsafe.Pointer(&data)) - b := empty[:] - bx := (*reflect.SliceHeader)(unsafe.Pointer(&b)) - bx.Data = sx.Data - bx.Len = len(data) - bx.Cap = bx.Len - - gz, err := gzip.NewReader(bytes.NewBuffer(b)) - if err != nil { - return nil, fmt.Errorf("Read %%q: %%v", name, err) - } - - var buf bytes.Buffer - _, err = io.Copy(&buf, gz) - gz.Close() - - if err != nil { - return nil, fmt.Errorf("Read %%q: %%v", name, err) - } - - return buf.Bytes(), nil -} - -`) - return err -} - -func header_compressed_memcopy(w io.Writer) error { - _, err := fmt.Fprintf(w, `import ( - "bytes" - "compress/gzip" - "fmt" - "io" - "strings" -) - -func bindata_read(data []byte, name string) ([]byte, error) { - gz, err := gzip.NewReader(bytes.NewBuffer(data)) - if err != nil { - return nil, fmt.Errorf("Read %%q: %%v", name, err) - } - - var buf bytes.Buffer - _, err = io.Copy(&buf, gz) - gz.Close() - - if err != nil { - return nil, fmt.Errorf("Read %%q: %%v", name, err) - } - - return buf.Bytes(), nil -} - -`) - return err -} - -func header_uncompressed_nomemcopy(w io.Writer) error { - _, err := fmt.Fprintf(w, `import ( - "fmt" - "reflect" - "strings" - "unsafe" -) - -func bindata_read(data, name string) ([]byte, error) { - var empty [0]byte - sx := (*reflect.StringHeader)(unsafe.Pointer(&data)) - b := empty[:] - bx := (*reflect.SliceHeader)(unsafe.Pointer(&b)) - bx.Data = sx.Data - bx.Len = len(data) - bx.Cap = bx.Len - return b, nil -} - -`) - return err -} - -func header_uncompressed_memcopy(w io.Writer) error { - _, err := fmt.Fprintf(w, `import ( - "fmt" - "strings" -) -`) - return err -} - -func compressed_nomemcopy(w io.Writer, asset *Asset, r io.Reader) error { - _, err := fmt.Fprintf(w, `var _%s = "`, asset.Func) - if err != nil { - return err - } - - gz := gzip.NewWriter(&StringWriter{Writer: w}) - _, err = io.Copy(gz, r) - gz.Close() - - if err != nil { - return err - } - - _, err = fmt.Fprintf(w, `" - -func %s() ([]byte, error) { - return bindata_read( - _%s, - %q, - ) -} - -`, asset.Func, asset.Func, asset.Name) - return err -} - -func compressed_memcopy(w io.Writer, asset *Asset, r io.Reader) error { - _, err := fmt.Fprintf(w, `var _%s = []byte("`, asset.Func) - if err != nil { - return err - } - - gz := gzip.NewWriter(&StringWriter{Writer: w}) - _, err = io.Copy(gz, r) - gz.Close() - - if err != nil { - return err - } - - _, err = fmt.Fprintf(w, `") - -func %s() ([]byte, error) { - return bindata_read( - _%s, - %q, - ) -} - -`, asset.Func, asset.Func, asset.Name) - return err -} - -func uncompressed_nomemcopy(w io.Writer, asset *Asset, r io.Reader) error { - _, err := fmt.Fprintf(w, `var _%s = "`, asset.Func) - if err != nil { - return err - } - - _, err = io.Copy(&StringWriter{Writer: w}, r) - if err != nil { - return err - } - - _, err = fmt.Fprintf(w, `" - -func %s() ([]byte, error) { - return bindata_read( - _%s, - %q, - ) -} - -`, asset.Func, asset.Func, asset.Name) - return err -} - -func uncompressed_memcopy(w io.Writer, asset *Asset, r io.Reader) error { - _, err := fmt.Fprintf(w, `var _%s = []byte(`, asset.Func) - if err != nil { - return err - } - - b, err := ioutil.ReadAll(r) - if err != nil { - return err - } - if utf8.Valid(b) { - fmt.Fprintf(w, "`%s`", sanitize(b)) - } else { - fmt.Fprintf(w, "%q", b) - } - - _, err = fmt.Fprintf(w, `) - -func %s() ([]byte, error) { - return _%s, nil -} - -`, asset.Func, asset.Func) - return err -} diff --git a/vendor/github.com/jteeuwen/go-bindata/stringwriter.go b/vendor/github.com/jteeuwen/go-bindata/stringwriter.go deleted file mode 100644 index 77daa04cb..000000000 --- a/vendor/github.com/jteeuwen/go-bindata/stringwriter.go +++ /dev/null @@ -1,36 +0,0 @@ -// This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication -// license. Its contents can be found at: -// http://creativecommons.org/publicdomain/zero/1.0/ - -package bindata - -import ( - "io" -) - -const lowerHex = "0123456789abcdef" - -type StringWriter struct { - io.Writer - c int -} - -func (w *StringWriter) Write(p []byte) (n int, err error) { - if len(p) == 0 { - return - } - - buf := []byte(`\x00`) - var b byte - - for n, b = range p { - buf[2] = lowerHex[b/16] - buf[3] = lowerHex[b%16] - w.Writer.Write(buf) - w.c++ - } - - n++ - - return -} diff --git a/vendor/github.com/jteeuwen/go-bindata/testdata/in/a/test.asset b/vendor/github.com/jteeuwen/go-bindata/testdata/in/a/test.asset deleted file mode 100644 index ab2a2d949..000000000 --- a/vendor/github.com/jteeuwen/go-bindata/testdata/in/a/test.asset +++ /dev/null @@ -1 +0,0 @@ -// sample file diff --git a/vendor/github.com/jteeuwen/go-bindata/testdata/in/b/test.asset b/vendor/github.com/jteeuwen/go-bindata/testdata/in/b/test.asset deleted file mode 100644 index ab2a2d949..000000000 --- a/vendor/github.com/jteeuwen/go-bindata/testdata/in/b/test.asset +++ /dev/null @@ -1 +0,0 @@ -// sample file diff --git a/vendor/github.com/jteeuwen/go-bindata/testdata/in/c/test.asset b/vendor/github.com/jteeuwen/go-bindata/testdata/in/c/test.asset deleted file mode 100644 index ab2a2d949..000000000 --- a/vendor/github.com/jteeuwen/go-bindata/testdata/in/c/test.asset +++ /dev/null @@ -1 +0,0 @@ -// sample file diff --git a/vendor/github.com/jteeuwen/go-bindata/testdata/in/test.asset b/vendor/github.com/jteeuwen/go-bindata/testdata/in/test.asset deleted file mode 100644 index ab2a2d949..000000000 --- a/vendor/github.com/jteeuwen/go-bindata/testdata/in/test.asset +++ /dev/null @@ -1 +0,0 @@ -// sample file diff --git a/vendor/github.com/jteeuwen/go-bindata/testdata/out/compress-memcopy.go b/vendor/github.com/jteeuwen/go-bindata/testdata/out/compress-memcopy.go deleted file mode 100644 index b190d6fd5..000000000 --- a/vendor/github.com/jteeuwen/go-bindata/testdata/out/compress-memcopy.go +++ /dev/null @@ -1,86 +0,0 @@ -package main - -import ( - "bytes" - "compress/gzip" - "io" - "log" -) - -func bindata_read(data []byte, name string) []byte { - gz, err := gzip.NewReader(bytes.NewBuffer(data)) - if err != nil { - log.Fatalf("Read %q: %v", name, err) - } - - var buf bytes.Buffer - _, err = io.Copy(&buf, gz) - gz.Close() - - if err != nil { - log.Fatalf("Read %q: %v", name, err) - } - - return buf.Bytes() -} - -func in_b_test_asset() []byte { - return bindata_read([]byte{ - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x00, 0xff, 0xd2, 0xd7, - 0x57, 0x28, 0x4e, 0xcc, 0x2d, 0xc8, 0x49, 0x55, 0x48, 0xcb, 0xcc, 0x49, - 0xe5, 0x02, 0x04, 0x00, 0x00, 0xff, 0xff, 0x8a, 0x82, 0x8c, 0x85, 0x0f, - 0x00, 0x00, 0x00, - }, - "in/b/test.asset", - ) -} - -func in_test_asset() []byte { - return bindata_read([]byte{ - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x00, 0xff, 0xd2, 0xd7, - 0x57, 0x28, 0x4e, 0xcc, 0x2d, 0xc8, 0x49, 0x55, 0x48, 0xcb, 0xcc, 0x49, - 0xe5, 0x02, 0x04, 0x00, 0x00, 0xff, 0xff, 0x8a, 0x82, 0x8c, 0x85, 0x0f, - 0x00, 0x00, 0x00, - }, - "in/test.asset", - ) -} - -func in_a_test_asset() []byte { - return bindata_read([]byte{ - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x00, 0xff, 0xd2, 0xd7, - 0x57, 0x28, 0x4e, 0xcc, 0x2d, 0xc8, 0x49, 0x55, 0x48, 0xcb, 0xcc, 0x49, - 0xe5, 0x02, 0x04, 0x00, 0x00, 0xff, 0xff, 0x8a, 0x82, 0x8c, 0x85, 0x0f, - 0x00, 0x00, 0x00, - }, - "in/a/test.asset", - ) -} - -func in_c_test_asset() []byte { - return bindata_read([]byte{ - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x00, 0xff, 0xd2, 0xd7, - 0x57, 0x28, 0x4e, 0xcc, 0x2d, 0xc8, 0x49, 0x55, 0x48, 0xcb, 0xcc, 0x49, - 0xe5, 0x02, 0x04, 0x00, 0x00, 0xff, 0xff, 0x8a, 0x82, 0x8c, 0x85, 0x0f, - 0x00, 0x00, 0x00, - }, - "in/c/test.asset", - ) -} - -// Asset loads and returns the asset for the given name. -// This returns nil of the asset could not be found. -func Asset(name string) []byte { - if f, ok := _bindata[name]; ok { - return f() - } - return nil -} - -// _bindata is a table, holding each asset generator, mapped to its name. -var _bindata = map[string]func() []byte{ - "in/b/test.asset": in_b_test_asset, - "in/test.asset": in_test_asset, - "in/a/test.asset": in_a_test_asset, - "in/c/test.asset": in_c_test_asset, -} diff --git a/vendor/github.com/jteeuwen/go-bindata/testdata/out/compress-nomemcopy.go b/vendor/github.com/jteeuwen/go-bindata/testdata/out/compress-nomemcopy.go deleted file mode 100644 index 8f45c7b49..000000000 --- a/vendor/github.com/jteeuwen/go-bindata/testdata/out/compress-nomemcopy.go +++ /dev/null @@ -1,88 +0,0 @@ -package main - -import ( - "bytes" - "compress/gzip" - "io" - "log" - "reflect" - "unsafe" -) - -func bindata_read(data, name string) []byte { - var empty [0]byte - sx := (*reflect.StringHeader)(unsafe.Pointer(&data)) - b := empty[:] - bx := (*reflect.SliceHeader)(unsafe.Pointer(&b)) - bx.Data = sx.Data - bx.Len = len(data) - bx.Cap = bx.Len - - gz, err := gzip.NewReader(bytes.NewBuffer(b)) - if err != nil { - log.Fatalf("Read %q: %v", name, err) - } - - var buf bytes.Buffer - _, err = io.Copy(&buf, gz) - gz.Close() - - if err != nil { - log.Fatalf("Read %q: %v", name, err) - } - - return buf.Bytes() -} - -var _in_b_test_asset = "\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xd2\xd7\x57\x28\x4e\xcc\x2d\xc8\x49\x55\x48\xcb\xcc\x49\xe5\x02\x04\x00\x00\xff\xff\x8a\x82\x8c\x85\x0f\x00\x00\x00" - -func in_b_test_asset() []byte { - return bindata_read( - _in_b_test_asset, - "in/b/test.asset", - ) -} - -var _in_test_asset = "\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xd2\xd7\x57\x28\x4e\xcc\x2d\xc8\x49\x55\x48\xcb\xcc\x49\xe5\x02\x04\x00\x00\xff\xff\x8a\x82\x8c\x85\x0f\x00\x00\x00" - -func in_test_asset() []byte { - return bindata_read( - _in_test_asset, - "in/test.asset", - ) -} - -var _in_a_test_asset = "\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xd2\xd7\x57\x28\x4e\xcc\x2d\xc8\x49\x55\x48\xcb\xcc\x49\xe5\x02\x04\x00\x00\xff\xff\x8a\x82\x8c\x85\x0f\x00\x00\x00" - -func in_a_test_asset() []byte { - return bindata_read( - _in_a_test_asset, - "in/a/test.asset", - ) -} - -var _in_c_test_asset = "\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xd2\xd7\x57\x28\x4e\xcc\x2d\xc8\x49\x55\x48\xcb\xcc\x49\xe5\x02\x04\x00\x00\xff\xff\x8a\x82\x8c\x85\x0f\x00\x00\x00" - -func in_c_test_asset() []byte { - return bindata_read( - _in_c_test_asset, - "in/c/test.asset", - ) -} - -// Asset loads and returns the asset for the given name. -// This returns nil of the asset could not be found. -func Asset(name string) []byte { - if f, ok := _bindata[name]; ok { - return f() - } - return nil -} - -// _bindata is a table, holding each asset generator, mapped to its name. -var _bindata = map[string]func() []byte{ - "in/b/test.asset": in_b_test_asset, - "in/test.asset": in_test_asset, - "in/a/test.asset": in_a_test_asset, - "in/c/test.asset": in_c_test_asset, -} diff --git a/vendor/github.com/jteeuwen/go-bindata/testdata/out/debug.go b/vendor/github.com/jteeuwen/go-bindata/testdata/out/debug.go deleted file mode 100644 index d3a0ec28a..000000000 --- a/vendor/github.com/jteeuwen/go-bindata/testdata/out/debug.go +++ /dev/null @@ -1,80 +0,0 @@ -package main - -import ( - "bytes" - "io" - "log" - "os" -) - -// bindata_read reads the given file from disk. -// It panics if anything went wrong. -func bindata_read(path, name string) []byte { - fd, err := os.Open(path) - if err != nil { - log.Fatalf("Read %s: %v", name, err) - } - - defer fd.Close() - - var buf bytes.Buffer - _, err = io.Copy(&buf, fd) - if err != nil { - log.Fatalf("Read %s: %v", name, err) - } - - return buf.Bytes() -} - -// in_b_test_asset reads file data from disk. -// It panics if something went wrong in the process. -func in_b_test_asset() []byte { - return bindata_read( - "/a/code/go/src/github.com/jteeuwen/go-bindata/testdata/in/b/test.asset", - "in/b/test.asset", - ) -} - -// in_test_asset reads file data from disk. -// It panics if something went wrong in the process. -func in_test_asset() []byte { - return bindata_read( - "/a/code/go/src/github.com/jteeuwen/go-bindata/testdata/in/test.asset", - "in/test.asset", - ) -} - -// in_a_test_asset reads file data from disk. -// It panics if something went wrong in the process. -func in_a_test_asset() []byte { - return bindata_read( - "/a/code/go/src/github.com/jteeuwen/go-bindata/testdata/in/a/test.asset", - "in/a/test.asset", - ) -} - -// in_c_test_asset reads file data from disk. -// It panics if something went wrong in the process. -func in_c_test_asset() []byte { - return bindata_read( - "/a/code/go/src/github.com/jteeuwen/go-bindata/testdata/in/c/test.asset", - "in/c/test.asset", - ) -} - -// Asset loads and returns the asset for the given name. -// This returns nil of the asset could not be found. -func Asset(name string) []byte { - if f, ok := _bindata[name]; ok { - return f() - } - return nil -} - -// _bindata is a table, holding each asset generator, mapped to its name. -var _bindata = map[string]func() []byte{ - "in/b/test.asset": in_b_test_asset, - "in/test.asset": in_test_asset, - "in/a/test.asset": in_a_test_asset, - "in/c/test.asset": in_c_test_asset, -} diff --git a/vendor/github.com/jteeuwen/go-bindata/testdata/out/nocompress-memcopy.go b/vendor/github.com/jteeuwen/go-bindata/testdata/out/nocompress-memcopy.go deleted file mode 100644 index ed05faef4..000000000 --- a/vendor/github.com/jteeuwen/go-bindata/testdata/out/nocompress-memcopy.go +++ /dev/null @@ -1,46 +0,0 @@ -package main - -func in_b_test_asset() []byte { - return []byte{ - 0x2f, 0x2f, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x66, 0x69, - 0x6c, 0x65, 0x0a, - } -} - -func in_test_asset() []byte { - return []byte{ - 0x2f, 0x2f, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x66, 0x69, - 0x6c, 0x65, 0x0a, - } -} - -func in_a_test_asset() []byte { - return []byte{ - 0x2f, 0x2f, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x66, 0x69, - 0x6c, 0x65, 0x0a, - } -} - -func in_c_test_asset() []byte { - return []byte{ - 0x2f, 0x2f, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x66, 0x69, - 0x6c, 0x65, 0x0a, - } -} - -// Asset loads and returns the asset for the given name. -// This returns nil of the asset could not be found. -func Asset(name string) []byte { - if f, ok := _bindata[name]; ok { - return f() - } - return nil -} - -// _bindata is a table, holding each asset generator, mapped to its name. -var _bindata = map[string]func() []byte{ - "in/b/test.asset": in_b_test_asset, - "in/test.asset": in_test_asset, - "in/a/test.asset": in_a_test_asset, - "in/c/test.asset": in_c_test_asset, -} diff --git a/vendor/github.com/jteeuwen/go-bindata/testdata/out/nocompress-nomemcopy.go b/vendor/github.com/jteeuwen/go-bindata/testdata/out/nocompress-nomemcopy.go deleted file mode 100644 index 75973095f..000000000 --- a/vendor/github.com/jteeuwen/go-bindata/testdata/out/nocompress-nomemcopy.go +++ /dev/null @@ -1,70 +0,0 @@ -package main - -import ( - "reflect" - "unsafe" -) - -func bindata_read(data, name string) []byte { - var empty [0]byte - sx := (*reflect.StringHeader)(unsafe.Pointer(&data)) - b := empty[:] - bx := (*reflect.SliceHeader)(unsafe.Pointer(&b)) - bx.Data = sx.Data - bx.Len = len(data) - bx.Cap = bx.Len - return b -} - -var _in_b_test_asset = "\x2f\x2f\x20\x73\x61\x6d\x70\x6c\x65\x20\x66\x69\x6c\x65\x0a" - -func in_b_test_asset() []byte { - return bindata_read( - _in_b_test_asset, - "in/b/test.asset", - ) -} - -var _in_test_asset = "\x2f\x2f\x20\x73\x61\x6d\x70\x6c\x65\x20\x66\x69\x6c\x65\x0a" - -func in_test_asset() []byte { - return bindata_read( - _in_test_asset, - "in/test.asset", - ) -} - -var _in_a_test_asset = "\x2f\x2f\x20\x73\x61\x6d\x70\x6c\x65\x20\x66\x69\x6c\x65\x0a" - -func in_a_test_asset() []byte { - return bindata_read( - _in_a_test_asset, - "in/a/test.asset", - ) -} - -var _in_c_test_asset = "\x2f\x2f\x20\x73\x61\x6d\x70\x6c\x65\x20\x66\x69\x6c\x65\x0a" - -func in_c_test_asset() []byte { - return bindata_read( - _in_c_test_asset, - "in/c/test.asset", - ) -} - -// Asset loads and returns the asset for the given name. -// This returns nil of the asset could not be found. -func Asset(name string) []byte { - if f, ok := _bindata[name]; ok { - return f() - } - return nil -} - -// _bindata is a table, holding each asset generator, mapped to its name. -var _bindata = map[string]func() []byte{ - "in/b/test.asset": in_b_test_asset, - "in/test.asset": in_test_asset, - "in/a/test.asset": in_a_test_asset, - "in/c/test.asset": in_c_test_asset, -} diff --git a/vendor/github.com/jteeuwen/go-bindata/toc.go b/vendor/github.com/jteeuwen/go-bindata/toc.go deleted file mode 100644 index cbbae6e3f..000000000 --- a/vendor/github.com/jteeuwen/go-bindata/toc.go +++ /dev/null @@ -1,195 +0,0 @@ -// This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication -// license. Its contents can be found at: -// http://creativecommons.org/publicdomain/zero/1.0/ - -package bindata - -import ( - "fmt" - "io" - "os" - "sort" - "strings" -) - -type assetTree struct { - Asset Asset - Children map[string]*assetTree -} - -func newAssetTree() *assetTree { - tree := &assetTree{} - tree.Children = make(map[string]*assetTree) - return tree -} - -func (node *assetTree) child(name string) *assetTree { - rv, ok := node.Children[name] - if !ok { - rv = newAssetTree() - node.Children[name] = rv - } - return rv -} - -func (root *assetTree) Add(route []string, asset Asset) { - for _, name := range route { - root = root.child(name) - } - root.Asset = asset -} - -func ident(w io.Writer, n int) { - for i := 0; i < n; i++ { - w.Write([]byte{'\t'}) - } -} - -func (root *assetTree) funcOrNil() string { - if root.Asset.Func == "" { - return "nil" - } else { - return root.Asset.Func - } -} - -func (root *assetTree) writeGoMap(w io.Writer, nident int) { - fmt.Fprintf(w, "&_bintree_t{%s, map[string]*_bintree_t{\n", root.funcOrNil()) - - // Sort to make output stable between invocations - filenames := make([]string, len(root.Children)) - i := 0 - for filename, _ := range root.Children { - filenames[i] = filename - i++ - } - sort.Strings(filenames) - - for _, p := range filenames { - ident(w, nident+1) - fmt.Fprintf(w, `"%s": `, p) - root.Children[p].writeGoMap(w, nident+1) - } - ident(w, nident) - io.WriteString(w, "}}") - if nident > 0 { - io.WriteString(w, ",") - } - io.WriteString(w, "\n") -} - -func (root *assetTree) WriteAsGoMap(w io.Writer) error { - _, err := fmt.Fprint(w, `type _bintree_t struct { - Func func() ([]byte, error) - Children map[string]*_bintree_t -} -var _bintree = `) - root.writeGoMap(w, 0) - return err -} - -func writeTOCTree(w io.Writer, toc []Asset) error { - _, err := fmt.Fprintf(w, `// AssetDir returns the file names below a certain -// directory embedded in the file by go-bindata. -// For example if you run go-bindata on data/... and data contains the -// following hierarchy: -// data/ -// foo.txt -// img/ -// a.png -// b.png -// then AssetDir("data") would return []string{"foo.txt", "img"} -// AssetDir("data/img") would return []string{"a.png", "b.png"} -// AssetDir("foo.txt") and AssetDir("notexist") would return an error -// AssetDir("") will return []string{"data"}. -func AssetDir(name string) ([]string, error) { - node := _bintree - if len(name) != 0 { - cannonicalName := strings.Replace(name, "\\", "/", -1) - pathList := strings.Split(cannonicalName, "/") - for _, p := range pathList { - node = node.Children[p] - if node == nil { - return nil, fmt.Errorf("Asset %%s not found", name) - } - } - } - if node.Func != nil { - return nil, fmt.Errorf("Asset %%s not found", name) - } - rv := make([]string, 0, len(node.Children)) - for name := range node.Children { - rv = append(rv, name) - } - return rv, nil -} - -`) - if err != nil { - return err - } - tree := newAssetTree() - for i := range toc { - pathList := strings.Split(toc[i].Name, string(os.PathSeparator)) - tree.Add(pathList, toc[i]) - } - return tree.WriteAsGoMap(w) -} - -// writeTOC writes the table of contents file. -func writeTOC(w io.Writer, toc []Asset) error { - err := writeTOCHeader(w) - if err != nil { - return err - } - - for i := range toc { - err = writeTOCAsset(w, &toc[i]) - if err != nil { - return err - } - } - - return writeTOCFooter(w) -} - -// writeTOCHeader writes the table of contents file header. -func writeTOCHeader(w io.Writer) error { - _, err := fmt.Fprintf(w, `// Asset loads and returns the asset for the given name. -// It returns an error if the asset could not be found or -// could not be loaded. -func Asset(name string) ([]byte, error) { - cannonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[cannonicalName]; ok { - return f() - } - return nil, fmt.Errorf("Asset %%s not found", name) -} - -// AssetNames returns the names of the assets. -func AssetNames() []string { - names := make([]string, 0, len(_bindata)) - for name := range _bindata { - names = append(names, name) - } - return names -} - -// _bindata is a table, holding each asset generator, mapped to its name. -var _bindata = map[string]func() ([]byte, error){ -`) - return err -} - -// writeTOCAsset write a TOC entry for the given asset. -func writeTOCAsset(w io.Writer, asset *Asset) error { - _, err := fmt.Fprintf(w, "\t%q: %s,\n", asset.Name, asset.Func) - return err -} - -// writeTOCFooter writes the table of contents file footer. -func writeTOCFooter(w io.Writer) error { - _, err := fmt.Fprintf(w, `} -`) - return err -}