mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 14:07:14 +00:00
Merge pull request #99829 from palnabarun/migrate-to-go-embed
Replace go-bindata with //go:embed
This commit is contained in:
commit
044fd6fdf6
7
LICENSES/vendor/github.com/go-bindata/go-bindata/LICENSE
generated
vendored
7
LICENSES/vendor/github.com/go-bindata/go-bindata/LICENSE
generated
vendored
@ -1,7 +0,0 @@
|
|||||||
= vendor/github.com/go-bindata/go-bindata licensed under: =
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
= vendor/github.com/go-bindata/go-bindata/LICENSE 8dcedca69f7a474372829521f37954b1
|
|
@ -39,7 +39,7 @@ UPDATE_API_KNOWN_VIOLATIONS ?=
|
|||||||
# This rule collects all the generated file sets into a single rule. Other
|
# This rule collects all the generated file sets into a single rule. Other
|
||||||
# rules should depend on this to ensure generated files are rebuilt.
|
# rules should depend on this to ensure generated files are rebuilt.
|
||||||
.PHONY: generated_files
|
.PHONY: generated_files
|
||||||
generated_files: gen_prerelease_lifecycle gen_deepcopy gen_defaulter gen_conversion gen_openapi gen_bindata
|
generated_files: gen_prerelease_lifecycle gen_deepcopy gen_defaulter gen_conversion gen_openapi
|
||||||
|
|
||||||
#
|
#
|
||||||
# Helper logic to calculate Go's dependency DAG ourselves.
|
# Helper logic to calculate Go's dependency DAG ourselves.
|
||||||
@ -73,7 +73,6 @@ $(META_DIR)/$(GO_PKGDEPS_FILE): FORCE
|
|||||||
--prune k8s.io/kubernetes/staging \
|
--prune k8s.io/kubernetes/staging \
|
||||||
--prune k8s.io/kubernetes/vendor \
|
--prune k8s.io/kubernetes/vendor \
|
||||||
k8s.io/kubernetes/vendor/k8s.io/... \
|
k8s.io/kubernetes/vendor/k8s.io/... \
|
||||||
github.com/go-bindata/go-bindata/go-bindata/... \
|
|
||||||
> $@.tmp
|
> $@.tmp
|
||||||
if ! cmp -s $@.tmp $@; then \
|
if ! cmp -s $@.tmp $@; then \
|
||||||
if [[ "$(DBG_CODEGEN)" == 1 ]]; then \
|
if [[ "$(DBG_CODEGEN)" == 1 ]]; then \
|
||||||
@ -639,32 +638,3 @@ gen_openapi: $(OPENAPI_GEN) $(KUBE_OPENAPI_OUTFILE) $(AGGREGATOR_OPENAPI_OUTFILE
|
|||||||
$(OPENAPI_GEN): $(GODEPS_k8s.io/kubernetes/vendor/k8s.io/kube-openapi/cmd/openapi-gen)
|
$(OPENAPI_GEN): $(GODEPS_k8s.io/kubernetes/vendor/k8s.io/kube-openapi/cmd/openapi-gen)
|
||||||
KUBE_BUILD_PLATFORMS="" hack/make-rules/build.sh ./vendor/k8s.io/kube-openapi/cmd/openapi-gen
|
KUBE_BUILD_PLATFORMS="" hack/make-rules/build.sh ./vendor/k8s.io/kube-openapi/cmd/openapi-gen
|
||||||
touch $@
|
touch $@
|
||||||
|
|
||||||
|
|
||||||
# bindata generation
|
|
||||||
#
|
|
||||||
|
|
||||||
# The tool used to generate bindata files.
|
|
||||||
BINDATA_GEN := $(BIN_DIR)/go-bindata
|
|
||||||
|
|
||||||
# A wrapper script that generates all bindata files. It is fast enough that we
|
|
||||||
# don't care.
|
|
||||||
BINDATA_SCRIPT := hack/generate-bindata.sh
|
|
||||||
|
|
||||||
# This rule is the user-friendly entrypoint for bindata generation.
|
|
||||||
.PHONY: gen_bindata
|
|
||||||
gen_bindata: $(BINDATA_GEN) FORCE
|
|
||||||
./hack/run-in-gopath.sh $(BINDATA_SCRIPT)
|
|
||||||
|
|
||||||
# How to build the generator tool. The deps for this are defined in
|
|
||||||
# the $(BINDATA_GEN).mk, above.
|
|
||||||
#
|
|
||||||
# A word on the need to touch: This rule might trigger if, for example, a
|
|
||||||
# non-Go file was added or deleted from a directory on which this depends.
|
|
||||||
# This target needs to be reconsidered, but Go realizes it doesn't actually
|
|
||||||
# have to be rebuilt. In that case, make will forever see the dependency as
|
|
||||||
# newer than the binary, and try to rebuild it over and over. So we touch it,
|
|
||||||
# and make is happy.
|
|
||||||
$(BINDATA_GEN): $(GODEPS_k8s.io/kubernetes/vendor/github.com/go-bindata/go-bindata/go-bindata)
|
|
||||||
KUBE_BUILD_PLATFORMS="" hack/make-rules/build.sh ./vendor/github.com/go-bindata/go-bindata/go-bindata
|
|
||||||
touch $@
|
|
||||||
|
@ -20,7 +20,6 @@ limitations under the License.
|
|||||||
package tools
|
package tools
|
||||||
|
|
||||||
import (
|
import (
|
||||||
_ "github.com/go-bindata/go-bindata/go-bindata"
|
|
||||||
_ "github.com/onsi/ginkgo/ginkgo"
|
_ "github.com/onsi/ginkgo/ginkgo"
|
||||||
_ "k8s.io/code-generator/cmd/go-to-protobuf"
|
_ "k8s.io/code-generator/cmd/go-to-protobuf"
|
||||||
_ "k8s.io/code-generator/cmd/go-to-protobuf/protoc-gen-gogo"
|
_ "k8s.io/code-generator/cmd/go-to-protobuf/protoc-gen-gogo"
|
||||||
|
2
go.mod
2
go.mod
@ -40,7 +40,6 @@ require (
|
|||||||
github.com/emicklei/go-restful v2.9.5+incompatible
|
github.com/emicklei/go-restful v2.9.5+incompatible
|
||||||
github.com/evanphx/json-patch v4.11.0+incompatible
|
github.com/evanphx/json-patch v4.11.0+incompatible
|
||||||
github.com/fsnotify/fsnotify v1.4.9
|
github.com/fsnotify/fsnotify v1.4.9
|
||||||
github.com/go-bindata/go-bindata v3.1.1+incompatible
|
|
||||||
github.com/go-ozzo/ozzo-validation v3.5.0+incompatible // indirect
|
github.com/go-ozzo/ozzo-validation v3.5.0+incompatible // indirect
|
||||||
github.com/godbus/dbus/v5 v5.0.4
|
github.com/godbus/dbus/v5 v5.0.4
|
||||||
github.com/gogo/protobuf v1.3.2
|
github.com/gogo/protobuf v1.3.2
|
||||||
@ -246,7 +245,6 @@ replace (
|
|||||||
github.com/fvbommel/sortorder => github.com/fvbommel/sortorder v1.0.1
|
github.com/fvbommel/sortorder => github.com/fvbommel/sortorder v1.0.1
|
||||||
github.com/getsentry/raven-go => github.com/getsentry/raven-go v0.2.0
|
github.com/getsentry/raven-go => github.com/getsentry/raven-go v0.2.0
|
||||||
github.com/ghodss/yaml => github.com/ghodss/yaml v1.0.0
|
github.com/ghodss/yaml => github.com/ghodss/yaml v1.0.0
|
||||||
github.com/go-bindata/go-bindata => github.com/go-bindata/go-bindata v3.1.1+incompatible
|
|
||||||
github.com/go-errors/errors => github.com/go-errors/errors v1.0.1
|
github.com/go-errors/errors => github.com/go-errors/errors v1.0.1
|
||||||
github.com/go-gl/glfw/v3.3/glfw => github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4
|
github.com/go-gl/glfw/v3.3/glfw => github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4
|
||||||
github.com/go-kit/kit => github.com/go-kit/kit v0.9.0
|
github.com/go-kit/kit => github.com/go-kit/kit v0.9.0
|
||||||
|
2
go.sum
2
go.sum
@ -181,8 +181,6 @@ github.com/fvbommel/sortorder v1.0.1/go.mod h1:uk88iVf1ovNn1iLfgUVU2F9o5eO30ui72
|
|||||||
github.com/getsentry/raven-go v0.2.0 h1:no+xWJRb5ZI7eE8TWgIq1jLulQiIoLG0IfYxv5JYMGs=
|
github.com/getsentry/raven-go v0.2.0 h1:no+xWJRb5ZI7eE8TWgIq1jLulQiIoLG0IfYxv5JYMGs=
|
||||||
github.com/getsentry/raven-go v0.2.0/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ=
|
github.com/getsentry/raven-go v0.2.0/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ=
|
||||||
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||||
github.com/go-bindata/go-bindata v3.1.1+incompatible h1:tR4f0e4VTO7LK6B2YWyAoVEzG9ByG1wrXB4TL9+jiYg=
|
|
||||||
github.com/go-bindata/go-bindata v3.1.1+incompatible/go.mod h1:xK8Dsgwmeed+BBsSy2XTopBn/8uK2HWuGSnA11C3Joo=
|
|
||||||
github.com/go-errors/errors v1.0.1 h1:LUHzmkK3GUKUrL/1gfBUxAHzcev3apQlezX/+O7ma6w=
|
github.com/go-errors/errors v1.0.1 h1:LUHzmkK3GUKUrL/1gfBUxAHzcev3apQlezX/+O7ma6w=
|
||||||
github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q=
|
github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q=
|
||||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||||
|
@ -1,85 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Copyright 2016 The Kubernetes Authors.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
|
|
||||||
set -o errexit
|
|
||||||
set -o pipefail
|
|
||||||
set -o nounset
|
|
||||||
|
|
||||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
|
||||||
export KUBE_ROOT
|
|
||||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
|
||||||
source "${KUBE_ROOT}/hack/lib/logging.sh"
|
|
||||||
|
|
||||||
if [[ ! -d "${KUBE_ROOT}/pkg" ]]; then
|
|
||||||
echo "${KUBE_ROOT}/pkg not detected. This script should be run from a location where the source dirs are available."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Ensure that we find the binaries we build before anything else.
|
|
||||||
export GOBIN="${KUBE_OUTPUT_BINPATH}"
|
|
||||||
PATH="${GOBIN}:${PATH}"
|
|
||||||
|
|
||||||
# Install tools we need, but only from vendor/...
|
|
||||||
go install k8s.io/kubernetes/vendor/github.com/go-bindata/go-bindata/go-bindata
|
|
||||||
|
|
||||||
# run the generation from the root directory for stable output
|
|
||||||
pushd "${KUBE_ROOT}" >/dev/null
|
|
||||||
|
|
||||||
# These are files for e2e tests.
|
|
||||||
BINDATA_OUTPUT="test/e2e/generated/bindata.go"
|
|
||||||
go-bindata -nometadata -o "${BINDATA_OUTPUT}.tmp" -pkg generated \
|
|
||||||
-ignore .jpg -ignore .png -ignore .md \
|
|
||||||
"test/conformance/testdata/..." \
|
|
||||||
"test/e2e/testing-manifests/..." \
|
|
||||||
"test/e2e_node/testing-manifests/..." \
|
|
||||||
"test/images/..." \
|
|
||||||
"test/fixtures/..."
|
|
||||||
|
|
||||||
gofmt -s -w "${BINDATA_OUTPUT}.tmp"
|
|
||||||
|
|
||||||
# Here we compare and overwrite only if different to avoid updating the
|
|
||||||
# timestamp and triggering a rebuild. The 'cat' redirect trick to preserve file
|
|
||||||
# permissions of the target file.
|
|
||||||
if ! cmp -s "${BINDATA_OUTPUT}.tmp" "${BINDATA_OUTPUT}" ; then
|
|
||||||
cat "${BINDATA_OUTPUT}.tmp" > "${BINDATA_OUTPUT}"
|
|
||||||
V=2 kube::log::info "Generated bindata file : ${BINDATA_OUTPUT} has $(wc -l ${BINDATA_OUTPUT}) lines of lovely automated artifacts"
|
|
||||||
else
|
|
||||||
V=2 kube::log::info "No changes in generated bindata file: ${BINDATA_OUTPUT}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm -f "${BINDATA_OUTPUT}.tmp"
|
|
||||||
|
|
||||||
# These are files for runtime code
|
|
||||||
BINDATA_OUTPUT="staging/src/k8s.io/kubectl/pkg/generated/bindata.go"
|
|
||||||
go-bindata -nometadata -nocompress -o "${BINDATA_OUTPUT}.tmp" -pkg generated \
|
|
||||||
-ignore .jpg -ignore .png -ignore .md \
|
|
||||||
"translations/..."
|
|
||||||
|
|
||||||
gofmt -s -w "${BINDATA_OUTPUT}.tmp"
|
|
||||||
|
|
||||||
# Here we compare and overwrite only if different to avoid updating the
|
|
||||||
# timestamp and triggering a rebuild. The 'cat' redirect trick to preserve file
|
|
||||||
# permissions of the target file.
|
|
||||||
if ! cmp -s "${BINDATA_OUTPUT}.tmp" "${BINDATA_OUTPUT}" ; then
|
|
||||||
cat "${BINDATA_OUTPUT}.tmp" > "${BINDATA_OUTPUT}"
|
|
||||||
V=2 kube::log::info "Generated bindata file : ${BINDATA_OUTPUT} has $(wc -l ${BINDATA_OUTPUT}) lines of lovely automated artifacts"
|
|
||||||
else
|
|
||||||
V=2 kube::log::info "No changes in generated bindata file: ${BINDATA_OUTPUT}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm -f "${BINDATA_OUTPUT}.tmp"
|
|
||||||
|
|
||||||
popd >/dev/null
|
|
@ -21,6 +21,7 @@
|
|||||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||||
source "${KUBE_ROOT}/hack/lib/util.sh"
|
source "${KUBE_ROOT}/hack/lib/util.sh"
|
||||||
|
|
||||||
|
TRANSLATIONS="staging/src/k8s.io/kubectl/pkg/util/i18n/translations"
|
||||||
KUBECTL_FILES="pkg/kubectl/cmd/*.go pkg/kubectl/cmd/*/*.go"
|
KUBECTL_FILES="pkg/kubectl/cmd/*.go pkg/kubectl/cmd/*/*.go"
|
||||||
|
|
||||||
generate_pot="false"
|
generate_pot="false"
|
||||||
@ -71,7 +72,7 @@ if [[ "${generate_pot}" == "true" ]]; then
|
|||||||
perl -pi -e 's/\\\)/\\\\\)/g' tmp.pot
|
perl -pi -e 's/\\\)/\\\\\)/g' tmp.pot
|
||||||
kube::util::ensure-temp-dir
|
kube::util::ensure-temp-dir
|
||||||
if msgcat -s tmp.pot > "${KUBE_TEMP}/template.pot"; then
|
if msgcat -s tmp.pot > "${KUBE_TEMP}/template.pot"; then
|
||||||
mv "${KUBE_TEMP}/template.pot" translations/kubectl/template.pot
|
mv "${KUBE_TEMP}/template.pot" "${TRANSLATIONS}/kubectl/template.pot"
|
||||||
rm tmp.pot
|
rm tmp.pot
|
||||||
else
|
else
|
||||||
echo "Failed to update template.pot"
|
echo "Failed to update template.pot"
|
||||||
@ -81,12 +82,10 @@ fi
|
|||||||
|
|
||||||
if [[ "${generate_mo}" == "true" ]]; then
|
if [[ "${generate_mo}" == "true" ]]; then
|
||||||
echo "Generating .po and .mo files"
|
echo "Generating .po and .mo files"
|
||||||
for x in translations/*/*/*/*.po; do
|
for x in "${TRANSLATIONS}"/*/*/*/*.po; do
|
||||||
msgcat -s "${x}" > tmp.po
|
msgcat -s "${x}" > tmp.po
|
||||||
mv tmp.po "${x}"
|
mv tmp.po "${x}"
|
||||||
echo "generating .mo file for: ${x}"
|
echo "generating .mo file for: ${x}"
|
||||||
msgfmt "${x}" -o "$(dirname "${x}")/$(basename "${x}" .po).mo"
|
msgfmt "${x}" -o "$(dirname "${x}")/$(basename "${x}" .po).mo"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
./hack/generate-bindata.sh
|
|
||||||
|
File diff suppressed because one or more lines are too long
@ -19,17 +19,19 @@ package i18n
|
|||||||
import (
|
import (
|
||||||
"archive/zip"
|
"archive/zip"
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"embed"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"k8s.io/kubectl/pkg/generated"
|
|
||||||
|
|
||||||
"github.com/chai2010/gettext-go/gettext"
|
"github.com/chai2010/gettext-go/gettext"
|
||||||
"k8s.io/klog/v2"
|
"k8s.io/klog/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
//go:embed translations
|
||||||
|
var translations embed.FS
|
||||||
|
|
||||||
var knownTranslations = map[string][]string{
|
var knownTranslations = map[string][]string{
|
||||||
"kubectl": {
|
"kubectl": {
|
||||||
"default",
|
"default",
|
||||||
@ -112,7 +114,7 @@ func LoadTranslations(root string, getLanguageFn func() string) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
data, err := generated.Asset(filename)
|
data, err := translations.ReadFile(filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ This is a basic sketch of the workflow needed to add translations:
|
|||||||
# Adding/Updating Translations
|
# Adding/Updating Translations
|
||||||
|
|
||||||
## New languages
|
## New languages
|
||||||
Create `translations/kubectl/<language>/LC_MESSAGES/k8s.po`. There's
|
Create `staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/<language>/LC_MESSAGES/k8s.po`. There's
|
||||||
no need to update `translations/test/...` which is only used for unit tests.
|
no need to update `translations/test/...` which is only used for unit tests.
|
||||||
|
|
||||||
There is an example [PR here](https://github.com/kubernetes/kubernetes/pull/40645) which adds support for French.
|
There is an example [PR here](https://github.com/kubernetes/kubernetes/pull/40645) which adds support for French.
|
||||||
@ -14,7 +14,7 @@ Once you've added a new language, you'll need to register it in
|
|||||||
`staging/src/k8s.io/kubectl/pkg/util/i18n/i18n.go` by adding it to the `knownTranslations` map.
|
`staging/src/k8s.io/kubectl/pkg/util/i18n/i18n.go` by adding it to the `knownTranslations` map.
|
||||||
|
|
||||||
## Wrapping strings
|
## Wrapping strings
|
||||||
There is a simple script in `translations/extract.py` that performs
|
There is a simple script in `staging/src/k8s.io/kubectl/pkg/util/i18n/translations/extract.py` that performs
|
||||||
simple regular expression based wrapping of strings. It can always
|
simple regular expression based wrapping of strings. It can always
|
||||||
use improvements to understand additional strings.
|
use improvements to understand additional strings.
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ will extract and sort any new strings.
|
|||||||
|
|
||||||
## Adding new translations
|
## Adding new translations
|
||||||
Edit the appropriate `k8s.po` file, `poedit` is a popular open source tool
|
Edit the appropriate `k8s.po` file, `poedit` is a popular open source tool
|
||||||
for translations. You can load the `translations/kubectl/template.pot` file
|
for translations. You can load the `staging/src/k8s.io/kubectl/pkg/util/i18n/translations/kubectl/template.pot` file
|
||||||
to find messages that might be missing.
|
to find messages that might be missing.
|
||||||
|
|
||||||
Once you are done with your `k8s.po` file, generate the corresponding `k8s.mo`
|
Once you are done with your `k8s.po` file, generate the corresponding `k8s.mo`
|
||||||
@ -42,6 +42,10 @@ We use the English translation as the `msgid`.
|
|||||||
|
|
||||||
## Regenerating the bindata file
|
## Regenerating the bindata file
|
||||||
|
|
||||||
|
> Note: Regeneration of bindata is no more necessary for Kubernetes 1.22+ as
|
||||||
|
> the translations are now embedded into the binary at compile time.
|
||||||
|
> See: https://github.com/kubernetes/kubernetes/pull/99829
|
||||||
|
|
||||||
With the `mo` files up to date, you can now convert the generated files
|
With the `mo` files up to date, you can now convert the generated files
|
||||||
into code using `go-bindata` command which can be installed with:
|
into code using `go-bindata` command which can be installed with:
|
||||||
|
|
||||||
@ -55,7 +59,7 @@ binaries.
|
|||||||
|
|
||||||
## Extracting strings
|
## Extracting strings
|
||||||
|
|
||||||
There is a script in `translations/extract.py` that knows how to do some
|
There is a script in `staging/src/k8s.io/kubectl/pkg/util/i18n/translations/extract.py` that knows how to do some
|
||||||
simple extraction. It needs a lot of work.
|
simple extraction. It needs a lot of work.
|
||||||
|
|
||||||
# Using translations
|
# Using translations
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2015 The Kubernetes Authors.
|
Copyright 2021 The Kubernetes Authors.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@ -14,6 +14,20 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package generated
|
package testdata
|
||||||
|
|
||||||
// No code is needed here. This is a stub for compilation purposes.
|
import (
|
||||||
|
"embed"
|
||||||
|
|
||||||
|
"k8s.io/kubernetes/test/e2e/framework/testfiles"
|
||||||
|
)
|
||||||
|
|
||||||
|
//go:embed conformance.yaml ineligible_endpoints.yaml
|
||||||
|
var conformanceTestdataFS embed.FS
|
||||||
|
|
||||||
|
func GetConformanceTestdataFS() testfiles.EmbeddedFileSource {
|
||||||
|
return testfiles.EmbeddedFileSource{
|
||||||
|
EmbeddedFS: conformanceTestdataFS,
|
||||||
|
Root: "test/conformance/testdata",
|
||||||
|
}
|
||||||
|
}
|
@ -33,10 +33,12 @@ import (
|
|||||||
// "github.com/onsi/ginkgo"
|
// "github.com/onsi/ginkgo"
|
||||||
|
|
||||||
"k8s.io/component-base/version"
|
"k8s.io/component-base/version"
|
||||||
|
conformancetestdata "k8s.io/kubernetes/test/conformance/testdata"
|
||||||
"k8s.io/kubernetes/test/e2e/framework"
|
"k8s.io/kubernetes/test/e2e/framework"
|
||||||
"k8s.io/kubernetes/test/e2e/framework/config"
|
"k8s.io/kubernetes/test/e2e/framework/config"
|
||||||
"k8s.io/kubernetes/test/e2e/framework/testfiles"
|
"k8s.io/kubernetes/test/e2e/framework/testfiles"
|
||||||
"k8s.io/kubernetes/test/e2e/generated"
|
e2etestingmanifests "k8s.io/kubernetes/test/e2e/testing-manifests"
|
||||||
|
testfixtures "k8s.io/kubernetes/test/fixtures"
|
||||||
"k8s.io/kubernetes/test/utils/image"
|
"k8s.io/kubernetes/test/utils/image"
|
||||||
|
|
||||||
// test sources
|
// test sources
|
||||||
@ -85,11 +87,11 @@ func TestMain(m *testing.M) {
|
|||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable bindata file lookup as fallback.
|
// Enable embedded FS file lookup as fallback
|
||||||
testfiles.AddFileSource(testfiles.BindataFileSource{
|
testfiles.AddFileSource(e2etestingmanifests.GetE2ETestingManifestsFS())
|
||||||
Asset: generated.Asset,
|
testfiles.AddFileSource(testfixtures.GetTestFixturesFS())
|
||||||
AssetNames: generated.AssetNames,
|
testfiles.AddFileSource(conformancetestdata.GetConformanceTestdataFS())
|
||||||
})
|
|
||||||
if framework.TestContext.ListConformanceTests {
|
if framework.TestContext.ListConformanceTests {
|
||||||
var tests []struct {
|
var tests []struct {
|
||||||
Testname string `yaml:"testname"`
|
Testname string `yaml:"testname"`
|
||||||
|
1
test/e2e/framework/testfiles/testdata/a/foo.txt
vendored
Normal file
1
test/e2e/framework/testfiles/testdata/a/foo.txt
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
Hello World
|
@ -25,13 +25,14 @@ limitations under the License.
|
|||||||
package testfiles
|
package testfiles
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"embed"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/fs"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sort"
|
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -147,32 +148,47 @@ func (r RootFileSource) DescribeFiles() string {
|
|||||||
return description
|
return description
|
||||||
}
|
}
|
||||||
|
|
||||||
// BindataFileSource handles files stored in a package generated with bindata.
|
// EmbeddedFileSource handles files stored in a package generated with bindata.
|
||||||
type BindataFileSource struct {
|
type EmbeddedFileSource struct {
|
||||||
Asset func(string) ([]byte, error)
|
EmbeddedFS embed.FS
|
||||||
AssetNames func() []string
|
Root string
|
||||||
|
fileList []string
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadTestFile looks for an asset with the given path.
|
// ReadTestFile looks for an embedded file with the given path.
|
||||||
func (b BindataFileSource) ReadTestFile(filePath string) ([]byte, error) {
|
func (e EmbeddedFileSource) ReadTestFile(filepath string) ([]byte, error) {
|
||||||
fileBytes, err := b.Asset(filePath)
|
relativePath := strings.TrimPrefix(filepath, fmt.Sprintf("%s/", e.Root))
|
||||||
|
|
||||||
|
b, err := e.EmbeddedFS.ReadFile(relativePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// It would be nice to have a better way to detect
|
if errors.Is(err, fs.ErrNotExist) {
|
||||||
// "not found" errors :-/
|
|
||||||
if strings.HasSuffix(err.Error(), "not found") {
|
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
return nil, err
|
||||||
}
|
}
|
||||||
return fileBytes, nil
|
|
||||||
|
return b, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// DescribeFiles explains about gobindata and then lists all available files.
|
// DescribeFiles explains that it is looking inside an embedded filesystem
|
||||||
func (b BindataFileSource) DescribeFiles() string {
|
func (e EmbeddedFileSource) DescribeFiles() string {
|
||||||
var lines []string
|
var lines []string
|
||||||
lines = append(lines, "The following files are built into the test executable via gobindata. For questions on maintaining gobindata, contact the sig-testing group.")
|
lines = append(lines, "The following files are embedded into the test executable:")
|
||||||
assets := b.AssetNames()
|
|
||||||
sort.Strings(assets)
|
if len(e.fileList) == 0 {
|
||||||
lines = append(lines, assets...)
|
e.populateFileList()
|
||||||
description := strings.Join(lines, "\n ")
|
}
|
||||||
return description
|
lines = append(lines, e.fileList...)
|
||||||
|
|
||||||
|
return strings.Join(lines, "\n\t")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *EmbeddedFileSource) populateFileList() {
|
||||||
|
fs.WalkDir(e.EmbeddedFS, ".", func(path string, d fs.DirEntry, err error) error {
|
||||||
|
if !d.IsDir() {
|
||||||
|
e.fileList = append(e.fileList, filepath.Join(e.Root, path))
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
63
test/e2e/framework/testfiles/testfiles_test.go
Normal file
63
test/e2e/framework/testfiles/testfiles_test.go
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2021 The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package testfiles
|
||||||
|
|
||||||
|
import (
|
||||||
|
"embed"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
fooContents = `Hello World
|
||||||
|
`
|
||||||
|
fooPath = "testdata/a/foo.txt"
|
||||||
|
|
||||||
|
notExistsPath = "testdata/b"
|
||||||
|
|
||||||
|
expectedDescription = `The following files are embedded into the test executable:
|
||||||
|
testdata/a/foo.txt`
|
||||||
|
)
|
||||||
|
|
||||||
|
//go:embed testdata/a
|
||||||
|
var testFS embed.FS
|
||||||
|
|
||||||
|
func getTestEmbeddedSource() *EmbeddedFileSource {
|
||||||
|
return &EmbeddedFileSource{
|
||||||
|
EmbeddedFS: testFS,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestEmbeddedFileSource(t *testing.T) {
|
||||||
|
s := getTestEmbeddedSource()
|
||||||
|
|
||||||
|
// read a file which exists and compare the contents
|
||||||
|
b, err := s.ReadTestFile(fooPath)
|
||||||
|
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Equal(t, fooContents, string(b))
|
||||||
|
|
||||||
|
// read a non-existent file and ensure that the returned value is empty and error is nil
|
||||||
|
// Note: this is done so that the next file source can be tried by the caller
|
||||||
|
b, err = s.ReadTestFile(notExistsPath)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Empty(t, b)
|
||||||
|
|
||||||
|
// describing the test filesystem should list down all files
|
||||||
|
assert.Equal(t, expectedDescription, s.DescribeFiles())
|
||||||
|
}
|
@ -1,34 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2016 The Kubernetes Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package generated
|
|
||||||
|
|
||||||
import "k8s.io/klog/v2"
|
|
||||||
|
|
||||||
/*
|
|
||||||
ReadOrDie reads a file from gobindata.
|
|
||||||
Relies heavily on the successful generation of build artifacts as per the go:generate directives above.
|
|
||||||
*/
|
|
||||||
func ReadOrDie(filePath string) []byte {
|
|
||||||
|
|
||||||
fileBytes, err := Asset(filePath)
|
|
||||||
if err != nil {
|
|
||||||
gobindataMsg := "An error occurred, possibly gobindata doesn't know about the file you're opening. For questions on maintaining gobindata, contact the sig-testing group."
|
|
||||||
klog.Infof("Available gobindata files: %v ", AssetNames())
|
|
||||||
klog.Fatalf("Failed opening %v , with error %v. %v.", filePath, err, gobindataMsg)
|
|
||||||
}
|
|
||||||
return fileBytes
|
|
||||||
}
|
|
22
test/e2e/testing-manifests/README.md
Normal file
22
test/e2e/testing-manifests/README.md
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
# test/e2e/testing-manifests
|
||||||
|
|
||||||
|
## Embedded Test Data
|
||||||
|
|
||||||
|
In case one needs to use any test fixture inside your tests and those are defined inside this directory, they need to be added to the `//go:embed` directive in `embed.go`.
|
||||||
|
|
||||||
|
For example, if one wants to include this Readme as a test fixture (potential bad idea in reality!),
|
||||||
|
|
||||||
|
```
|
||||||
|
// embed.go
|
||||||
|
|
||||||
|
...
|
||||||
|
//go:embed some other files README.md
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
This fixture can be accessed in the e2e tests using `test/e2e/framework/testfiles.Read` like
|
||||||
|
`testfiles.Read("test/e2e/testing-manifests/README.md)`.
|
||||||
|
|
||||||
|
This is needed since [migrating to //go:embed from go-bindata][1].
|
||||||
|
|
||||||
|
[1]: https://github.com/kubernetes/kubernetes/pull/99829
|
33
test/e2e/testing-manifests/embed.go
Normal file
33
test/e2e/testing-manifests/embed.go
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2021 The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package testing_manifests
|
||||||
|
|
||||||
|
import (
|
||||||
|
"embed"
|
||||||
|
|
||||||
|
e2etestfiles "k8s.io/kubernetes/test/e2e/framework/testfiles"
|
||||||
|
)
|
||||||
|
|
||||||
|
//go:embed flexvolume guestbook kubectl sample-device-plugin.yaml scheduling/nvidia-driver-installer.yaml statefulset storage-csi
|
||||||
|
var e2eTestingManifestsFS embed.FS
|
||||||
|
|
||||||
|
func GetE2ETestingManifestsFS() e2etestfiles.EmbeddedFileSource {
|
||||||
|
return e2etestfiles.EmbeddedFileSource{
|
||||||
|
EmbeddedFS: e2eTestingManifestsFS,
|
||||||
|
Root: "test/e2e/testing-manifests",
|
||||||
|
}
|
||||||
|
}
|
@ -27,6 +27,7 @@ import (
|
|||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
@ -44,8 +45,8 @@ import (
|
|||||||
"k8s.io/kubernetes/test/e2e/framework"
|
"k8s.io/kubernetes/test/e2e/framework"
|
||||||
e2econfig "k8s.io/kubernetes/test/e2e/framework/config"
|
e2econfig "k8s.io/kubernetes/test/e2e/framework/config"
|
||||||
e2etestfiles "k8s.io/kubernetes/test/e2e/framework/testfiles"
|
e2etestfiles "k8s.io/kubernetes/test/e2e/framework/testfiles"
|
||||||
"k8s.io/kubernetes/test/e2e/generated"
|
|
||||||
"k8s.io/kubernetes/test/e2e_node/services"
|
"k8s.io/kubernetes/test/e2e_node/services"
|
||||||
|
e2enodetestingmanifests "k8s.io/kubernetes/test/e2e_node/testing-manifests"
|
||||||
system "k8s.io/system-validators/validators"
|
system "k8s.io/system-validators/validators"
|
||||||
|
|
||||||
"github.com/onsi/ginkgo"
|
"github.com/onsi/ginkgo"
|
||||||
@ -90,12 +91,8 @@ func registerNodeFlags(flags *flag.FlagSet) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
// Enable bindata file lookup as fallback.
|
// Enable embedded FS file lookup as fallback
|
||||||
e2etestfiles.AddFileSource(e2etestfiles.BindataFileSource{
|
e2etestfiles.AddFileSource(e2enodetestingmanifests.GetE2ENodeTestingManifestsFS())
|
||||||
Asset: generated.Asset,
|
|
||||||
AssetNames: generated.AssetNames,
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
||||||
|
33
test/e2e_node/testing-manifests/embed.go
Normal file
33
test/e2e_node/testing-manifests/embed.go
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2021 The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package testing_manifests
|
||||||
|
|
||||||
|
import (
|
||||||
|
"embed"
|
||||||
|
|
||||||
|
e2etestfiles "k8s.io/kubernetes/test/e2e/framework/testfiles"
|
||||||
|
)
|
||||||
|
|
||||||
|
//go:embed *.yaml
|
||||||
|
var e2eNodeTestingManifestsFS embed.FS
|
||||||
|
|
||||||
|
func GetE2ENodeTestingManifestsFS() e2etestfiles.EmbeddedFileSource {
|
||||||
|
return e2etestfiles.EmbeddedFileSource{
|
||||||
|
EmbeddedFS: e2eNodeTestingManifestsFS,
|
||||||
|
Root: "test/e2e_node/testing-manifests",
|
||||||
|
}
|
||||||
|
}
|
22
test/fixtures/README.md
vendored
Normal file
22
test/fixtures/README.md
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
# test/fixtures
|
||||||
|
|
||||||
|
## Embedded Test Data
|
||||||
|
|
||||||
|
In case one needs to use any test fixture inside your tests and those are defined inside this directory, they need to be added to the `//go:embed` directive in `embed.go`.
|
||||||
|
|
||||||
|
For example, if one wants to include this Readme as a test fixture (potential bad idea in reality!),
|
||||||
|
|
||||||
|
```
|
||||||
|
// embed.go
|
||||||
|
|
||||||
|
...
|
||||||
|
//go:embed some other files README.md
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
This fixture can be accessed in the e2e tests using `test/e2e/framework/testfiles.Read` like
|
||||||
|
`testfiles.Read("test/fixtures/README.md)`.
|
||||||
|
|
||||||
|
This is needed since [migrating to //go:embed from go-bindata][1].
|
||||||
|
|
||||||
|
[1]: https://github.com/kubernetes/kubernetes/pull/99829
|
33
test/fixtures/embed.go
vendored
Normal file
33
test/fixtures/embed.go
vendored
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2021 The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package fixtures
|
||||||
|
|
||||||
|
import (
|
||||||
|
"embed"
|
||||||
|
|
||||||
|
"k8s.io/kubernetes/test/e2e/framework/testfiles"
|
||||||
|
)
|
||||||
|
|
||||||
|
//go:embed doc-yaml/user-guide/liveness doc-yaml/user-guide/secrets doc-yaml/user-guide/downward-api doc-yaml/user-guide/update-demo
|
||||||
|
var testFixturesFS embed.FS
|
||||||
|
|
||||||
|
func GetTestFixturesFS() testfiles.EmbeddedFileSource {
|
||||||
|
return testfiles.EmbeddedFileSource{
|
||||||
|
EmbeddedFS: testFixturesFS,
|
||||||
|
Root: "test/fixtures",
|
||||||
|
}
|
||||||
|
}
|
16
vendor/github.com/go-bindata/go-bindata/.gitignore
generated
vendored
16
vendor/github.com/go-bindata/go-bindata/.gitignore
generated
vendored
@ -1,16 +0,0 @@
|
|||||||
# Binaries for programs and plugins
|
|
||||||
*.exe
|
|
||||||
*.exe~
|
|
||||||
*.dll
|
|
||||||
*.so
|
|
||||||
*.dylib
|
|
||||||
|
|
||||||
# Test binary, build with `go test -c`
|
|
||||||
*.test
|
|
||||||
|
|
||||||
# Output of the go coverage tool, specifically when used with LiteIDE
|
|
||||||
*.out
|
|
||||||
|
|
||||||
# Goland project files
|
|
||||||
.idea/
|
|
||||||
*.iml
|
|
79
vendor/github.com/go-bindata/go-bindata/CONTRIBUTING.md
generated
vendored
79
vendor/github.com/go-bindata/go-bindata/CONTRIBUTING.md
generated
vendored
@ -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.
|
|
||||||
|
|
||||||
|
|
3
vendor/github.com/go-bindata/go-bindata/LICENSE
generated
vendored
3
vendor/github.com/go-bindata/go-bindata/LICENSE
generated
vendored
@ -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
|
|
2
vendor/github.com/go-bindata/go-bindata/Makefile
generated
vendored
2
vendor/github.com/go-bindata/go-bindata/Makefile
generated
vendored
@ -1,2 +0,0 @@
|
|||||||
all:
|
|
||||||
make -C testdata
|
|
191
vendor/github.com/go-bindata/go-bindata/README.md
generated
vendored
191
vendor/github.com/go-bindata/go-bindata/README.md
generated
vendored
@ -1,191 +0,0 @@
|
|||||||
## bindata
|
|
||||||
|
|
||||||
[](https://goreportcard.com/report/github.com/go-bindata/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 -u github.com/go-bindata/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`.
|
|
||||||
|
|
12
vendor/github.com/go-bindata/go-bindata/asset.go
generated
vendored
12
vendor/github.com/go-bindata/go-bindata/asset.go
generated
vendored
@ -1,12 +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.
|
|
||||||
}
|
|
44
vendor/github.com/go-bindata/go-bindata/bytewriter.go
generated
vendored
44
vendor/github.com/go-bindata/go-bindata/bytewriter.go
generated
vendored
@ -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
|
|
||||||
}
|
|
208
vendor/github.com/go-bindata/go-bindata/config.go
generated
vendored
208
vendor/github.com/go-bindata/go-bindata/config.go
generated
vendored
@ -1,208 +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
|
|
||||||
|
|
||||||
// HttpFileSystem means whether generate return http.FileSystem interface
|
|
||||||
// instance's function.When true,will generate relate code.
|
|
||||||
HttpFileSystem 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
|
|
||||||
|
|
||||||
// Perform a dev build, which is nearly identical to the debug option. The
|
|
||||||
// only difference is that instead of absolute file paths in generated code,
|
|
||||||
// it expects a variable, `rootDir`, to be set in the generated code's
|
|
||||||
// package (the author needs to do this manually), which it then prepends to
|
|
||||||
// an asset's name to construct the file path on disk.
|
|
||||||
//
|
|
||||||
// This is mainly so you can push the generated code file to a shared
|
|
||||||
// repository.
|
|
||||||
Dev bool
|
|
||||||
|
|
||||||
// When true, size, mode and modtime are not preserved from files
|
|
||||||
NoMetadata bool
|
|
||||||
// When nonzero, use this as mode for all files.
|
|
||||||
Mode uint
|
|
||||||
// When nonzero, use this as unix timestamp for all files.
|
|
||||||
ModTime int64
|
|
||||||
|
|
||||||
// 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.HttpFileSystem = false
|
|
||||||
c.Debug = 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
|
|
||||||
}
|
|
261
vendor/github.com/go-bindata/go-bindata/convert.go
generated
vendored
261
vendor/github.com/go-bindata/go-bindata/convert.go
generated
vendored
@ -1,261 +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
|
|
||||||
}
|
|
||||||
|
|
||||||
var knownFuncs = make(map[string]int)
|
|
||||||
var visitedPaths = make(map[string]bool)
|
|
||||||
// Locate all the assets.
|
|
||||||
for _, input := range c.Input {
|
|
||||||
err = findFiles(input.Path, c.Prefix, input.Recursive, &toc, c.Ignore, knownFuncs, visitedPaths)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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 the header. This makes e.g. Github ignore diffs in generated files.
|
|
||||||
if _, err = fmt.Fprintf(bfd, "// Package %s Code generated by go-bindata. (@generated) DO NOT EDIT.\n", c.Package); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if _, err = fmt.Fprint(bfd, "// sources:\n"); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
wd, err := os.Getwd()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, asset := range toc {
|
|
||||||
relative, _ := filepath.Rel(wd, asset.Path)
|
|
||||||
if _, err = fmt.Fprintf(bfd, "// %s\n", filepath.ToSlash(relative)); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//if _, err = fmt.Fprint(bfd, "// DO NOT EDIT!\n\n"); err != nil {
|
|
||||||
// return err
|
|
||||||
//}
|
|
||||||
|
|
||||||
// Write build tags, if applicable.
|
|
||||||
if len(c.Tags) > 0 {
|
|
||||||
if _, err = fmt.Fprintf(bfd, "// +build %s\n\n", c.Tags); 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 || c.Dev {
|
|
||||||
err = writeDebug(bfd, c, 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
|
|
||||||
if err := writeTOCTree(bfd, toc); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write restore procedure
|
|
||||||
return writeRestore(bfd)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ByName implements sort.Interface for []os.FileInfo based on Name()
|
|
||||||
type ByName []os.FileInfo
|
|
||||||
|
|
||||||
func (v ByName) Len() int { return len(v) }
|
|
||||||
func (v ByName) Swap(i, j int) { v[i], v[j] = v[j], v[i] }
|
|
||||||
func (v ByName) Less(i, j int) bool { return v[i].Name() < v[j].Name() }
|
|
||||||
|
|
||||||
// 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, knownFuncs map[string]int, visitedPaths map[string]bool) error {
|
|
||||||
dirpath := dir
|
|
||||||
if len(prefix) > 0 {
|
|
||||||
dirpath, _ = filepath.Abs(dirpath)
|
|
||||||
prefix, _ = filepath.Abs(prefix)
|
|
||||||
prefix = filepath.ToSlash(prefix)
|
|
||||||
}
|
|
||||||
|
|
||||||
fi, err := os.Stat(dirpath)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
var list []os.FileInfo
|
|
||||||
|
|
||||||
if !fi.IsDir() {
|
|
||||||
dirpath = filepath.Dir(dirpath)
|
|
||||||
list = []os.FileInfo{fi}
|
|
||||||
} else {
|
|
||||||
visitedPaths[dirpath] = true
|
|
||||||
fd, err := os.Open(dirpath)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
defer fd.Close()
|
|
||||||
|
|
||||||
list, err = fd.Readdir(0)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sort to make output stable between invocations
|
|
||||||
sort.Sort(ByName(list))
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, file := range list {
|
|
||||||
var asset Asset
|
|
||||||
asset.Path = filepath.Join(dirpath, 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 {
|
|
||||||
recursivePath := filepath.Join(dir, file.Name())
|
|
||||||
visitedPaths[asset.Path] = true
|
|
||||||
findFiles(recursivePath, prefix, recursive, toc, ignore, knownFuncs, visitedPaths)
|
|
||||||
}
|
|
||||||
continue
|
|
||||||
} else if file.Mode()&os.ModeSymlink == os.ModeSymlink {
|
|
||||||
var linkPath string
|
|
||||||
if linkPath, err = os.Readlink(asset.Path); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if !filepath.IsAbs(linkPath) {
|
|
||||||
if linkPath, err = filepath.Abs(dirpath + "/" + linkPath); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if _, ok := visitedPaths[linkPath]; !ok {
|
|
||||||
visitedPaths[linkPath] = true
|
|
||||||
findFiles(asset.Path, prefix, recursive, toc, ignore, knownFuncs, visitedPaths)
|
|
||||||
}
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
if strings.HasPrefix(asset.Name, prefix) {
|
|
||||||
asset.Name = asset.Name[len(prefix):]
|
|
||||||
} else {
|
|
||||||
asset.Name = filepath.Join(dir, file.Name())
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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 {
|
|
||||||
var inBytes, outBytes []byte
|
|
||||||
var toUpper bool
|
|
||||||
|
|
||||||
name = strings.ToLower(name)
|
|
||||||
inBytes = []byte(name)
|
|
||||||
|
|
||||||
for i := 0; i < len(inBytes); i++ {
|
|
||||||
if regFuncName.Match([]byte{inBytes[i]}) {
|
|
||||||
toUpper = true
|
|
||||||
} else if toUpper {
|
|
||||||
outBytes = append(outBytes, []byte(strings.ToUpper(string(inBytes[i])))...)
|
|
||||||
toUpper = false
|
|
||||||
} else {
|
|
||||||
outBytes = append(outBytes, inBytes[i])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
name = string(outBytes)
|
|
||||||
|
|
||||||
// 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
|
|
||||||
}
|
|
108
vendor/github.com/go-bindata/go-bindata/debug.go
generated
vendored
108
vendor/github.com/go-bindata/go-bindata/debug.go
generated
vendored
@ -1,108 +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, c *Config, toc []Asset) error {
|
|
||||||
err := writeDebugHeader(w, c)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = writeAssetFS(w, c)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
for i := range toc {
|
|
||||||
err = writeDebugAsset(w, c, &toc[i])
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// writeDebugHeader writes output file headers.
|
|
||||||
// This targets debug builds.
|
|
||||||
func writeDebugHeader(w io.Writer, c *Config) error {
|
|
||||||
var header string
|
|
||||||
|
|
||||||
if c.HttpFileSystem {
|
|
||||||
header = `import (
|
|
||||||
"bytes"
|
|
||||||
"net/http"
|
|
||||||
"fmt"
|
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"strings"
|
|
||||||
"time"`
|
|
||||||
} else {
|
|
||||||
header = `import (
|
|
||||||
"fmt"
|
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"strings"`
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err := fmt.Fprintf(w, `%s
|
|
||||||
)
|
|
||||||
|
|
||||||
// bindataRead reads the given file from disk. It returns an error on failure.
|
|
||||||
func bindataRead(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
|
|
||||||
}
|
|
||||||
|
|
||||||
type asset struct {
|
|
||||||
bytes []byte
|
|
||||||
info os.FileInfo
|
|
||||||
}
|
|
||||||
|
|
||||||
`, header)
|
|
||||||
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, c *Config, asset *Asset) error {
|
|
||||||
pathExpr := fmt.Sprintf("%q", asset.Path)
|
|
||||||
if c.Dev {
|
|
||||||
pathExpr = fmt.Sprintf("filepath.Join(rootDir, %q)", asset.Name)
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err := fmt.Fprintf(w, `// %s reads file data from disk. It returns an error on failure.
|
|
||||||
func %s() (*asset, error) {
|
|
||||||
path := %s
|
|
||||||
name := %q
|
|
||||||
bytes, err := bindataRead(path, name)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
fi, err := os.Stat(path)
|
|
||||||
if err != nil {
|
|
||||||
err = fmt.Errorf("Error reading asset info %%s at %%s: %%v", name, path, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
a := &asset{bytes: bytes, info: fi}
|
|
||||||
return a, err
|
|
||||||
}
|
|
||||||
|
|
||||||
`, asset.Func, asset.Func, pathExpr, asset.Name)
|
|
||||||
return err
|
|
||||||
}
|
|
129
vendor/github.com/go-bindata/go-bindata/doc.go
generated
vendored
129
vendor/github.com/go-bindata/go-bindata/doc.go
generated
vendored
@ -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
|
|
102
vendor/github.com/go-bindata/go-bindata/file.go
generated
vendored
102
vendor/github.com/go-bindata/go-bindata/file.go
generated
vendored
@ -1,102 +0,0 @@
|
|||||||
package bindata
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"io"
|
|
||||||
)
|
|
||||||
|
|
||||||
func writeAssetFS(w io.Writer, c *Config) error {
|
|
||||||
if !c.HttpFileSystem {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err := fmt.Fprintf(w, `
|
|
||||||
type assetFile struct {
|
|
||||||
*bytes.Reader
|
|
||||||
name string
|
|
||||||
childInfos []os.FileInfo
|
|
||||||
childInfoOffset int
|
|
||||||
}
|
|
||||||
|
|
||||||
type assetOperator struct{}
|
|
||||||
|
|
||||||
// Open implement http.FileSystem interface
|
|
||||||
func (f *assetOperator) Open(name string) (http.File, error) {
|
|
||||||
var err error
|
|
||||||
if len(name) > 0 && name[0] == '/' {
|
|
||||||
name = name[1:]
|
|
||||||
}
|
|
||||||
content, err := Asset(name)
|
|
||||||
if err == nil {
|
|
||||||
return &assetFile{name: name, Reader: bytes.NewReader(content)}, nil
|
|
||||||
}
|
|
||||||
children, err := AssetDir(name)
|
|
||||||
if err == nil {
|
|
||||||
childInfos := make([]os.FileInfo, 0, len(children))
|
|
||||||
for _, child := range children {
|
|
||||||
childPath := filepath.Join(name, child)
|
|
||||||
info, errInfo := AssetInfo(filepath.Join(name, child))
|
|
||||||
if errInfo == nil {
|
|
||||||
childInfos = append(childInfos, info)
|
|
||||||
} else {
|
|
||||||
childInfos = append(childInfos, newDirFileInfo(childPath))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return &assetFile{name: name, childInfos: childInfos}, nil
|
|
||||||
} else {
|
|
||||||
// If the error is not found, return an error that will
|
|
||||||
// result in a 404 error. Otherwise the server returns
|
|
||||||
// a 500 error for files not found.
|
|
||||||
if strings.Contains(err.Error(), "not found") {
|
|
||||||
return nil, os.ErrNotExist
|
|
||||||
}
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Close no need do anything
|
|
||||||
func (f *assetFile) Close() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Readdir read dir's children file info
|
|
||||||
func (f *assetFile) Readdir(count int) ([]os.FileInfo, error) {
|
|
||||||
if len(f.childInfos) == 0 {
|
|
||||||
return nil, os.ErrNotExist
|
|
||||||
}
|
|
||||||
if count <= 0 {
|
|
||||||
return f.childInfos, nil
|
|
||||||
}
|
|
||||||
if f.childInfoOffset+count > len(f.childInfos) {
|
|
||||||
count = len(f.childInfos) - f.childInfoOffset
|
|
||||||
}
|
|
||||||
offset := f.childInfoOffset
|
|
||||||
f.childInfoOffset += count
|
|
||||||
return f.childInfos[offset : offset+count], nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stat read file info from asset item
|
|
||||||
func (f *assetFile) Stat() (os.FileInfo, error) {
|
|
||||||
if len(f.childInfos) != 0 {
|
|
||||||
return newDirFileInfo(f.name), nil
|
|
||||||
}
|
|
||||||
return AssetInfo(f.name)
|
|
||||||
}
|
|
||||||
|
|
||||||
// newDirFileInfo return default dir file info
|
|
||||||
func newDirFileInfo(name string) os.FileInfo {
|
|
||||||
return &bindataFileInfo{
|
|
||||||
name: name,
|
|
||||||
size: 0,
|
|
||||||
mode: os.FileMode(2147484068), // equal os.FileMode(0644)|os.ModeDir
|
|
||||||
modTime: time.Time{}}
|
|
||||||
}
|
|
||||||
|
|
||||||
// AssetFile return a http.FileSystem instance that data backend by asset
|
|
||||||
func AssetFile() http.FileSystem {
|
|
||||||
return &assetOperator{}
|
|
||||||
}
|
|
||||||
|
|
||||||
`)
|
|
||||||
return err
|
|
||||||
}
|
|
1
vendor/github.com/go-bindata/go-bindata/go-bindata/.gitignore
generated
vendored
1
vendor/github.com/go-bindata/go-bindata/go-bindata/.gitignore
generated
vendored
@ -1 +0,0 @@
|
|||||||
go-bindata
|
|
22
vendor/github.com/go-bindata/go-bindata/go-bindata/AppendSliceValue.go
generated
vendored
22
vendor/github.com/go-bindata/go-bindata/go-bindata/AppendSliceValue.go
generated
vendored
@ -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
|
|
||||||
}
|
|
108
vendor/github.com/go-bindata/go-bindata/go-bindata/main.go
generated
vendored
108
vendor/github.com/go-bindata/go-bindata/go-bindata/main.go
generated
vendored
@ -1,108 +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"
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"regexp"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/go-bindata/go-bindata"
|
|
||||||
)
|
|
||||||
|
|
||||||
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] <input directories>\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.BoolVar(&c.Dev, "dev", c.Dev, "Similar to debug, but does not emit absolute paths. Expects a rootDir variable to already exist in the generated code's package.")
|
|
||||||
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.BoolVar(&c.NoMetadata, "nometadata", c.NoMetadata, "Assets will not preserve size, mode, and modtime info.")
|
|
||||||
flag.BoolVar(&c.HttpFileSystem, "fs", c.HttpFileSystem, "Whether generate instance http.FileSystem interface code.")
|
|
||||||
flag.UintVar(&c.Mode, "mode", c.Mode, "Optional file mode override for all files.")
|
|
||||||
flag.Int64Var(&c.ModTime, "modtime", c.ModTime, "Optional modification unix timestamp override for all files.")
|
|
||||||
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 <input dir>\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,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
31
vendor/github.com/go-bindata/go-bindata/go-bindata/version.go
generated
vendored
31
vendor/github.com/go-bindata/go-bindata/go-bindata/version.go
generated
vendored
@ -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 = "1"
|
|
||||||
}
|
|
||||||
|
|
||||||
return fmt.Sprintf("%s %d.%d.%s (Go runtime %s).\nCopyright (c) 2010-2013, Jim Teeuwen.",
|
|
||||||
AppName, AppVersionMajor, AppVersionMinor, AppVersionRev, runtime.Version())
|
|
||||||
}
|
|
473
vendor/github.com/go-bindata/go-bindata/release.go
generated
vendored
473
vendor/github.com/go-bindata/go-bindata/release.go
generated
vendored
@ -1,473 +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
|
|
||||||
}
|
|
||||||
|
|
||||||
err = writeAssetFS(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 {
|
|
||||||
var err error
|
|
||||||
if c.NoCompress {
|
|
||||||
if c.NoMemCopy {
|
|
||||||
err = header_uncompressed_nomemcopy(w, c)
|
|
||||||
} else {
|
|
||||||
err = header_uncompressed_memcopy(w, c)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if c.NoMemCopy {
|
|
||||||
err = header_compressed_nomemcopy(w, c)
|
|
||||||
} else {
|
|
||||||
err = header_compressed_memcopy(w, c)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return header_release_common(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 {
|
|
||||||
err = uncompressed_nomemcopy(w, asset, fd)
|
|
||||||
} else {
|
|
||||||
err = uncompressed_memcopy(w, asset, fd)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if c.NoMemCopy {
|
|
||||||
err = compressed_nomemcopy(w, asset, fd)
|
|
||||||
} else {
|
|
||||||
err = compressed_memcopy(w, asset, fd)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return asset_release_common(w, c, asset)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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, c *Config) error {
|
|
||||||
var header string
|
|
||||||
|
|
||||||
if c.HttpFileSystem {
|
|
||||||
header = `import (
|
|
||||||
"bytes"
|
|
||||||
"compress/gzip"
|
|
||||||
"fmt"
|
|
||||||
"net/http"
|
|
||||||
"io"
|
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"strings"
|
|
||||||
"time"`
|
|
||||||
} else {
|
|
||||||
header = `import (
|
|
||||||
"bytes"
|
|
||||||
"compress/gzip"
|
|
||||||
"fmt"
|
|
||||||
"io"
|
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"strings"
|
|
||||||
"time"`
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err := fmt.Fprintf(w, `%s
|
|
||||||
)
|
|
||||||
|
|
||||||
func bindataRead(data, name string) ([]byte, error) {
|
|
||||||
gz, err := gzip.NewReader(strings.NewReader(data))
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("Read %%q: %%v", name, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
var buf bytes.Buffer
|
|
||||||
_, err = io.Copy(&buf, gz)
|
|
||||||
clErr := gz.Close()
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("Read %%q: %%v", name, err)
|
|
||||||
}
|
|
||||||
if clErr != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return buf.Bytes(), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
`, header)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
func header_compressed_memcopy(w io.Writer, c *Config) error {
|
|
||||||
var header string
|
|
||||||
|
|
||||||
if c.HttpFileSystem {
|
|
||||||
header = `import (
|
|
||||||
"bytes"
|
|
||||||
"compress/gzip"
|
|
||||||
"fmt"
|
|
||||||
"net/http"
|
|
||||||
"io"
|
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"strings"
|
|
||||||
"time"`
|
|
||||||
} else {
|
|
||||||
header = `import (
|
|
||||||
"bytes"
|
|
||||||
"compress/gzip"
|
|
||||||
"fmt"
|
|
||||||
"io"
|
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"strings"
|
|
||||||
"time"`
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err := fmt.Fprintf(w, `%s
|
|
||||||
)
|
|
||||||
|
|
||||||
func bindataRead(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)
|
|
||||||
clErr := gz.Close()
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("Read %%q: %%v", name, err)
|
|
||||||
}
|
|
||||||
if clErr != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return buf.Bytes(), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
`, header)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
func header_uncompressed_nomemcopy(w io.Writer, c *Config) error {
|
|
||||||
var header string
|
|
||||||
|
|
||||||
if c.HttpFileSystem {
|
|
||||||
header = `import (
|
|
||||||
"bytes"
|
|
||||||
"fmt"
|
|
||||||
"net/http"
|
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"reflect"
|
|
||||||
"strings"
|
|
||||||
"time"
|
|
||||||
"unsafe"`
|
|
||||||
} else {
|
|
||||||
header = `import (
|
|
||||||
"fmt"
|
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"reflect"
|
|
||||||
"strings"
|
|
||||||
"time"
|
|
||||||
"unsafe"`
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err := fmt.Fprintf(w, `%s
|
|
||||||
)
|
|
||||||
|
|
||||||
func bindataRead(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
|
|
||||||
}
|
|
||||||
|
|
||||||
`, header)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
func header_uncompressed_memcopy(w io.Writer, c *Config) error {
|
|
||||||
var header string
|
|
||||||
|
|
||||||
if c.HttpFileSystem {
|
|
||||||
header = `import (
|
|
||||||
"bytes"
|
|
||||||
"fmt"
|
|
||||||
"net/http"
|
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"strings"
|
|
||||||
"time"`
|
|
||||||
} else {
|
|
||||||
header = `import (
|
|
||||||
"fmt"
|
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"strings"
|
|
||||||
"time"`
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err := fmt.Fprintf(w, `%s
|
|
||||||
)
|
|
||||||
`, header)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
func header_release_common(w io.Writer) error {
|
|
||||||
_, err := fmt.Fprintf(w, `type asset struct {
|
|
||||||
bytes []byte
|
|
||||||
info os.FileInfo
|
|
||||||
}
|
|
||||||
|
|
||||||
type bindataFileInfo struct {
|
|
||||||
name string
|
|
||||||
size int64
|
|
||||||
mode os.FileMode
|
|
||||||
modTime time.Time
|
|
||||||
}
|
|
||||||
|
|
||||||
// Name return file name
|
|
||||||
func (fi bindataFileInfo) Name() string {
|
|
||||||
return fi.name
|
|
||||||
}
|
|
||||||
|
|
||||||
// Size return file size
|
|
||||||
func (fi bindataFileInfo) Size() int64 {
|
|
||||||
return fi.size
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mode return file mode
|
|
||||||
func (fi bindataFileInfo) Mode() os.FileMode {
|
|
||||||
return fi.mode
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mode return file modify time
|
|
||||||
func (fi bindataFileInfo) ModTime() time.Time {
|
|
||||||
return fi.modTime
|
|
||||||
}
|
|
||||||
|
|
||||||
// IsDir return file whether a directory
|
|
||||||
func (fi bindataFileInfo) IsDir() bool {
|
|
||||||
return fi.mode&os.ModeDir != 0
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sys return file is sys mode
|
|
||||||
func (fi bindataFileInfo) Sys() interface{} {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
`)
|
|
||||||
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 %sBytes() ([]byte, error) {
|
|
||||||
return bindataRead(
|
|
||||||
_%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 %sBytes() ([]byte, error) {
|
|
||||||
return bindataRead(
|
|
||||||
_%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 %sBytes() ([]byte, error) {
|
|
||||||
return bindataRead(
|
|
||||||
_%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) && !bytes.Contains(b, []byte{0}) {
|
|
||||||
fmt.Fprintf(w, "`%s`", sanitize(b))
|
|
||||||
} else {
|
|
||||||
fmt.Fprintf(w, "%+q", b)
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = fmt.Fprintf(w, `)
|
|
||||||
|
|
||||||
func %sBytes() ([]byte, error) {
|
|
||||||
return _%s, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
`, asset.Func, asset.Func)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
func asset_release_common(w io.Writer, c *Config, asset *Asset) error {
|
|
||||||
fi, err := os.Stat(asset.Path)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
mode := uint(fi.Mode())
|
|
||||||
modTime := fi.ModTime().Unix()
|
|
||||||
size := fi.Size()
|
|
||||||
if c.NoMetadata {
|
|
||||||
mode = 0
|
|
||||||
modTime = 0
|
|
||||||
size = 0
|
|
||||||
}
|
|
||||||
if c.Mode > 0 {
|
|
||||||
mode = uint(os.ModePerm) & c.Mode
|
|
||||||
}
|
|
||||||
if c.ModTime > 0 {
|
|
||||||
modTime = c.ModTime
|
|
||||||
}
|
|
||||||
_, err = fmt.Fprintf(w, `func %s() (*asset, error) {
|
|
||||||
bytes, err := %sBytes()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
info := bindataFileInfo{name: %q, size: %d, mode: os.FileMode(%d), modTime: time.Unix(%d, 0)}
|
|
||||||
a := &asset{bytes: bytes, info: info}
|
|
||||||
return a, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
`, asset.Func, asset.Func, asset.Name, size, mode, modTime)
|
|
||||||
return err
|
|
||||||
}
|
|
62
vendor/github.com/go-bindata/go-bindata/restore.go
generated
vendored
62
vendor/github.com/go-bindata/go-bindata/restore.go
generated
vendored
@ -1,62 +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"
|
|
||||||
)
|
|
||||||
|
|
||||||
func writeRestore(w io.Writer) error {
|
|
||||||
_, err := fmt.Fprintf(w, `
|
|
||||||
// RestoreAsset restores an asset under the given directory
|
|
||||||
func RestoreAsset(dir, name string) error {
|
|
||||||
data, err := Asset(name)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
info, err := AssetInfo(name)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755))
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode())
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// RestoreAssets restores an asset under the given directory recursively
|
|
||||||
func RestoreAssets(dir, name string) error {
|
|
||||||
children, err := AssetDir(name)
|
|
||||||
// File
|
|
||||||
if err != nil {
|
|
||||||
return RestoreAsset(dir, name)
|
|
||||||
}
|
|
||||||
// Dir
|
|
||||||
for _, child := range children {
|
|
||||||
err = RestoreAssets(dir, filepath.Join(name, child))
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func _filePath(dir, name string) string {
|
|
||||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
|
||||||
return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
|
|
||||||
}
|
|
||||||
`)
|
|
||||||
return err
|
|
||||||
}
|
|
36
vendor/github.com/go-bindata/go-bindata/stringwriter.go
generated
vendored
36
vendor/github.com/go-bindata/go-bindata/stringwriter.go
generated
vendored
@ -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
|
|
||||||
}
|
|
288
vendor/github.com/go-bindata/go-bindata/toc.go
generated
vendored
288
vendor/github.com/go-bindata/go-bindata/toc.go
generated
vendored
@ -1,288 +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"
|
|
||||||
"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 getFillerSize(tokenIndex int, lengths []int, nident int) int {
|
|
||||||
var (
|
|
||||||
curlen int = lengths[tokenIndex]
|
|
||||||
maxlen int = 0
|
|
||||||
substart int = 0
|
|
||||||
subend int = 0
|
|
||||||
spacediff int = 0
|
|
||||||
)
|
|
||||||
|
|
||||||
if curlen > 0 {
|
|
||||||
substart = tokenIndex
|
|
||||||
for (substart-1) >= 0 && lengths[substart-1] > 0 {
|
|
||||||
substart -= 1
|
|
||||||
}
|
|
||||||
|
|
||||||
subend = tokenIndex
|
|
||||||
for (subend+1) < len(lengths) && lengths[subend+1] > 0 {
|
|
||||||
subend += 1
|
|
||||||
}
|
|
||||||
|
|
||||||
var candidate int
|
|
||||||
for j := substart; j <= subend; j += 1 {
|
|
||||||
candidate = lengths[j]
|
|
||||||
if candidate > maxlen {
|
|
||||||
maxlen = candidate
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
spacediff = maxlen - curlen
|
|
||||||
}
|
|
||||||
|
|
||||||
return spacediff
|
|
||||||
}
|
|
||||||
|
|
||||||
func (root *assetTree) writeGoMap(w io.Writer, nident int) {
|
|
||||||
fmt.Fprintf(w, "&bintree{%s, map[string]*bintree{", root.funcOrNil())
|
|
||||||
|
|
||||||
if len(root.Children) > 0 {
|
|
||||||
io.WriteString(w, "\n")
|
|
||||||
|
|
||||||
// Sort to make output stable between invocations
|
|
||||||
filenames := make([]string, len(root.Children))
|
|
||||||
hasChildren := make(map[string]bool)
|
|
||||||
i := 0
|
|
||||||
for filename, node := range root.Children {
|
|
||||||
filenames[i] = filename
|
|
||||||
hasChildren[filename] = len(node.Children) > 0
|
|
||||||
i++
|
|
||||||
}
|
|
||||||
sort.Strings(filenames)
|
|
||||||
|
|
||||||
lengths := make([]int, len(root.Children))
|
|
||||||
for i, filename := range filenames {
|
|
||||||
if hasChildren[filename] {
|
|
||||||
lengths[i] = 0
|
|
||||||
} else {
|
|
||||||
lengths[i] = len(filename)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for i, p := range filenames {
|
|
||||||
ident(w, nident+1)
|
|
||||||
filler := strings.Repeat(" ", getFillerSize(i, lengths, nident))
|
|
||||||
fmt.Fprintf(w, `"%s": %s`, p, filler)
|
|
||||||
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 struct {
|
|
||||||
Func func() (*asset, error)
|
|
||||||
Children map[string]*bintree
|
|
||||||
}
|
|
||||||
|
|
||||||
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 childName := range node.Children {
|
|
||||||
rv = append(rv, childName)
|
|
||||||
}
|
|
||||||
return rv, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
`)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
tree := newAssetTree()
|
|
||||||
for i := range toc {
|
|
||||||
pathList := strings.Split(toc[i].Name, "/")
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
var maxlen = 0
|
|
||||||
for i := range toc {
|
|
||||||
l := len(toc[i].Name)
|
|
||||||
if l > maxlen {
|
|
||||||
maxlen = l
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for i := range toc {
|
|
||||||
err = writeTOCAsset(w, &toc[i], maxlen)
|
|
||||||
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 {
|
|
||||||
a, err := f()
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("Asset %%s can't read by error: %%v", name, err)
|
|
||||||
}
|
|
||||||
return a.bytes, nil
|
|
||||||
}
|
|
||||||
return nil, fmt.Errorf("Asset %%s not found", name)
|
|
||||||
}
|
|
||||||
|
|
||||||
// MustAsset is like Asset but panics when Asset would return an error.
|
|
||||||
// It simplifies safe initialization of global variables.
|
|
||||||
func MustAsset(name string) []byte {
|
|
||||||
a, err := Asset(name)
|
|
||||||
if err != nil {
|
|
||||||
panic("asset: Asset(" + name + "): " + err.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
return a
|
|
||||||
}
|
|
||||||
|
|
||||||
// AssetInfo loads and returns the asset info for the given name.
|
|
||||||
// It returns an error if the asset could not be found or
|
|
||||||
// could not be loaded.
|
|
||||||
func AssetInfo(name string) (os.FileInfo, error) {
|
|
||||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
|
||||||
if f, ok := _bindata[cannonicalName]; ok {
|
|
||||||
a, err := f()
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("AssetInfo %%s can't read by error: %%v", name, err)
|
|
||||||
}
|
|
||||||
return a.info, nil
|
|
||||||
}
|
|
||||||
return nil, fmt.Errorf("AssetInfo %%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() (*asset, error){
|
|
||||||
`)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// writeTOCAsset write a TOC entry for the given asset.
|
|
||||||
func writeTOCAsset(w io.Writer, asset *Asset, maxlen int) error {
|
|
||||||
spacediff := maxlen - len(asset.Name)
|
|
||||||
filler := strings.Repeat(" ", spacediff)
|
|
||||||
|
|
||||||
_, err := fmt.Fprintf(w, "\t%q: %s%s,\n", asset.Name, filler, asset.Func)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// writeTOCFooter writes the table of contents file footer.
|
|
||||||
func writeTOCFooter(w io.Writer) error {
|
|
||||||
_, err := fmt.Fprintf(w, `}
|
|
||||||
|
|
||||||
`)
|
|
||||||
return err
|
|
||||||
}
|
|
6
vendor/modules.txt
vendored
6
vendor/modules.txt
vendored
@ -289,10 +289,6 @@ github.com/form3tech-oss/jwt-go
|
|||||||
github.com/fsnotify/fsnotify
|
github.com/fsnotify/fsnotify
|
||||||
# github.com/fvbommel/sortorder v1.0.1 => github.com/fvbommel/sortorder v1.0.1
|
# github.com/fvbommel/sortorder v1.0.1 => github.com/fvbommel/sortorder v1.0.1
|
||||||
github.com/fvbommel/sortorder
|
github.com/fvbommel/sortorder
|
||||||
# github.com/go-bindata/go-bindata v3.1.1+incompatible => github.com/go-bindata/go-bindata v3.1.1+incompatible
|
|
||||||
## explicit
|
|
||||||
github.com/go-bindata/go-bindata
|
|
||||||
github.com/go-bindata/go-bindata/go-bindata
|
|
||||||
# github.com/go-errors/errors v1.0.1 => github.com/go-errors/errors v1.0.1
|
# github.com/go-errors/errors v1.0.1 => github.com/go-errors/errors v1.0.1
|
||||||
github.com/go-errors/errors
|
github.com/go-errors/errors
|
||||||
# github.com/go-logr/logr v0.4.0 => github.com/go-logr/logr v0.4.0
|
# github.com/go-logr/logr v0.4.0 => github.com/go-logr/logr v0.4.0
|
||||||
@ -2115,7 +2111,6 @@ k8s.io/kubectl/pkg/drain
|
|||||||
k8s.io/kubectl/pkg/explain
|
k8s.io/kubectl/pkg/explain
|
||||||
k8s.io/kubectl/pkg/generate
|
k8s.io/kubectl/pkg/generate
|
||||||
k8s.io/kubectl/pkg/generate/versioned
|
k8s.io/kubectl/pkg/generate/versioned
|
||||||
k8s.io/kubectl/pkg/generated
|
|
||||||
k8s.io/kubectl/pkg/metricsutil
|
k8s.io/kubectl/pkg/metricsutil
|
||||||
k8s.io/kubectl/pkg/polymorphichelpers
|
k8s.io/kubectl/pkg/polymorphichelpers
|
||||||
k8s.io/kubectl/pkg/proxy
|
k8s.io/kubectl/pkg/proxy
|
||||||
@ -2482,7 +2477,6 @@ sigs.k8s.io/yaml
|
|||||||
# github.com/fvbommel/sortorder => github.com/fvbommel/sortorder v1.0.1
|
# github.com/fvbommel/sortorder => github.com/fvbommel/sortorder v1.0.1
|
||||||
# github.com/getsentry/raven-go => github.com/getsentry/raven-go v0.2.0
|
# github.com/getsentry/raven-go => github.com/getsentry/raven-go v0.2.0
|
||||||
# github.com/ghodss/yaml => github.com/ghodss/yaml v1.0.0
|
# github.com/ghodss/yaml => github.com/ghodss/yaml v1.0.0
|
||||||
# github.com/go-bindata/go-bindata => github.com/go-bindata/go-bindata v3.1.1+incompatible
|
|
||||||
# github.com/go-errors/errors => github.com/go-errors/errors v1.0.1
|
# github.com/go-errors/errors => github.com/go-errors/errors v1.0.1
|
||||||
# github.com/go-gl/glfw/v3.3/glfw => github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4
|
# github.com/go-gl/glfw/v3.3/glfw => github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4
|
||||||
# github.com/go-kit/kit => github.com/go-kit/kit v0.9.0
|
# github.com/go-kit/kit => github.com/go-kit/kit v0.9.0
|
||||||
|
Loading…
Reference in New Issue
Block a user