├── .gitignore ├── .goreleaser.yml ├── .travis.yml ├── Dockerfile ├── LICENSE ├── Makefile ├── README.md ├── api ├── http.go └── service.go ├── cmd └── api │ └── main.go ├── config └── config.go ├── develop.env ├── docker-compose.memory.yml ├── docker-compose.persistent.yml ├── docs ├── Docker.md ├── Metrics.md ├── Plugins.md └── Releasing.md ├── go.mod ├── go.sum ├── grafana-dashboard.json ├── plugin ├── mem_repository.go └── repository.go ├── plugins ├── racefansnet │ └── racefansnet.go ├── roadsandkingdoms │ └── roadsandkingdoms.go └── scmp │ └── scmp.go ├── run_develop.sh ├── runner └── runner.go ├── scrape └── fetch.go ├── store ├── disk_repository.go ├── mem_repository.go └── store.go ├── ui ├── assets-source │ ├── Favicon.pxm │ └── Preview.pxm ├── assets │ ├── android-chrome-192x192.png │ ├── android-chrome-256x256.png │ ├── apple-touch-icon.png │ ├── browserconfig.xml │ ├── favicon-16x16.png │ ├── favicon-32x32.png │ ├── favicon.ico │ ├── icon.png │ ├── mstile-150x150.png │ ├── preview-image.jpg │ ├── site.webmanifest │ ├── styles.css │ └── tachyons.min.css └── templates │ └── index.tmpl └── vendor ├── github.com ├── PuerkitoBio │ └── goquery │ │ ├── .gitattributes │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── array.go │ │ ├── doc.go │ │ ├── expand.go │ │ ├── filter.go │ │ ├── go.mod │ │ ├── go.sum │ │ ├── iteration.go │ │ ├── manipulation.go │ │ ├── property.go │ │ ├── query.go │ │ ├── traversal.go │ │ ├── type.go │ │ └── utilities.go ├── andybalholm │ └── cascadia │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── go.mod │ │ ├── parser.go │ │ ├── selector.go │ │ └── specificity.go ├── beorn7 │ └── perks │ │ ├── LICENSE │ │ └── quantile │ │ ├── exampledata.txt │ │ └── stream.go ├── caarlos0 │ └── env │ │ ├── .gitignore │ │ ├── .hound.yml │ │ ├── .travis.yml │ │ ├── LICENSE.md │ │ ├── README.md │ │ └── env.go ├── cespare │ └── xxhash │ │ └── v2 │ │ ├── .travis.yml │ │ ├── LICENSE.txt │ │ ├── README.md │ │ ├── go.mod │ │ ├── go.sum │ │ ├── xxhash.go │ │ ├── xxhash_amd64.go │ │ ├── xxhash_amd64.s │ │ ├── xxhash_other.go │ │ ├── xxhash_safe.go │ │ └── xxhash_unsafe.go ├── go-chi │ ├── chi │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── CHANGELOG.md │ │ ├── CONTRIBUTING.md │ │ ├── LICENSE │ │ ├── README.md │ │ ├── chain.go │ │ ├── chi.go │ │ ├── context.go │ │ ├── mux.go │ │ └── tree.go │ └── cors │ │ ├── README.md │ │ ├── cors.go │ │ └── utils.go ├── go-kit │ └── kit │ │ ├── LICENSE │ │ └── log │ │ ├── README.md │ │ ├── doc.go │ │ ├── json_logger.go │ │ ├── level │ │ ├── doc.go │ │ └── level.go │ │ ├── log.go │ │ ├── logfmt_logger.go │ │ ├── nop_logger.go │ │ ├── stdlib.go │ │ ├── sync.go │ │ └── value.go ├── go-logfmt │ └── logfmt │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── CHANGELOG.md │ │ ├── LICENSE │ │ ├── README.md │ │ ├── decode.go │ │ ├── doc.go │ │ ├── encode.go │ │ ├── go.mod │ │ └── jsonstring.go ├── gobuffalo │ ├── envy │ │ ├── .gitignore │ │ ├── .gometalinter.json │ │ ├── LICENSE.txt │ │ ├── Makefile │ │ ├── README.md │ │ ├── SHOULDERS.md │ │ ├── azure-pipelines.yml │ │ ├── azure-tests.yml │ │ ├── azure.sh │ │ ├── env │ │ ├── envy.go │ │ ├── go.mod │ │ ├── go.sum │ │ └── version.go │ ├── packd │ │ ├── .gitignore │ │ ├── .gometalinter.json │ │ ├── LICENSE │ │ ├── Makefile │ │ ├── README.md │ │ ├── SHOULDERS.md │ │ ├── azure-pipelines.yml │ │ ├── azure-tests.yml │ │ ├── file.go │ │ ├── file_info.go │ │ ├── go.mod │ │ ├── go.sum │ │ ├── interfaces.go │ │ ├── internal │ │ │ └── takeon │ │ │ │ └── github.com │ │ │ │ └── markbates │ │ │ │ └── errx │ │ │ │ ├── .gitignore │ │ │ │ ├── LICENSE │ │ │ │ ├── Makefile │ │ │ │ ├── SHOULDERS.md │ │ │ │ ├── azure-pipelines.yml │ │ │ │ ├── azure-tests.yml │ │ │ │ ├── errx.go │ │ │ │ └── version.go │ │ ├── map.go │ │ ├── memory_box.go │ │ ├── skip_walker.go │ │ └── version.go │ └── packr │ │ ├── .codeclimate.yml │ │ ├── .gitignore │ │ ├── .gometalinter.json │ │ ├── .goreleaser.yml │ │ ├── .goreleaser.yml.plush │ │ ├── LICENSE.txt │ │ ├── Makefile │ │ ├── README.md │ │ ├── SHOULDERS.md │ │ ├── azure-pipelines.yml │ │ ├── azure-tests.yml │ │ ├── box.go │ │ ├── env.go │ │ ├── file.go │ │ ├── go.mod │ │ ├── go.sum │ │ ├── packr.go │ │ ├── version.go │ │ └── walk.go ├── golang │ └── protobuf │ │ ├── AUTHORS │ │ ├── CONTRIBUTORS │ │ ├── LICENSE │ │ └── proto │ │ ├── clone.go │ │ ├── decode.go │ │ ├── deprecated.go │ │ ├── discard.go │ │ ├── encode.go │ │ ├── equal.go │ │ ├── extensions.go │ │ ├── lib.go │ │ ├── message_set.go │ │ ├── pointer_reflect.go │ │ ├── pointer_unsafe.go │ │ ├── properties.go │ │ ├── table_marshal.go │ │ ├── table_merge.go │ │ ├── table_unmarshal.go │ │ ├── text.go │ │ └── text_parser.go ├── google │ └── btree │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ └── btree.go ├── gorilla │ └── feeds │ │ ├── .travis.yml │ │ ├── AUTHORS │ │ ├── LICENSE │ │ ├── README.md │ │ ├── atom.go │ │ ├── doc.go │ │ ├── feed.go │ │ ├── json.go │ │ ├── rss.go │ │ ├── test.atom │ │ ├── test.rss │ │ ├── to-implement.md │ │ └── uuid.go ├── joho │ └── godotenv │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── LICENCE │ │ ├── README.md │ │ └── godotenv.go ├── matttproud │ └── golang_protobuf_extensions │ │ ├── LICENSE │ │ ├── NOTICE │ │ └── pbutil │ │ ├── .gitignore │ │ ├── Makefile │ │ ├── decode.go │ │ ├── doc.go │ │ └── encode.go ├── mauidude │ └── go-readability │ │ ├── README.md │ │ └── readability.go ├── mmcdole │ ├── gofeed │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── atom │ │ │ ├── feed.go │ │ │ └── parser.go │ │ ├── detector.go │ │ ├── extensions │ │ │ ├── dublincore.go │ │ │ ├── extensions.go │ │ │ └── itunes.go │ │ ├── feed.go │ │ ├── internal │ │ │ └── shared │ │ │ │ ├── charsetconv.go │ │ │ │ ├── dateparser.go │ │ │ │ ├── extparser.go │ │ │ │ ├── parseutils.go │ │ │ │ └── xmlsanitizer.go │ │ ├── parser.go │ │ ├── rss │ │ │ ├── feed.go │ │ │ └── parser.go │ │ └── translator.go │ └── goxpp │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ └── xpp.go ├── patrickmn │ └── go-cache │ │ ├── CONTRIBUTORS │ │ ├── LICENSE │ │ ├── README.md │ │ ├── cache.go │ │ └── sharded.go ├── peterbourgon │ └── diskv │ │ ├── LICENSE │ │ ├── README.md │ │ ├── compression.go │ │ ├── diskv.go │ │ └── index.go ├── prometheus │ ├── client_golang │ │ ├── LICENSE │ │ ├── NOTICE │ │ └── prometheus │ │ │ ├── .gitignore │ │ │ ├── README.md │ │ │ ├── build_info.go │ │ │ ├── build_info_pre_1.12.go │ │ │ ├── collector.go │ │ │ ├── counter.go │ │ │ ├── desc.go │ │ │ ├── doc.go │ │ │ ├── expvar_collector.go │ │ │ ├── fnv.go │ │ │ ├── gauge.go │ │ │ ├── go_collector.go │ │ │ ├── histogram.go │ │ │ ├── internal │ │ │ └── metric.go │ │ │ ├── labels.go │ │ │ ├── metric.go │ │ │ ├── observer.go │ │ │ ├── process_collector.go │ │ │ ├── process_collector_other.go │ │ │ ├── process_collector_windows.go │ │ │ ├── promhttp │ │ │ ├── delegator.go │ │ │ ├── http.go │ │ │ ├── instrument_client.go │ │ │ └── instrument_server.go │ │ │ ├── registry.go │ │ │ ├── summary.go │ │ │ ├── timer.go │ │ │ ├── untyped.go │ │ │ ├── value.go │ │ │ ├── vec.go │ │ │ └── wrap.go │ ├── client_model │ │ ├── LICENSE │ │ ├── NOTICE │ │ └── go │ │ │ └── metrics.pb.go │ ├── common │ │ ├── LICENSE │ │ ├── NOTICE │ │ ├── expfmt │ │ │ ├── decode.go │ │ │ ├── encode.go │ │ │ ├── expfmt.go │ │ │ ├── fuzz.go │ │ │ ├── text_create.go │ │ │ └── text_parse.go │ │ ├── internal │ │ │ └── bitbucket.org │ │ │ │ └── ww │ │ │ │ └── goautoneg │ │ │ │ ├── README.txt │ │ │ │ └── autoneg.go │ │ └── model │ │ │ ├── alert.go │ │ │ ├── fingerprinting.go │ │ │ ├── fnv.go │ │ │ ├── labels.go │ │ │ ├── labelset.go │ │ │ ├── metric.go │ │ │ ├── model.go │ │ │ ├── signature.go │ │ │ ├── silence.go │ │ │ ├── time.go │ │ │ └── value.go │ └── procfs │ │ ├── .gitignore │ │ ├── .golangci.yml │ │ ├── CONTRIBUTING.md │ │ ├── LICENSE │ │ ├── MAINTAINERS.md │ │ ├── Makefile │ │ ├── Makefile.common │ │ ├── NOTICE │ │ ├── README.md │ │ ├── arp.go │ │ ├── buddyinfo.go │ │ ├── cpuinfo.go │ │ ├── crypto.go │ │ ├── doc.go │ │ ├── fixtures.ttar │ │ ├── fs.go │ │ ├── go.mod │ │ ├── go.sum │ │ ├── internal │ │ ├── fs │ │ │ └── fs.go │ │ └── util │ │ │ ├── parse.go │ │ │ ├── readfile.go │ │ │ ├── sysreadfile.go │ │ │ ├── sysreadfile_compat.go │ │ │ └── valueparser.go │ │ ├── ipvs.go │ │ ├── mdstat.go │ │ ├── meminfo.go │ │ ├── mountinfo.go │ │ ├── mountstats.go │ │ ├── net_dev.go │ │ ├── net_sockstat.go │ │ ├── net_softnet.go │ │ ├── net_unix.go │ │ ├── proc.go │ │ ├── proc_environ.go │ │ ├── proc_fdinfo.go │ │ ├── proc_io.go │ │ ├── proc_limits.go │ │ ├── proc_ns.go │ │ ├── proc_psi.go │ │ ├── proc_stat.go │ │ ├── proc_status.go │ │ ├── schedstat.go │ │ ├── stat.go │ │ ├── ttar │ │ ├── vm.go │ │ ├── xfrm.go │ │ └── zoneinfo.go └── rogpeppe │ └── go-internal │ ├── LICENSE │ ├── modfile │ ├── gopkgin.go │ ├── print.go │ ├── read.go │ └── rule.go │ ├── module │ └── module.go │ └── semver │ └── semver.go ├── golang.org └── x │ ├── net │ ├── AUTHORS │ ├── CONTRIBUTORS │ ├── LICENSE │ ├── PATENTS │ └── html │ │ ├── atom │ │ ├── atom.go │ │ └── table.go │ │ ├── charset │ │ └── charset.go │ │ ├── const.go │ │ ├── doc.go │ │ ├── doctype.go │ │ ├── entity.go │ │ ├── escape.go │ │ ├── foreign.go │ │ ├── node.go │ │ ├── parse.go │ │ ├── render.go │ │ └── token.go │ ├── sys │ ├── AUTHORS │ ├── CONTRIBUTORS │ ├── LICENSE │ ├── PATENTS │ └── windows │ │ ├── aliases.go │ │ ├── dll_windows.go │ │ ├── empty.s │ │ ├── env_windows.go │ │ ├── eventlog.go │ │ ├── exec_windows.go │ │ ├── memory_windows.go │ │ ├── mkerrors.bash │ │ ├── mkknownfolderids.bash │ │ ├── mksyscall.go │ │ ├── race.go │ │ ├── race0.go │ │ ├── security_windows.go │ │ ├── service.go │ │ ├── str.go │ │ ├── syscall.go │ │ ├── syscall_windows.go │ │ ├── types_windows.go │ │ ├── types_windows_386.go │ │ ├── types_windows_amd64.go │ │ ├── types_windows_arm.go │ │ ├── zerrors_windows.go │ │ ├── zknownfolderids_windows.go │ │ └── zsyscall_windows.go │ └── text │ ├── AUTHORS │ ├── CONTRIBUTORS │ ├── LICENSE │ ├── PATENTS │ ├── encoding │ ├── charmap │ │ ├── charmap.go │ │ └── tables.go │ ├── encoding.go │ ├── htmlindex │ │ ├── htmlindex.go │ │ ├── map.go │ │ └── tables.go │ ├── internal │ │ ├── identifier │ │ │ ├── identifier.go │ │ │ └── mib.go │ │ └── internal.go │ ├── japanese │ │ ├── all.go │ │ ├── eucjp.go │ │ ├── iso2022jp.go │ │ ├── shiftjis.go │ │ └── tables.go │ ├── korean │ │ ├── euckr.go │ │ └── tables.go │ ├── simplifiedchinese │ │ ├── all.go │ │ ├── gbk.go │ │ ├── hzgb2312.go │ │ └── tables.go │ ├── traditionalchinese │ │ ├── big5.go │ │ └── tables.go │ └── unicode │ │ ├── override.go │ │ └── unicode.go │ ├── internal │ ├── language │ │ ├── common.go │ │ ├── compact.go │ │ ├── compact │ │ │ ├── compact.go │ │ │ ├── language.go │ │ │ ├── parents.go │ │ │ ├── tables.go │ │ │ └── tags.go │ │ ├── compose.go │ │ ├── coverage.go │ │ ├── language.go │ │ ├── lookup.go │ │ ├── match.go │ │ ├── parse.go │ │ ├── tables.go │ │ └── tags.go │ ├── tag │ │ └── tag.go │ └── utf8internal │ │ └── utf8internal.go │ ├── language │ ├── coverage.go │ ├── doc.go │ ├── go1_1.go │ ├── go1_2.go │ ├── language.go │ ├── match.go │ ├── parse.go │ ├── tables.go │ └── tags.go │ ├── runes │ ├── cond.go │ └── runes.go │ └── transform │ └── transform.go └── modules.txt /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | dist/ 3 | /feedbridge 4 | dist/ 5 | -------------------------------------------------------------------------------- /.goreleaser.yml: -------------------------------------------------------------------------------- 1 | # This is an example .goreleaser.yml file with some sane defaults. 2 | # Make sure to check the documentation at http://goreleaser.com 3 | before: 4 | hooks: 5 | # You may remove this if you don't use go modules. 6 | - go mod tidy 7 | # you may remove this if you don't need go generate 8 | - go generate ./... 9 | builds: 10 | - main: ./cmd/api/main.go 11 | - env: 12 | - CGO_ENABLED=0 13 | goos: 14 | - linux 15 | - windows 16 | - darwin 17 | archives: 18 | - replacements: 19 | darwin: Darwin 20 | linux: Linux 21 | windows: Windows 22 | 386: i386 23 | amd64: x86_64 24 | checksum: 25 | name_template: 'checksums.txt' 26 | snapshot: 27 | name_template: "{{ .Tag }}-next" 28 | changelog: 29 | sort: asc 30 | filters: 31 | exclude: 32 | - '^docs:' 33 | - '^test:' 34 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - "1.16" 4 | 5 | script: 6 | - go test -race -v -tags integration $(go list ./... | grep -v vendor) 7 | 8 | notifications: 9 | email: 10 | - mail@notmyhostna.me -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.12-alpine as builder 2 | 3 | RUN apk add git bash 4 | 5 | ENV GO111MODULE=on 6 | 7 | # Add our code 8 | ADD ./ $GOPATH/src/github.com/dewey/feedbridge 9 | 10 | # build 11 | WORKDIR $GOPATH/src/github.com/dewey/feedbridge 12 | RUN go get -u github.com/gobuffalo/packr/... && \ 13 | cd $GOPATH/src/github.com/dewey/feedbridge && \ 14 | packr && \ 15 | GO111MODULE=on GOGC=off go build -mod=vendor -v -o /feedbridge ./cmd/api/ 16 | 17 | # multistage 18 | FROM alpine:latest 19 | 20 | # https://stackoverflow.com/questions/33353532/does-alpine-linux-handle-certs-differently-than-busybox#33353762 21 | RUN apk --update upgrade && \ 22 | apk add curl ca-certificates && \ 23 | update-ca-certificates && \ 24 | rm -rf /var/cache/apk/* 25 | 26 | COPY --from=builder /feedbridge /usr/bin/feedbridge 27 | 28 | # Run the image as a non-root user 29 | RUN adduser -D mfs 30 | RUN chmod 0755 /usr/bin/feedbridge 31 | 32 | USER mfs 33 | 34 | # Run the app. CMD is required to run on Heroku 35 | CMD feedbridge -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Philipp Defner 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | IMAGE_NAME := tehwey/feedbridge 2 | VERSION_DOCKER := $(shell git describe --abbrev=0 --tags | sed 's/^v\(.*\)/\1/') 3 | 4 | all: install 5 | 6 | install: 7 | go install -v 8 | 9 | test: 10 | go test ./... -v 11 | 12 | image-push-staging: 13 | docker build -t $(IMAGE_NAME):staging . 14 | docker push $(IMAGE_NAME):staging 15 | 16 | image-push: 17 | docker build -t $(IMAGE_NAME):latest . 18 | docker tag $(IMAGE_NAME):latest $(IMAGE_NAME):$(VERSION_DOCKER) 19 | docker push $(IMAGE_NAME):latest 20 | docker push $(IMAGE_NAME):$(VERSION_DOCKER) 21 | 22 | release: 23 | git tag -a $(VERSION) -m "Release $(VERSION)" || true 24 | git push origin $(VERSION) 25 | goreleaser --rm-dist 26 | 27 | .PHONY: install test -------------------------------------------------------------------------------- /config/config.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | // Config holds our app configuration 4 | type Config struct { 5 | RefreshInterval int `env:"REFRESH_INTERVAL" envDefault:"15"` 6 | CacheExpiration int `env:"CACHE_EXPIRATION" envDefault:"30"` 7 | CacheExpiredPurge int `env:"CACHE_EXPIRED_PURGE" envDefault:"60"` 8 | StorageBackend string `env:"STORAGE_BACKEND" envDefault:"memory"` 9 | StoragePath string `env:"STORAGE_PATH" envDefault:"/feedbridge-data"` 10 | APIToken string `env:"API_TOKEN" envDefault:"feedbridge"` 11 | Environment string `env:"ENVIRONMENT" envDefault:"develop"` 12 | Port int `env:"PORT" envDefault:"8080"` 13 | } 14 | -------------------------------------------------------------------------------- /develop.env: -------------------------------------------------------------------------------- 1 | export ENVIRONMENT=develop 2 | export STORAGE_BACKEND=memory 3 | export API_TOKEN=feedbridge -------------------------------------------------------------------------------- /docker-compose.memory.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | services: 3 | app: 4 | image: tehwey/feedbridge:latest 5 | ports: 6 | - "8080:8080" 7 | environment: 8 | - ENVIRONMENT=prod 9 | - REFRESH_INTERVAL=15 10 | - CACHE_EXPIRATION=30 11 | - CACHE_EXPIRED_PURGE=60 12 | - STORAGE_BACKEND=memory 13 | -------------------------------------------------------------------------------- /docker-compose.persistent.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | services: 3 | app: 4 | image: tehwey/feedbridge:latest 5 | ports: 6 | - "8080:8080" 7 | environment: 8 | - ENVIRONMENT=prod 9 | - REFRESH_INTERVAL=15 10 | - STORAGE_BACKEND=persistent 11 | - STORAGE_PATH=/feedbridge-data 12 | volumes: 13 | - /home/dewey/services/feedbridge/feedbridge-data:/feedbridge-data 14 | -------------------------------------------------------------------------------- /docs/Docker.md: -------------------------------------------------------------------------------- 1 | # Run with Docker 2 | 3 | There's an official Feedbridge image located on https://hub.docker.com/r/tehwey/feedbridge/. To 4 | run the latest version just make use of the included `docker-compose` file. 5 | 6 | ``` 7 | docker-compose -f docker-compose.yml up -d 8 | ``` 9 | 10 | After that it'll run on Port 8080 and listening on localhost. -------------------------------------------------------------------------------- /docs/Metrics.md: -------------------------------------------------------------------------------- 1 | # Prometheus Metrics 2 | 3 | Feedbridge per default exposes a Prometheus Metrics endpoint on `/metrics`. You 4 | can use Prometheus, Grafana and the included Grafana dashboard to monitor your instance. -------------------------------------------------------------------------------- /docs/Plugins.md: -------------------------------------------------------------------------------- 1 | # Adding a new plugin 2 | 3 | The best starting point to get into plugin development is to look at the existing plugins 4 | located in `plugins/`. The main idea is that a plugin gets a *http.Client to do requests 5 | and returns a *feeds.Feed object that will then be stored by the system. 6 | 7 | Every plugin has to implement this interface: 8 | 9 | ``` 10 | type Plugin interface { 11 | Run() (*feeds.Feed, error) 12 | Info() PluginMetadata 13 | } 14 | ``` 15 | 16 | What you do within `Run()` is pretty flexible. You either talk to an API, Marshall JSON or you 17 | do webscraping with `goquery`. For that usecase there are already some convinience wrappers 18 | available, located in the `scrape` package. If sensible feel free to add new helper functions 19 | there if they are re-usable. 20 | 21 | # Installing the plugin 22 | 23 | To install a plugin it has to be added to the global plugin repository, once this is done the 24 | plugin will run periodically as defined by the interval that is set for the instance. 25 | 26 | ``` 27 | pluginRepo.Install(scmp.NewPlugin(l, c)) 28 | ``` 29 | 30 | # Open a Pull Request 31 | 32 | If you think your plugin could be useful to more people please open a Pull Request on Github: 33 | 34 | https://github.com/dewey/feedbridge/pulls 35 | 36 | I'll review, merge and release a new version so other people can use it on the hosted version. 37 | 38 | -------------------------------------------------------------------------------- /docs/Releasing.md: -------------------------------------------------------------------------------- 1 | # Releasing a new version 2 | 3 | (Notes mostly for myself) 4 | 5 | For a new release to get pushed to Github and Docker Hub the following steps 6 | are needed. Set the version you want to release and then run release from the 7 | Makefile like that: `VERSION=0.1.4 make release`. 8 | 9 | Then run the following steps. Make sure the Github Token (`GITHUB_TOKEN`) is set for goreleaser. 10 | 11 | ``` 12 | feedbridge|master⚡ ⇒ GITHUB_TOKEN="" VERSION=0.1.x make release 13 | feedbridge|master⚡ ⇒ make image-push 14 | ``` 15 | 16 | # Releasing a staging version 17 | 18 | This just pushes a new image with local development version, this one is usually running on https://beta.feedbridge.notmyhostna.me 19 | 20 | ``` 21 | feedbridge|master⚡ ⇒ make image-push-staging 22 | ``` -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/dewey/feedbridge 2 | 3 | go 1.16 4 | 5 | require ( 6 | github.com/PuerkitoBio/goquery v1.6.1 7 | github.com/caarlos0/env v3.5.0+incompatible 8 | github.com/go-chi/chi v4.1.2+incompatible 9 | github.com/go-chi/cors v1.0.0 10 | github.com/go-kit/kit v0.10.0 11 | github.com/gobuffalo/packr v1.30.1 12 | github.com/gorilla/feeds v1.1.1 13 | github.com/mauidude/go-readability v0.0.0-20141216012317-2f30b1a346f1 14 | github.com/mmcdole/gofeed v1.0.0-beta2 15 | github.com/mmcdole/goxpp v0.0.0-20181012175147-0068e33feabf // indirect 16 | github.com/patrickmn/go-cache v2.1.0+incompatible 17 | github.com/peterbourgon/diskv v2.0.1+incompatible 18 | github.com/prometheus/client_golang v1.3.0 19 | ) 20 | -------------------------------------------------------------------------------- /plugin/mem_repository.go: -------------------------------------------------------------------------------- 1 | package plugin 2 | 3 | import ( 4 | "errors" 5 | "fmt" 6 | "sync" 7 | ) 8 | 9 | // MemRepo is a memory-backed repo 10 | type MemRepo struct { 11 | plugins map[string]Plugin 12 | sync.RWMutex 13 | } 14 | 15 | // NewMemRepo creates a memory-backed repo 16 | func NewMemRepo() *MemRepo { 17 | return &MemRepo{ 18 | plugins: map[string]Plugin{}, 19 | } 20 | } 21 | 22 | // Install installs a new plugin 23 | func (mr *MemRepo) Install(p Plugin) { 24 | if p == nil { 25 | panic("no plugin func, or source is empty") 26 | } 27 | 28 | mr.Lock() 29 | defer mr.Unlock() 30 | 31 | if _, ok := mr.plugins[p.Info().TechnicalName]; ok { 32 | panic(fmt.Sprintf("plugin with name '%s' already exists", p.Info().TechnicalName)) 33 | } 34 | 35 | mr.plugins[p.Info().TechnicalName] = p 36 | } 37 | 38 | // Find finds a plugin by name 39 | func (mr *MemRepo) Find(name string) (Plugin, error) { 40 | mr.RLock() 41 | defer mr.RUnlock() 42 | pf, ok := mr.plugins[name] 43 | if !ok { 44 | return nil, errors.New("no plugin found") 45 | } 46 | return pf, nil 47 | } 48 | 49 | // All returns all the available plugins 50 | func (mr *MemRepo) All() []Plugin { 51 | mr.RLock() 52 | defer mr.RUnlock() 53 | plugins := []Plugin{} 54 | for _, p := range mr.plugins { 55 | plugins = append(plugins, p) 56 | } 57 | 58 | return plugins 59 | } 60 | -------------------------------------------------------------------------------- /plugin/repository.go: -------------------------------------------------------------------------------- 1 | package plugin 2 | 3 | import ( 4 | "github.com/gorilla/feeds" 5 | ) 6 | 7 | // A Repository is responsible for retrieving/registering pluginFuncs 8 | type Repository interface { 9 | Install(p Plugin) 10 | Find(name string) (Plugin, error) 11 | All() []Plugin 12 | } 13 | 14 | // Plugin is the interface that a scrape plugin has to implement 15 | type Plugin interface { 16 | Run() (*feeds.Feed, error) 17 | Info() PluginMetadata 18 | } 19 | 20 | type PluginMetadata struct { 21 | TechnicalName string 22 | Name string 23 | Description string 24 | Author string 25 | AuthorURL string 26 | Image string 27 | SourceURL string 28 | } 29 | -------------------------------------------------------------------------------- /run_develop.sh: -------------------------------------------------------------------------------- 1 | source develop.env 2 | 3 | function cleanup() { 4 | rm -f feedbridge 5 | } 6 | trap cleanup EXIT 7 | 8 | # Compile Go 9 | GO111MODULE=on GOGC=off go build -mod=vendor -v -o feedbridge ./cmd/api/ 10 | ./feedbridge 11 | -------------------------------------------------------------------------------- /scrape/fetch.go: -------------------------------------------------------------------------------- 1 | package scrape 2 | 3 | import ( 4 | "errors" 5 | "net/http" 6 | 7 | "github.com/PuerkitoBio/goquery" 8 | ) 9 | 10 | // TaskDocumentResponse is the result of a fetched task and it's originating URL 11 | type TaskDocumentResponse struct { 12 | Document goquery.Document 13 | URL string 14 | } 15 | 16 | // Task is a scrape task 17 | type Task struct { 18 | URL string 19 | Payload string 20 | } 21 | 22 | // Statistic contains statistics about a scrape 23 | type Statistic struct { 24 | Items int 25 | } 26 | 27 | // URLToDocument is a convinience function to directly get a goquery document(s) from a list of URLs 28 | func URLToDocument(c *http.Client, tasks []Task) ([]TaskDocumentResponse, error) { 29 | if len(tasks) < 1 { 30 | return nil, errors.New("urls can't be empty") 31 | } 32 | var result []TaskDocumentResponse 33 | for _, task := range tasks { 34 | req, err := http.NewRequest("GET", task.URL, nil) 35 | if err != nil { 36 | continue 37 | } 38 | // They block requests without valid user agent 39 | req.Header.Set("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1.2 Safari/605.1.15") 40 | req.Header.Set("Accept-Language", "en-us") 41 | 42 | resp, err := c.Do(req) 43 | if err != nil { 44 | return nil, err 45 | } 46 | 47 | doc, err := goquery.NewDocumentFromReader(resp.Body) 48 | if err != nil { 49 | resp.Body.Close() 50 | return nil, err 51 | } 52 | resp.Body.Close() 53 | 54 | rt := TaskDocumentResponse{ 55 | Document: *doc, 56 | URL: task.URL, 57 | } 58 | result = append(result, rt) 59 | } 60 | return result, nil 61 | } 62 | 63 | // URLtoTask is a helper function to convert a list of URLs to a list of tasks 64 | func URLtoTask(urls []string) []Task { 65 | var tasks []Task 66 | for _, u := range urls { 67 | tasks = append(tasks, Task{ 68 | URL: u, 69 | }) 70 | } 71 | return tasks 72 | } 73 | -------------------------------------------------------------------------------- /store/disk_repository.go: -------------------------------------------------------------------------------- 1 | package store 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/peterbourgon/diskv" 7 | ) 8 | 9 | // DiskRepo holds a representation of a persistent store backend 10 | type DiskRepo struct { 11 | d *diskv.Diskv 12 | } 13 | 14 | // NewDiskRepository returns a newly persistent store repository 15 | func NewDiskRepository(path string) (*DiskRepo, error) { 16 | d := diskv.New(diskv.Options{ 17 | BasePath: path, 18 | CacheSizeMax: 1024 * 1024, 19 | }) 20 | 21 | return &DiskRepo{ 22 | d: d, 23 | }, nil 24 | } 25 | 26 | // Save stores a new value for a key in the k/v store 27 | func (r *DiskRepo) Save(key string, value string) error { 28 | if err := r.d.Write(key, []byte(value)); err != nil { 29 | return err 30 | } 31 | return nil 32 | } 33 | 34 | // Get retrieves a value from the k/v store 35 | func (r *DiskRepo) Get(key string) (string, error) { 36 | value, err := r.d.Read(key) 37 | if err != nil { 38 | return "", fmt.Errorf("no value found for key '%s', err: %s", key, err) 39 | } 40 | return string(value), nil 41 | } 42 | -------------------------------------------------------------------------------- /store/mem_repository.go: -------------------------------------------------------------------------------- 1 | package store 2 | 3 | import ( 4 | "fmt" 5 | "time" 6 | 7 | cache "github.com/patrickmn/go-cache" 8 | ) 9 | 10 | // MemRepo holds a in-memory representation of a store backend 11 | type MemRepo struct { 12 | c *cache.Cache 13 | } 14 | 15 | // NewMemRepository returns a newly initialized in-memory repository 16 | func NewMemRepository(expiration, expiredPurge int) (*MemRepo, error) { 17 | return &MemRepo{ 18 | c: cache.New(time.Duration(expiration)*time.Minute, time.Duration(expiredPurge)*time.Minute), 19 | }, nil 20 | } 21 | 22 | // Save stores a new value for a key in the k/v store 23 | func (r *MemRepo) Save(key string, value string) error { 24 | r.c.Set(key, value, cache.DefaultExpiration) 25 | return nil 26 | } 27 | 28 | // Get retrieves a value from the k/v store 29 | func (r *MemRepo) Get(key string) (string, error) { 30 | value, found := r.c.Get(key) 31 | if found { 32 | return value.(string), nil 33 | } 34 | return "", fmt.Errorf("no value found for key '%s'", key) 35 | } 36 | -------------------------------------------------------------------------------- /store/store.go: -------------------------------------------------------------------------------- 1 | package store 2 | 3 | import "github.com/dewey/feedbridge/config" 4 | 5 | // StorageRepository defines the interface for a k/v backend 6 | type StorageRepository interface { 7 | // Save stores an item in the store 8 | Save(string, string) error 9 | 10 | // Get item from store 11 | Get(string) (string, error) 12 | } 13 | 14 | // NewStoreBackend is a factory to return a store implementation based on the config choosen 15 | func NewStoreBackend(cfg config.Config) (StorageRepository, error) { 16 | var storageRepo StorageRepository 17 | switch cfg.StorageBackend { 18 | case "memory": 19 | memory, err := NewMemRepository(cfg.CacheExpiration, cfg.CacheExpiredPurge) 20 | if err != nil { 21 | return nil, err 22 | } 23 | storageRepo = memory 24 | case "persistent": 25 | disk, err := NewDiskRepository(cfg.StoragePath) 26 | if err != nil { 27 | return nil, err 28 | } 29 | storageRepo = disk 30 | } 31 | return storageRepo, nil 32 | } 33 | -------------------------------------------------------------------------------- /ui/assets-source/Favicon.pxm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dewey/feedbridge/ee9fbbcc430654770c3ea26fa0bdea49bd044243/ui/assets-source/Favicon.pxm -------------------------------------------------------------------------------- /ui/assets-source/Preview.pxm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dewey/feedbridge/ee9fbbcc430654770c3ea26fa0bdea49bd044243/ui/assets-source/Preview.pxm -------------------------------------------------------------------------------- /ui/assets/android-chrome-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dewey/feedbridge/ee9fbbcc430654770c3ea26fa0bdea49bd044243/ui/assets/android-chrome-192x192.png -------------------------------------------------------------------------------- /ui/assets/android-chrome-256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dewey/feedbridge/ee9fbbcc430654770c3ea26fa0bdea49bd044243/ui/assets/android-chrome-256x256.png -------------------------------------------------------------------------------- /ui/assets/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dewey/feedbridge/ee9fbbcc430654770c3ea26fa0bdea49bd044243/ui/assets/apple-touch-icon.png -------------------------------------------------------------------------------- /ui/assets/browserconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | #ffc40d 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /ui/assets/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dewey/feedbridge/ee9fbbcc430654770c3ea26fa0bdea49bd044243/ui/assets/favicon-16x16.png -------------------------------------------------------------------------------- /ui/assets/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dewey/feedbridge/ee9fbbcc430654770c3ea26fa0bdea49bd044243/ui/assets/favicon-32x32.png -------------------------------------------------------------------------------- /ui/assets/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dewey/feedbridge/ee9fbbcc430654770c3ea26fa0bdea49bd044243/ui/assets/favicon.ico -------------------------------------------------------------------------------- /ui/assets/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dewey/feedbridge/ee9fbbcc430654770c3ea26fa0bdea49bd044243/ui/assets/icon.png -------------------------------------------------------------------------------- /ui/assets/mstile-150x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dewey/feedbridge/ee9fbbcc430654770c3ea26fa0bdea49bd044243/ui/assets/mstile-150x150.png -------------------------------------------------------------------------------- /ui/assets/preview-image.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dewey/feedbridge/ee9fbbcc430654770c3ea26fa0bdea49bd044243/ui/assets/preview-image.jpg -------------------------------------------------------------------------------- /ui/assets/site.webmanifest: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Feedbridge", 3 | "short_name": "Feedbridge", 4 | "icons": [ 5 | { 6 | "src": "/android-chrome-192x192.png", 7 | "sizes": "192x192", 8 | "type": "image/png" 9 | }, 10 | { 11 | "src": "/android-chrome-256x256.png", 12 | "sizes": "256x256", 13 | "type": "image/png" 14 | } 15 | ], 16 | "theme_color": "#ffffff", 17 | "background_color": "#ffffff", 18 | "display": "standalone" 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/PuerkitoBio/goquery/.gitattributes: -------------------------------------------------------------------------------- 1 | testdata/* linguist-vendored 2 | -------------------------------------------------------------------------------- /vendor/github.com/PuerkitoBio/goquery/.gitignore: -------------------------------------------------------------------------------- 1 | # editor temporary files 2 | *.sublime-* 3 | .DS_Store 4 | *.swp 5 | #*.*# 6 | tags 7 | 8 | # direnv config 9 | .env* 10 | 11 | # test binaries 12 | *.test 13 | 14 | # coverage and profilte outputs 15 | *.out 16 | 17 | -------------------------------------------------------------------------------- /vendor/github.com/PuerkitoBio/goquery/.travis.yml: -------------------------------------------------------------------------------- 1 | arch: 2 | - amd64 3 | - ppc64le 4 | language: go 5 | 6 | go: 7 | - 1.2.x 8 | - 1.3.x 9 | - 1.4.x 10 | - 1.5.x 11 | - 1.6.x 12 | - 1.7.x 13 | - 1.8.x 14 | - 1.9.x 15 | - 1.10.x 16 | - 1.11.x 17 | - 1.12.x 18 | - 1.13.x 19 | - tip 20 | 21 | jobs: 22 | exclude: 23 | - arch: ppc64le 24 | go: 1.2.x 25 | - arch: ppc64le 26 | go: 1.3.x 27 | - arch: ppc64le 28 | go: 1.4.x 29 | - arch: ppc64le 30 | go: 1.5.x 31 | - arch: ppc64le 32 | go: 1.6.x 33 | - arch: ppc64le 34 | go: 1.7.x 35 | - arch: ppc64le 36 | go: 1.8.x 37 | - arch: ppc64le 38 | go: 1.9.x 39 | - arch: ppc64le 40 | go: 1.10.x 41 | - arch: ppc64le 42 | go: 1.11.x 43 | - arch: ppc64le 44 | go: 1.12.x 45 | -------------------------------------------------------------------------------- /vendor/github.com/PuerkitoBio/goquery/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012-2016, Martin Angers & Contributors 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 5 | 6 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 7 | 8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 9 | 10 | * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 11 | 12 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 13 | -------------------------------------------------------------------------------- /vendor/github.com/PuerkitoBio/goquery/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/PuerkitoBio/goquery 2 | 3 | require ( 4 | github.com/andybalholm/cascadia v1.1.0 5 | golang.org/x/net v0.0.0-20200202094626-16171245cfb2 6 | ) 7 | 8 | go 1.13 9 | -------------------------------------------------------------------------------- /vendor/github.com/PuerkitoBio/goquery/go.sum: -------------------------------------------------------------------------------- 1 | github.com/andybalholm/cascadia v1.1.0 h1:BuuO6sSfQNFRu1LppgbD25Hr2vLYW25JvxHs5zzsLTo= 2 | github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y= 3 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 4 | golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 5 | golang.org/x/net v0.0.0-20200202094626-16171245cfb2 h1:CCH4IOTTfewWjGOlSp+zGcjutRKlBEZQ6wTn8ozI/nI= 6 | golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 7 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 8 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 9 | -------------------------------------------------------------------------------- /vendor/github.com/PuerkitoBio/goquery/iteration.go: -------------------------------------------------------------------------------- 1 | package goquery 2 | 3 | // Each iterates over a Selection object, executing a function for each 4 | // matched element. It returns the current Selection object. The function 5 | // f is called for each element in the selection with the index of the 6 | // element in that selection starting at 0, and a *Selection that contains 7 | // only that element. 8 | func (s *Selection) Each(f func(int, *Selection)) *Selection { 9 | for i, n := range s.Nodes { 10 | f(i, newSingleSelection(n, s.document)) 11 | } 12 | return s 13 | } 14 | 15 | // EachWithBreak iterates over a Selection object, executing a function for each 16 | // matched element. It is identical to Each except that it is possible to break 17 | // out of the loop by returning false in the callback function. It returns the 18 | // current Selection object. 19 | func (s *Selection) EachWithBreak(f func(int, *Selection) bool) *Selection { 20 | for i, n := range s.Nodes { 21 | if !f(i, newSingleSelection(n, s.document)) { 22 | return s 23 | } 24 | } 25 | return s 26 | } 27 | 28 | // Map passes each element in the current matched set through a function, 29 | // producing a slice of string holding the returned values. The function 30 | // f is called for each element in the selection with the index of the 31 | // element in that selection starting at 0, and a *Selection that contains 32 | // only that element. 33 | func (s *Selection) Map(f func(int, *Selection) string) (result []string) { 34 | for i, n := range s.Nodes { 35 | result = append(result, f(i, newSingleSelection(n, s.document))) 36 | } 37 | 38 | return result 39 | } 40 | -------------------------------------------------------------------------------- /vendor/github.com/PuerkitoBio/goquery/query.go: -------------------------------------------------------------------------------- 1 | package goquery 2 | 3 | import "golang.org/x/net/html" 4 | 5 | // Is checks the current matched set of elements against a selector and 6 | // returns true if at least one of these elements matches. 7 | func (s *Selection) Is(selector string) bool { 8 | return s.IsMatcher(compileMatcher(selector)) 9 | } 10 | 11 | // IsMatcher checks the current matched set of elements against a matcher and 12 | // returns true if at least one of these elements matches. 13 | func (s *Selection) IsMatcher(m Matcher) bool { 14 | if len(s.Nodes) > 0 { 15 | if len(s.Nodes) == 1 { 16 | return m.Match(s.Nodes[0]) 17 | } 18 | return len(m.Filter(s.Nodes)) > 0 19 | } 20 | 21 | return false 22 | } 23 | 24 | // IsFunction checks the current matched set of elements against a predicate and 25 | // returns true if at least one of these elements matches. 26 | func (s *Selection) IsFunction(f func(int, *Selection) bool) bool { 27 | return s.FilterFunction(f).Length() > 0 28 | } 29 | 30 | // IsSelection checks the current matched set of elements against a Selection object 31 | // and returns true if at least one of these elements matches. 32 | func (s *Selection) IsSelection(sel *Selection) bool { 33 | return s.FilterSelection(sel).Length() > 0 34 | } 35 | 36 | // IsNodes checks the current matched set of elements against the specified nodes 37 | // and returns true if at least one of these elements matches. 38 | func (s *Selection) IsNodes(nodes ...*html.Node) bool { 39 | return s.FilterNodes(nodes...).Length() > 0 40 | } 41 | 42 | // Contains returns true if the specified Node is within, 43 | // at any depth, one of the nodes in the Selection object. 44 | // It is NOT inclusive, to behave like jQuery's implementation, and 45 | // unlike Javascript's .contains, so if the contained 46 | // node is itself in the selection, it returns false. 47 | func (s *Selection) Contains(n *html.Node) bool { 48 | return sliceContains(s.Nodes, n) 49 | } 50 | -------------------------------------------------------------------------------- /vendor/github.com/andybalholm/cascadia/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.3 5 | - 1.4 6 | 7 | install: 8 | - go get github.com/andybalholm/cascadia 9 | 10 | script: 11 | - go test -v 12 | 13 | notifications: 14 | email: false 15 | -------------------------------------------------------------------------------- /vendor/github.com/andybalholm/cascadia/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 Andy Balholm. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 15 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 16 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 17 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 18 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 19 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 20 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /vendor/github.com/andybalholm/cascadia/README.md: -------------------------------------------------------------------------------- 1 | # cascadia 2 | 3 | [![](https://travis-ci.org/andybalholm/cascadia.svg)](https://travis-ci.org/andybalholm/cascadia) 4 | 5 | The Cascadia package implements CSS selectors for use with the parse trees produced by the html package. 6 | 7 | To test CSS selectors without writing Go code, check out [cascadia](https://github.com/suntong/cascadia) the command line tool, a thin wrapper around this package. 8 | 9 | [Refer to godoc here](https://godoc.org/github.com/andybalholm/cascadia). 10 | -------------------------------------------------------------------------------- /vendor/github.com/andybalholm/cascadia/go.mod: -------------------------------------------------------------------------------- 1 | module "github.com/andybalholm/cascadia" 2 | 3 | require "golang.org/x/net" v0.0.0-20180218175443-cbe0f9307d01 4 | -------------------------------------------------------------------------------- /vendor/github.com/andybalholm/cascadia/specificity.go: -------------------------------------------------------------------------------- 1 | package cascadia 2 | 3 | // Specificity is the CSS specificity as defined in 4 | // https://www.w3.org/TR/selectors/#specificity-rules 5 | // with the convention Specificity = [A,B,C]. 6 | type Specificity [3]int 7 | 8 | // returns `true` if s < other (strictly), false otherwise 9 | func (s Specificity) Less(other Specificity) bool { 10 | for i := range s { 11 | if s[i] < other[i] { 12 | return true 13 | } 14 | if s[i] > other[i] { 15 | return false 16 | } 17 | } 18 | return false 19 | } 20 | 21 | func (s Specificity) Add(other Specificity) Specificity { 22 | for i, sp := range other { 23 | s[i] += sp 24 | } 25 | return s 26 | } 27 | -------------------------------------------------------------------------------- /vendor/github.com/beorn7/perks/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2013 Blake Mizerany 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /vendor/github.com/caarlos0/env/.gitignore: -------------------------------------------------------------------------------- 1 | coverage.out 2 | -------------------------------------------------------------------------------- /vendor/github.com/caarlos0/env/.hound.yml: -------------------------------------------------------------------------------- 1 | go: 2 | enabled: true 3 | -------------------------------------------------------------------------------- /vendor/github.com/caarlos0/env/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - 1.5 4 | - 1.6 5 | - 1.7 6 | - 1.8 7 | - 1.9 8 | - '1.10.x' 9 | - '1.11.x' 10 | - tip 11 | before_install: 12 | - go get github.com/axw/gocov/gocov 13 | - go get github.com/mattn/goveralls 14 | - go get golang.org/x/tools/cmd/cover 15 | script: 16 | - go test -v -cover -race -coverprofile=coverage.out 17 | after_script: 18 | - go get github.com/mattn/goveralls 19 | - goveralls -coverprofile=coverage.out -service=travis-ci -repotoken='eCcizKmTdSaJCz8Ih33WDppdqb9kioYwi' 20 | -------------------------------------------------------------------------------- /vendor/github.com/caarlos0/env/LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015-2016 Carlos Alexandro Becker 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/cespare/xxhash/v2/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - "1.x" 4 | - master 5 | env: 6 | - TAGS="" 7 | - TAGS="-tags purego" 8 | script: go test $TAGS -v ./... 9 | -------------------------------------------------------------------------------- /vendor/github.com/cespare/xxhash/v2/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 Caleb Spare 2 | 3 | MIT License 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /vendor/github.com/cespare/xxhash/v2/README.md: -------------------------------------------------------------------------------- 1 | # xxhash 2 | 3 | [![GoDoc](https://godoc.org/github.com/cespare/xxhash?status.svg)](https://godoc.org/github.com/cespare/xxhash) 4 | [![Build Status](https://travis-ci.org/cespare/xxhash.svg?branch=master)](https://travis-ci.org/cespare/xxhash) 5 | 6 | xxhash is a Go implementation of the 64-bit 7 | [xxHash](http://cyan4973.github.io/xxHash/) algorithm, XXH64. This is a 8 | high-quality hashing algorithm that is much faster than anything in the Go 9 | standard library. 10 | 11 | This package provides a straightforward API: 12 | 13 | ``` 14 | func Sum64(b []byte) uint64 15 | func Sum64String(s string) uint64 16 | type Digest struct{ ... } 17 | func New() *Digest 18 | ``` 19 | 20 | The `Digest` type implements hash.Hash64. Its key methods are: 21 | 22 | ``` 23 | func (*Digest) Write([]byte) (int, error) 24 | func (*Digest) WriteString(string) (int, error) 25 | func (*Digest) Sum64() uint64 26 | ``` 27 | 28 | This implementation provides a fast pure-Go implementation and an even faster 29 | assembly implementation for amd64. 30 | 31 | ## Compatibility 32 | 33 | This package is in a module and the latest code is in version 2 of the module. 34 | You need a version of Go with at least "minimal module compatibility" to use 35 | github.com/cespare/xxhash/v2: 36 | 37 | * 1.9.7+ for Go 1.9 38 | * 1.10.3+ for Go 1.10 39 | * Go 1.11 or later 40 | 41 | I recommend using the latest release of Go. 42 | 43 | ## Benchmarks 44 | 45 | Here are some quick benchmarks comparing the pure-Go and assembly 46 | implementations of Sum64. 47 | 48 | | input size | purego | asm | 49 | | --- | --- | --- | 50 | | 5 B | 979.66 MB/s | 1291.17 MB/s | 51 | | 100 B | 7475.26 MB/s | 7973.40 MB/s | 52 | | 4 KB | 17573.46 MB/s | 17602.65 MB/s | 53 | | 10 MB | 17131.46 MB/s | 17142.16 MB/s | 54 | 55 | These numbers were generated on Ubuntu 18.04 with an Intel i7-8700K CPU using 56 | the following commands under Go 1.11.2: 57 | 58 | ``` 59 | $ go test -tags purego -benchtime 10s -bench '/xxhash,direct,bytes' 60 | $ go test -benchtime 10s -bench '/xxhash,direct,bytes' 61 | ``` 62 | 63 | ## Projects using this package 64 | 65 | - [InfluxDB](https://github.com/influxdata/influxdb) 66 | - [Prometheus](https://github.com/prometheus/prometheus) 67 | - [FreeCache](https://github.com/coocood/freecache) 68 | -------------------------------------------------------------------------------- /vendor/github.com/cespare/xxhash/v2/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/cespare/xxhash/v2 2 | 3 | go 1.11 4 | -------------------------------------------------------------------------------- /vendor/github.com/cespare/xxhash/v2/go.sum: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dewey/feedbridge/ee9fbbcc430654770c3ea26fa0bdea49bd044243/vendor/github.com/cespare/xxhash/v2/go.sum -------------------------------------------------------------------------------- /vendor/github.com/cespare/xxhash/v2/xxhash_amd64.go: -------------------------------------------------------------------------------- 1 | // +build !appengine 2 | // +build gc 3 | // +build !purego 4 | 5 | package xxhash 6 | 7 | // Sum64 computes the 64-bit xxHash digest of b. 8 | // 9 | //go:noescape 10 | func Sum64(b []byte) uint64 11 | 12 | //go:noescape 13 | func writeBlocks(d *Digest, b []byte) int 14 | -------------------------------------------------------------------------------- /vendor/github.com/cespare/xxhash/v2/xxhash_other.go: -------------------------------------------------------------------------------- 1 | // +build !amd64 appengine !gc purego 2 | 3 | package xxhash 4 | 5 | // Sum64 computes the 64-bit xxHash digest of b. 6 | func Sum64(b []byte) uint64 { 7 | // A simpler version would be 8 | // d := New() 9 | // d.Write(b) 10 | // return d.Sum64() 11 | // but this is faster, particularly for small inputs. 12 | 13 | n := len(b) 14 | var h uint64 15 | 16 | if n >= 32 { 17 | v1 := prime1v + prime2 18 | v2 := prime2 19 | v3 := uint64(0) 20 | v4 := -prime1v 21 | for len(b) >= 32 { 22 | v1 = round(v1, u64(b[0:8:len(b)])) 23 | v2 = round(v2, u64(b[8:16:len(b)])) 24 | v3 = round(v3, u64(b[16:24:len(b)])) 25 | v4 = round(v4, u64(b[24:32:len(b)])) 26 | b = b[32:len(b):len(b)] 27 | } 28 | h = rol1(v1) + rol7(v2) + rol12(v3) + rol18(v4) 29 | h = mergeRound(h, v1) 30 | h = mergeRound(h, v2) 31 | h = mergeRound(h, v3) 32 | h = mergeRound(h, v4) 33 | } else { 34 | h = prime5 35 | } 36 | 37 | h += uint64(n) 38 | 39 | i, end := 0, len(b) 40 | for ; i+8 <= end; i += 8 { 41 | k1 := round(0, u64(b[i:i+8:len(b)])) 42 | h ^= k1 43 | h = rol27(h)*prime1 + prime4 44 | } 45 | if i+4 <= end { 46 | h ^= uint64(u32(b[i:i+4:len(b)])) * prime1 47 | h = rol23(h)*prime2 + prime3 48 | i += 4 49 | } 50 | for ; i < end; i++ { 51 | h ^= uint64(b[i]) * prime5 52 | h = rol11(h) * prime1 53 | } 54 | 55 | h ^= h >> 33 56 | h *= prime2 57 | h ^= h >> 29 58 | h *= prime3 59 | h ^= h >> 32 60 | 61 | return h 62 | } 63 | 64 | func writeBlocks(d *Digest, b []byte) int { 65 | v1, v2, v3, v4 := d.v1, d.v2, d.v3, d.v4 66 | n := len(b) 67 | for len(b) >= 32 { 68 | v1 = round(v1, u64(b[0:8:len(b)])) 69 | v2 = round(v2, u64(b[8:16:len(b)])) 70 | v3 = round(v3, u64(b[16:24:len(b)])) 71 | v4 = round(v4, u64(b[24:32:len(b)])) 72 | b = b[32:len(b):len(b)] 73 | } 74 | d.v1, d.v2, d.v3, d.v4 = v1, v2, v3, v4 75 | return n - len(b) 76 | } 77 | -------------------------------------------------------------------------------- /vendor/github.com/cespare/xxhash/v2/xxhash_safe.go: -------------------------------------------------------------------------------- 1 | // +build appengine 2 | 3 | // This file contains the safe implementations of otherwise unsafe-using code. 4 | 5 | package xxhash 6 | 7 | // Sum64String computes the 64-bit xxHash digest of s. 8 | func Sum64String(s string) uint64 { 9 | return Sum64([]byte(s)) 10 | } 11 | 12 | // WriteString adds more data to d. It always returns len(s), nil. 13 | func (d *Digest) WriteString(s string) (n int, err error) { 14 | return d.Write([]byte(s)) 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go: -------------------------------------------------------------------------------- 1 | // +build !appengine 2 | 3 | // This file encapsulates usage of unsafe. 4 | // xxhash_safe.go contains the safe implementations. 5 | 6 | package xxhash 7 | 8 | import ( 9 | "reflect" 10 | "unsafe" 11 | ) 12 | 13 | // Notes: 14 | // 15 | // See https://groups.google.com/d/msg/golang-nuts/dcjzJy-bSpw/tcZYBzQqAQAJ 16 | // for some discussion about these unsafe conversions. 17 | // 18 | // In the future it's possible that compiler optimizations will make these 19 | // unsafe operations unnecessary: https://golang.org/issue/2205. 20 | // 21 | // Both of these wrapper functions still incur function call overhead since they 22 | // will not be inlined. We could write Go/asm copies of Sum64 and Digest.Write 23 | // for strings to squeeze out a bit more speed. Mid-stack inlining should 24 | // eventually fix this. 25 | 26 | // Sum64String computes the 64-bit xxHash digest of s. 27 | // It may be faster than Sum64([]byte(s)) by avoiding a copy. 28 | func Sum64String(s string) uint64 { 29 | var b []byte 30 | bh := (*reflect.SliceHeader)(unsafe.Pointer(&b)) 31 | bh.Data = (*reflect.StringHeader)(unsafe.Pointer(&s)).Data 32 | bh.Len = len(s) 33 | bh.Cap = len(s) 34 | return Sum64(b) 35 | } 36 | 37 | // WriteString adds more data to d. It always returns len(s), nil. 38 | // It may be faster than Write([]byte(s)) by avoiding a copy. 39 | func (d *Digest) WriteString(s string) (n int, err error) { 40 | var b []byte 41 | bh := (*reflect.SliceHeader)(unsafe.Pointer(&b)) 42 | bh.Data = (*reflect.StringHeader)(unsafe.Pointer(&s)).Data 43 | bh.Len = len(s) 44 | bh.Cap = len(s) 45 | return d.Write(b) 46 | } 47 | -------------------------------------------------------------------------------- /vendor/github.com/go-chi/chi/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.sw? 3 | .vscode 4 | -------------------------------------------------------------------------------- /vendor/github.com/go-chi/chi/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.10.x 5 | - 1.11.x 6 | - 1.12.x 7 | - 1.13.x 8 | - 1.14.x 9 | 10 | script: 11 | - go get -d -t ./... 12 | - go vet ./... 13 | - go test ./... 14 | - > 15 | go_version=$(go version); 16 | if [ ${go_version:13:4} = "1.12" ]; then 17 | go get -u golang.org/x/tools/cmd/goimports; 18 | goimports -d -e ./ | grep '.*' && { echo; echo "Aborting due to non-empty goimports output."; exit 1; } || :; 19 | fi 20 | 21 | -------------------------------------------------------------------------------- /vendor/github.com/go-chi/chi/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | ## Prerequisites 4 | 5 | 1. [Install Go][go-install]. 6 | 2. Download the sources and switch the working directory: 7 | 8 | ```bash 9 | go get -u -d github.com/go-chi/chi 10 | cd $GOPATH/src/github.com/go-chi/chi 11 | ``` 12 | 13 | ## Submitting a Pull Request 14 | 15 | A typical workflow is: 16 | 17 | 1. [Fork the repository.][fork] [This tip maybe also helpful.][go-fork-tip] 18 | 2. [Create a topic branch.][branch] 19 | 3. Add tests for your change. 20 | 4. Run `go test`. If your tests pass, return to the step 3. 21 | 5. Implement the change and ensure the steps from the previous step pass. 22 | 6. Run `goimports -w .`, to ensure the new code conforms to Go formatting guideline. 23 | 7. [Add, commit and push your changes.][git-help] 24 | 8. [Submit a pull request.][pull-req] 25 | 26 | [go-install]: https://golang.org/doc/install 27 | [go-fork-tip]: http://blog.campoy.cat/2014/03/github-and-go-forking-pull-requests-and.html 28 | [fork]: https://help.github.com/articles/fork-a-repo 29 | [branch]: http://learn.github.com/p/branching.html 30 | [git-help]: https://guides.github.com 31 | [pull-req]: https://help.github.com/articles/using-pull-requests 32 | -------------------------------------------------------------------------------- /vendor/github.com/go-chi/chi/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015-present Peter Kieltyka (https://github.com/pkieltyka), Google Inc. 2 | 3 | MIT License 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /vendor/github.com/go-chi/chi/chain.go: -------------------------------------------------------------------------------- 1 | package chi 2 | 3 | import "net/http" 4 | 5 | // Chain returns a Middlewares type from a slice of middleware handlers. 6 | func Chain(middlewares ...func(http.Handler) http.Handler) Middlewares { 7 | return Middlewares(middlewares) 8 | } 9 | 10 | // Handler builds and returns a http.Handler from the chain of middlewares, 11 | // with `h http.Handler` as the final handler. 12 | func (mws Middlewares) Handler(h http.Handler) http.Handler { 13 | return &ChainHandler{mws, h, chain(mws, h)} 14 | } 15 | 16 | // HandlerFunc builds and returns a http.Handler from the chain of middlewares, 17 | // with `h http.Handler` as the final handler. 18 | func (mws Middlewares) HandlerFunc(h http.HandlerFunc) http.Handler { 19 | return &ChainHandler{mws, h, chain(mws, h)} 20 | } 21 | 22 | // ChainHandler is a http.Handler with support for handler composition and 23 | // execution. 24 | type ChainHandler struct { 25 | Middlewares Middlewares 26 | Endpoint http.Handler 27 | chain http.Handler 28 | } 29 | 30 | func (c *ChainHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { 31 | c.chain.ServeHTTP(w, r) 32 | } 33 | 34 | // chain builds a http.Handler composed of an inline middleware stack and endpoint 35 | // handler in the order they are passed. 36 | func chain(middlewares []func(http.Handler) http.Handler, endpoint http.Handler) http.Handler { 37 | // Return ahead of time if there aren't any middlewares for the chain 38 | if len(middlewares) == 0 { 39 | return endpoint 40 | } 41 | 42 | // Wrap the end handler with the middleware chain 43 | h := middlewares[len(middlewares)-1](endpoint) 44 | for i := len(middlewares) - 2; i >= 0; i-- { 45 | h = middlewares[i](h) 46 | } 47 | 48 | return h 49 | } 50 | -------------------------------------------------------------------------------- /vendor/github.com/go-chi/cors/README.md: -------------------------------------------------------------------------------- 1 | # CORS net/http middleware 2 | 3 | (fork of github.com/rs/cors) 4 | 5 | ## Usage 6 | 7 | ```go 8 | func main() { 9 | r := chi.NewRouter() 10 | 11 | // Basic CORS 12 | // for more ideas, see: https://developer.github.com/v3/#cross-origin-resource-sharing 13 | cors := cors.New(cors.Options{ 14 | // AllowedOrigins: []string{"https://foo.com"}, // Use this to allow specific origin hosts 15 | AllowedOrigins: []string{"*"}, 16 | // AllowOriginFunc: func(r *http.Request, origin string) bool { return true }, 17 | AllowedMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"}, 18 | AllowedHeaders: []string{"Accept", "Authorization", "Content-Type", "X-CSRF-Token"}, 19 | ExposedHeaders: []string{"Link"}, 20 | AllowCredentials: true, 21 | MaxAge: 300, // Maximum value not ignored by any of major browsers 22 | }) 23 | r.Use(cors.Handler) 24 | 25 | r.Get("/", func(w http.ResponseWriter, r *http.Request) { 26 | w.Write([]byte("welcome")) 27 | }) 28 | 29 | http.ListenAndServe(":3000", r) 30 | } 31 | ``` 32 | 33 | -------------------------------------------------------------------------------- /vendor/github.com/go-chi/cors/utils.go: -------------------------------------------------------------------------------- 1 | package cors 2 | 3 | import "strings" 4 | 5 | const toLower = 'a' - 'A' 6 | 7 | type converter func(string) string 8 | 9 | type wildcard struct { 10 | prefix string 11 | suffix string 12 | } 13 | 14 | func (w wildcard) match(s string) bool { 15 | return len(s) >= len(w.prefix+w.suffix) && strings.HasPrefix(s, w.prefix) && strings.HasSuffix(s, w.suffix) 16 | } 17 | 18 | // convert converts a list of string using the passed converter function 19 | func convert(s []string, c converter) []string { 20 | out := []string{} 21 | for _, i := range s { 22 | out = append(out, c(i)) 23 | } 24 | return out 25 | } 26 | 27 | // parseHeaderList tokenize + normalize a string containing a list of headers 28 | func parseHeaderList(headerList string) []string { 29 | l := len(headerList) 30 | h := make([]byte, 0, l) 31 | upper := true 32 | // Estimate the number headers in order to allocate the right splice size 33 | t := 0 34 | for i := 0; i < l; i++ { 35 | if headerList[i] == ',' { 36 | t++ 37 | } 38 | } 39 | headers := make([]string, 0, t) 40 | for i := 0; i < l; i++ { 41 | b := headerList[i] 42 | if b >= 'a' && b <= 'z' { 43 | if upper { 44 | h = append(h, b-toLower) 45 | } else { 46 | h = append(h, b) 47 | } 48 | } else if b >= 'A' && b <= 'Z' { 49 | if !upper { 50 | h = append(h, b+toLower) 51 | } else { 52 | h = append(h, b) 53 | } 54 | } else if b == '-' || (b >= '0' && b <= '9') { 55 | h = append(h, b) 56 | } 57 | 58 | if b == ' ' || b == ',' || i == l-1 { 59 | if len(h) > 0 { 60 | // Flush the found header 61 | headers = append(headers, string(h)) 62 | h = h[:0] 63 | upper = true 64 | } 65 | } else { 66 | upper = b == '-' 67 | } 68 | } 69 | return headers 70 | } 71 | -------------------------------------------------------------------------------- /vendor/github.com/go-kit/kit/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Peter Bourgon 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /vendor/github.com/go-kit/kit/log/json_logger.go: -------------------------------------------------------------------------------- 1 | package log 2 | 3 | import ( 4 | "encoding" 5 | "encoding/json" 6 | "fmt" 7 | "io" 8 | "reflect" 9 | ) 10 | 11 | type jsonLogger struct { 12 | io.Writer 13 | } 14 | 15 | // NewJSONLogger returns a Logger that encodes keyvals to the Writer as a 16 | // single JSON object. Each log event produces no more than one call to 17 | // w.Write. The passed Writer must be safe for concurrent use by multiple 18 | // goroutines if the returned Logger will be used concurrently. 19 | func NewJSONLogger(w io.Writer) Logger { 20 | return &jsonLogger{w} 21 | } 22 | 23 | func (l *jsonLogger) Log(keyvals ...interface{}) error { 24 | n := (len(keyvals) + 1) / 2 // +1 to handle case when len is odd 25 | m := make(map[string]interface{}, n) 26 | for i := 0; i < len(keyvals); i += 2 { 27 | k := keyvals[i] 28 | var v interface{} = ErrMissingValue 29 | if i+1 < len(keyvals) { 30 | v = keyvals[i+1] 31 | } 32 | merge(m, k, v) 33 | } 34 | enc := json.NewEncoder(l.Writer) 35 | enc.SetEscapeHTML(false) 36 | return enc.Encode(m) 37 | } 38 | 39 | func merge(dst map[string]interface{}, k, v interface{}) { 40 | var key string 41 | switch x := k.(type) { 42 | case string: 43 | key = x 44 | case fmt.Stringer: 45 | key = safeString(x) 46 | default: 47 | key = fmt.Sprint(x) 48 | } 49 | 50 | // We want json.Marshaler and encoding.TextMarshaller to take priority over 51 | // err.Error() and v.String(). But json.Marshall (called later) does that by 52 | // default so we force a no-op if it's one of those 2 case. 53 | switch x := v.(type) { 54 | case json.Marshaler: 55 | case encoding.TextMarshaler: 56 | case error: 57 | v = safeError(x) 58 | case fmt.Stringer: 59 | v = safeString(x) 60 | } 61 | 62 | dst[key] = v 63 | } 64 | 65 | func safeString(str fmt.Stringer) (s string) { 66 | defer func() { 67 | if panicVal := recover(); panicVal != nil { 68 | if v := reflect.ValueOf(str); v.Kind() == reflect.Ptr && v.IsNil() { 69 | s = "NULL" 70 | } else { 71 | panic(panicVal) 72 | } 73 | } 74 | }() 75 | s = str.String() 76 | return 77 | } 78 | 79 | func safeError(err error) (s interface{}) { 80 | defer func() { 81 | if panicVal := recover(); panicVal != nil { 82 | if v := reflect.ValueOf(err); v.Kind() == reflect.Ptr && v.IsNil() { 83 | s = nil 84 | } else { 85 | panic(panicVal) 86 | } 87 | } 88 | }() 89 | s = err.Error() 90 | return 91 | } 92 | -------------------------------------------------------------------------------- /vendor/github.com/go-kit/kit/log/level/doc.go: -------------------------------------------------------------------------------- 1 | // Package level implements leveled logging on top of Go kit's log package. To 2 | // use the level package, create a logger as per normal in your func main, and 3 | // wrap it with level.NewFilter. 4 | // 5 | // var logger log.Logger 6 | // logger = log.NewLogfmtLogger(os.Stderr) 7 | // logger = level.NewFilter(logger, level.AllowInfo()) // <-- 8 | // logger = log.With(logger, "ts", log.DefaultTimestampUTC) 9 | // 10 | // Then, at the callsites, use one of the level.Debug, Info, Warn, or Error 11 | // helper methods to emit leveled log events. 12 | // 13 | // logger.Log("foo", "bar") // as normal, no level 14 | // level.Debug(logger).Log("request_id", reqID, "trace_data", trace.Get()) 15 | // if value > 100 { 16 | // level.Error(logger).Log("value", value) 17 | // } 18 | // 19 | // NewFilter allows precise control over what happens when a log event is 20 | // emitted without a level key, or if a squelched level is used. Check the 21 | // Option functions for details. 22 | package level 23 | -------------------------------------------------------------------------------- /vendor/github.com/go-kit/kit/log/logfmt_logger.go: -------------------------------------------------------------------------------- 1 | package log 2 | 3 | import ( 4 | "bytes" 5 | "io" 6 | "sync" 7 | 8 | "github.com/go-logfmt/logfmt" 9 | ) 10 | 11 | type logfmtEncoder struct { 12 | *logfmt.Encoder 13 | buf bytes.Buffer 14 | } 15 | 16 | func (l *logfmtEncoder) Reset() { 17 | l.Encoder.Reset() 18 | l.buf.Reset() 19 | } 20 | 21 | var logfmtEncoderPool = sync.Pool{ 22 | New: func() interface{} { 23 | var enc logfmtEncoder 24 | enc.Encoder = logfmt.NewEncoder(&enc.buf) 25 | return &enc 26 | }, 27 | } 28 | 29 | type logfmtLogger struct { 30 | w io.Writer 31 | } 32 | 33 | // NewLogfmtLogger returns a logger that encodes keyvals to the Writer in 34 | // logfmt format. Each log event produces no more than one call to w.Write. 35 | // The passed Writer must be safe for concurrent use by multiple goroutines if 36 | // the returned Logger will be used concurrently. 37 | func NewLogfmtLogger(w io.Writer) Logger { 38 | return &logfmtLogger{w} 39 | } 40 | 41 | func (l logfmtLogger) Log(keyvals ...interface{}) error { 42 | enc := logfmtEncoderPool.Get().(*logfmtEncoder) 43 | enc.Reset() 44 | defer logfmtEncoderPool.Put(enc) 45 | 46 | if err := enc.EncodeKeyvals(keyvals...); err != nil { 47 | return err 48 | } 49 | 50 | // Add newline to the end of the buffer 51 | if err := enc.EndRecord(); err != nil { 52 | return err 53 | } 54 | 55 | // The Logger interface requires implementations to be safe for concurrent 56 | // use by multiple goroutines. For this implementation that means making 57 | // only one call to l.w.Write() for each call to Log. 58 | if _, err := l.w.Write(enc.buf.Bytes()); err != nil { 59 | return err 60 | } 61 | return nil 62 | } 63 | -------------------------------------------------------------------------------- /vendor/github.com/go-kit/kit/log/nop_logger.go: -------------------------------------------------------------------------------- 1 | package log 2 | 3 | type nopLogger struct{} 4 | 5 | // NewNopLogger returns a logger that doesn't do anything. 6 | func NewNopLogger() Logger { return nopLogger{} } 7 | 8 | func (nopLogger) Log(...interface{}) error { return nil } 9 | -------------------------------------------------------------------------------- /vendor/github.com/go-logfmt/logfmt/.gitignore: -------------------------------------------------------------------------------- 1 | .vscode/ 2 | -------------------------------------------------------------------------------- /vendor/github.com/go-logfmt/logfmt/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | sudo: false 3 | go: 4 | - "1.7.x" 5 | - "1.8.x" 6 | - "1.9.x" 7 | - "1.10.x" 8 | - "1.11.x" 9 | - "1.12.x" 10 | - "1.13.x" 11 | - "tip" 12 | 13 | before_install: 14 | - go get github.com/mattn/goveralls 15 | - go get golang.org/x/tools/cmd/cover 16 | 17 | script: 18 | - goveralls -service=travis-ci 19 | -------------------------------------------------------------------------------- /vendor/github.com/go-logfmt/logfmt/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | All notable changes to this project will be documented in this file. 3 | 4 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 5 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 6 | 7 | ## [0.5.0] - 2020-01-03 8 | 9 | ### Changed 10 | - Remove the dependency on github.com/kr/logfmt by [@ChrisHines] 11 | - Move fuzz code to github.com/go-logfmt/fuzzlogfmt by [@ChrisHines] 12 | 13 | ## [0.4.0] - 2018-11-21 14 | 15 | ### Added 16 | - Go module support by [@ChrisHines] 17 | - CHANGELOG by [@ChrisHines] 18 | 19 | ### Changed 20 | - Drop invalid runes from keys instead of returning ErrInvalidKey by [@ChrisHines] 21 | - On panic while printing, attempt to print panic value by [@bboreham] 22 | 23 | ## [0.3.0] - 2016-11-15 24 | ### Added 25 | - Pool buffers for quoted strings and byte slices by [@nussjustin] 26 | ### Fixed 27 | - Fuzz fix, quote invalid UTF-8 values by [@judwhite] 28 | 29 | ## [0.2.0] - 2016-05-08 30 | ### Added 31 | - Encoder.EncodeKeyvals by [@ChrisHines] 32 | 33 | ## [0.1.0] - 2016-03-28 34 | ### Added 35 | - Encoder by [@ChrisHines] 36 | - Decoder by [@ChrisHines] 37 | - MarshalKeyvals by [@ChrisHines] 38 | 39 | [0.5.0]: https://github.com/go-logfmt/logfmt/compare/v0.4.0...v0.5.0 40 | [0.4.0]: https://github.com/go-logfmt/logfmt/compare/v0.3.0...v0.4.0 41 | [0.3.0]: https://github.com/go-logfmt/logfmt/compare/v0.2.0...v0.3.0 42 | [0.2.0]: https://github.com/go-logfmt/logfmt/compare/v0.1.0...v0.2.0 43 | [0.1.0]: https://github.com/go-logfmt/logfmt/commits/v0.1.0 44 | 45 | [@ChrisHines]: https://github.com/ChrisHines 46 | [@bboreham]: https://github.com/bboreham 47 | [@judwhite]: https://github.com/judwhite 48 | [@nussjustin]: https://github.com/nussjustin 49 | -------------------------------------------------------------------------------- /vendor/github.com/go-logfmt/logfmt/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 go-logfmt 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /vendor/github.com/go-logfmt/logfmt/README.md: -------------------------------------------------------------------------------- 1 | [![GoDoc](https://godoc.org/github.com/go-logfmt/logfmt?status.svg)](https://godoc.org/github.com/go-logfmt/logfmt) 2 | [![Go Report Card](https://goreportcard.com/badge/go-logfmt/logfmt)](https://goreportcard.com/report/go-logfmt/logfmt) 3 | [![TravisCI](https://travis-ci.org/go-logfmt/logfmt.svg?branch=master)](https://travis-ci.org/go-logfmt/logfmt) 4 | [![Coverage Status](https://coveralls.io/repos/github/go-logfmt/logfmt/badge.svg?branch=master)](https://coveralls.io/github/go-logfmt/logfmt?branch=master) 5 | 6 | # logfmt 7 | 8 | Package logfmt implements utilities to marshal and unmarshal data in the [logfmt 9 | format](https://brandur.org/logfmt). It provides an API similar to 10 | [encoding/json](http://golang.org/pkg/encoding/json/) and 11 | [encoding/xml](http://golang.org/pkg/encoding/xml/). 12 | 13 | The logfmt format was first documented by Brandur Leach in [this 14 | article](https://brandur.org/logfmt). The format has not been formally 15 | standardized. The most authoritative public specification to date has been the 16 | documentation of a Go Language [package](http://godoc.org/github.com/kr/logfmt) 17 | written by Blake Mizerany and Keith Rarick. 18 | 19 | ## Goals 20 | 21 | This project attempts to conform as closely as possible to the prior art, while 22 | also removing ambiguity where necessary to provide well behaved encoder and 23 | decoder implementations. 24 | 25 | ## Non-goals 26 | 27 | This project does not attempt to formally standardize the logfmt format. In the 28 | event that logfmt is standardized this project would take conforming to the 29 | standard as a goal. 30 | 31 | ## Versioning 32 | 33 | Package logfmt publishes releases via [semver](http://semver.org/) compatible Git tags prefixed with a single 'v'. 34 | -------------------------------------------------------------------------------- /vendor/github.com/go-logfmt/logfmt/doc.go: -------------------------------------------------------------------------------- 1 | // Package logfmt implements utilities to marshal and unmarshal data in the 2 | // logfmt format. The logfmt format records key/value pairs in a way that 3 | // balances readability for humans and simplicity of computer parsing. It is 4 | // most commonly used as a more human friendly alternative to JSON for 5 | // structured logging. 6 | package logfmt 7 | -------------------------------------------------------------------------------- /vendor/github.com/go-logfmt/logfmt/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/go-logfmt/logfmt 2 | 3 | go 1.13 4 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/envy/.gitignore: -------------------------------------------------------------------------------- 1 | *.log 2 | .DS_Store 3 | doc 4 | tmp 5 | pkg 6 | *.gem 7 | *.pid 8 | coverage 9 | coverage.data 10 | build/* 11 | *.pbxuser 12 | *.mode1v3 13 | .svn 14 | profile 15 | .console_history 16 | .sass-cache/* 17 | .rake_tasks~ 18 | *.log.lck 19 | solr/ 20 | .jhw-cache/ 21 | jhw.* 22 | *.sublime* 23 | node_modules/ 24 | dist/ 25 | generated/ 26 | .vendor/ 27 | bin/* 28 | gin-bin 29 | .idea/ 30 | .env 31 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/envy/.gometalinter.json: -------------------------------------------------------------------------------- 1 | { 2 | "Enable": ["vet", "golint", "goimports", "deadcode", "gotype", "ineffassign", "misspell", "nakedret", "unconvert", "megacheck", "varcheck"] 3 | } 4 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/envy/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | Copyright (c) 2018 Mark Bates 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 5 | 6 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 7 | 8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 9 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/envy/Makefile: -------------------------------------------------------------------------------- 1 | TAGS ?= "sqlite" 2 | GO_BIN ?= go 3 | 4 | install: 5 | packr2 6 | $(GO_BIN) install -v . 7 | 8 | deps: 9 | $(GO_BIN) get github.com/gobuffalo/release 10 | $(GO_BIN) get github.com/gobuffalo/packr/v2/packr2 11 | $(GO_BIN) get -tags ${TAGS} -t ./... 12 | ifeq ($(GO111MODULE),on) 13 | $(GO_BIN) mod tidy 14 | endif 15 | 16 | build: 17 | packr2 18 | $(GO_BIN) build -v . 19 | 20 | test: 21 | packr2 22 | $(GO_BIN) test -tags ${TAGS} ./... 23 | 24 | ci-test: 25 | $(GO_BIN) test -tags ${TAGS} -race ./... 26 | 27 | lint: 28 | gometalinter --vendor ./... --deadline=1m --skip=internal 29 | 30 | update: 31 | $(GO_BIN) get -u -tags ${TAGS} 32 | ifeq ($(GO111MODULE),on) 33 | $(GO_BIN) mod tidy 34 | endif 35 | packr2 36 | make test 37 | make install 38 | ifeq ($(GO111MODULE),on) 39 | $(GO_BIN) mod tidy 40 | endif 41 | 42 | release-test: 43 | $(GO_BIN) test -tags ${TAGS} -race ./... 44 | 45 | release: 46 | release -y -f version.go 47 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/envy/SHOULDERS.md: -------------------------------------------------------------------------------- 1 | # github.com/gobuffalo/envy Stands on the Shoulders of Giants 2 | 3 | github.com/gobuffalo/envy does not try to reinvent the wheel! Instead, it uses the already great wheels developed by the Go community and puts them all together in the best way possible. Without these giants, this project would not be possible. Please make sure to check them out and thank them for all of their hard work. 4 | 5 | Thank you to the following **GIANTS**: 6 | 7 | 8 | * [github.com/davecgh/go-spew](https://godoc.org/github.com/davecgh/go-spew) 9 | 10 | * [github.com/joho/godotenv](https://godoc.org/github.com/joho/godotenv) 11 | 12 | * [github.com/rogpeppe/go-internal](https://godoc.org/github.com/rogpeppe/go-internal) 13 | 14 | * [github.com/stretchr/testify](https://godoc.org/github.com/stretchr/testify) 15 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/envy/azure-pipelines.yml: -------------------------------------------------------------------------------- 1 | variables: 2 | GOBIN: "$(GOPATH)/bin" # Go binaries path 3 | GOPATH: "$(system.defaultWorkingDirectory)/gopath" # Go workspace path 4 | modulePath: "$(GOPATH)/src/github.com/$(build.repository.name)" # Path to the module"s code 5 | 6 | jobs: 7 | - job: Windows 8 | pool: 9 | vmImage: "vs2017-win2016" 10 | strategy: 11 | matrix: 12 | go 1.9: 13 | go_version: "1.9" 14 | go 1.10: 15 | go_version: "1.10" 16 | go 1.11 (on): 17 | go_version: "1.11" 18 | GO111MODULE: "on" 19 | go 1.11 (off): 20 | go_version: "1.11" 21 | GO111MODULE: "off" 22 | steps: 23 | - template: azure-tests.yml 24 | 25 | - job: macOS 26 | pool: 27 | vmImage: "macOS-10.13" 28 | strategy: 29 | matrix: 30 | go 1.9: 31 | go_version: "1.9" 32 | go 1.10: 33 | go_version: "1.10" 34 | go 1.11 (on): 35 | go_version: "1.11" 36 | GO111MODULE: "on" 37 | go 1.11 (off): 38 | go_version: "1.11" 39 | GO111MODULE: "off" 40 | steps: 41 | - template: azure-tests.yml 42 | 43 | - job: Linux 44 | pool: 45 | vmImage: "ubuntu-16.04" 46 | strategy: 47 | matrix: 48 | go 1.9: 49 | go_version: "1.9" 50 | go 1.10: 51 | go_version: "1.10" 52 | go 1.11 (on): 53 | go_version: "1.11" 54 | GO111MODULE: "on" 55 | go 1.11 (off): 56 | go_version: "1.11" 57 | GO111MODULE: "off" 58 | steps: 59 | - template: azure-tests.yml 60 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/envy/azure-tests.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | - task: GoTool@0 3 | inputs: 4 | version: $(go_version) 5 | - task: Bash@3 6 | inputs: 7 | targetType: inline 8 | script: | 9 | mkdir -p "$(GOBIN)" 10 | mkdir -p "$(GOPATH)/pkg" 11 | mkdir -p "$(modulePath)" 12 | shopt -s extglob 13 | mv !(gopath) "$(modulePath)" 14 | displayName: "Setup Go Workspace" 15 | - script: | 16 | go get -t -v ./... 17 | go test -race ./... 18 | workingDirectory: "$(modulePath)" 19 | displayName: "Tests" 20 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/envy/azure.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -xe 4 | 5 | cat >> .env << EOF 6 | # This is a comment 7 | # We can use equal or colon notation 8 | DIR: root 9 | FLAVOUR: none 10 | INSIDE_FOLDER=false 11 | EOF 12 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/envy/env: -------------------------------------------------------------------------------- 1 | # This is a comment 2 | # We can use equal or colon notation 3 | DIR: root 4 | FLAVOUR: none 5 | INSIDE_FOLDER=false -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/envy/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/gobuffalo/envy 2 | 3 | require ( 4 | github.com/davecgh/go-spew v1.1.1 // indirect 5 | github.com/joho/godotenv v1.3.0 6 | github.com/rogpeppe/go-internal v1.1.0 7 | github.com/stretchr/testify v1.3.0 8 | ) 9 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/envy/go.sum: -------------------------------------------------------------------------------- 1 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 2 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 3 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 4 | github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= 5 | github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= 6 | github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= 7 | github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= 8 | github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= 9 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 10 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 11 | github.com/rogpeppe/go-internal v1.1.0 h1:g0fH8RicVgNl+zVZDCDfbdWxAWoAEJyI7I3TZYXFiig= 12 | github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= 13 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 14 | github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= 15 | github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= 16 | gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 17 | gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= 18 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/envy/version.go: -------------------------------------------------------------------------------- 1 | package envy 2 | 3 | const Version = "v1.7.0" 4 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/packd/.gitignore: -------------------------------------------------------------------------------- 1 | *.log 2 | .DS_Store 3 | doc 4 | tmp 5 | pkg 6 | *.gem 7 | *.pid 8 | coverage 9 | coverage.data 10 | build/* 11 | *.pbxuser 12 | *.mode1v3 13 | .svn 14 | profile 15 | .console_history 16 | .sass-cache/* 17 | .rake_tasks~ 18 | *.log.lck 19 | solr/ 20 | .jhw-cache/ 21 | jhw.* 22 | *.sublime* 23 | node_modules/ 24 | dist/ 25 | generated/ 26 | .vendor/ 27 | bin/* 28 | gin-bin 29 | .idea/ 30 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/packd/.gometalinter.json: -------------------------------------------------------------------------------- 1 | { 2 | "Enable": ["vet", "golint", "goimports", "deadcode", "gotype", "ineffassign", "misspell", "nakedret", "unconvert", "megacheck", "varcheck"] 3 | } 4 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/packd/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2019 Mark Bates 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/packd/Makefile: -------------------------------------------------------------------------------- 1 | TAGS ?= "" 2 | GO_BIN ?= "go" 3 | 4 | install: 5 | $(GO_BIN) install -tags ${TAGS} -v . 6 | make tidy 7 | 8 | tidy: 9 | ifeq ($(GO111MODULE),on) 10 | $(GO_BIN) mod tidy 11 | else 12 | echo skipping go mod tidy 13 | endif 14 | 15 | deps: 16 | $(GO_BIN) get -tags ${TAGS} -t ./... 17 | make tidy 18 | 19 | build: 20 | $(GO_BIN) build -v . 21 | make tidy 22 | 23 | test: 24 | $(GO_BIN) test -cover -tags ${TAGS} ./... 25 | make tidy 26 | 27 | ci-deps: 28 | $(GO_BIN) get -tags ${TAGS} -t ./... 29 | 30 | ci-test: 31 | $(GO_BIN) test -tags ${TAGS} -race ./... 32 | 33 | lint: 34 | go get github.com/golangci/golangci-lint/cmd/golangci-lint 35 | golangci-lint run --enable-all 36 | make tidy 37 | 38 | update: 39 | ifeq ($(GO111MODULE),on) 40 | rm go.* 41 | $(GO_BIN) mod init 42 | $(GO_BIN) mod tidy 43 | else 44 | $(GO_BIN) get -u -tags ${TAGS} 45 | endif 46 | make test 47 | make install 48 | make tidy 49 | 50 | release-test: 51 | $(GO_BIN) test -tags ${TAGS} -race ./... 52 | make tidy 53 | 54 | release: 55 | $(GO_BIN) get github.com/gobuffalo/release 56 | make tidy 57 | release -y -f version.go --skip-packr 58 | make tidy 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/packd/README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 |

4 | GoDoc 5 | Build Status 6 | Go Report Card 7 |

8 | 9 | # github.com/gobuffalo/packd 10 | 11 | This is a collection of interfaces designed to make using [github.com/gobuffalo/packr](https://github.com/gobuffalo/packr) easier, and to make the transition between v1 and v2 as seamless as possible. 12 | 13 | They can, and should, be used for testing, alternate Box implementations, etc... 14 | 15 | 16 | ## Installation 17 | 18 | ```bash 19 | $ go get -u -v github.com/gobuffalo/packd 20 | ``` 21 | 22 | ## Memory Box 23 | 24 | The [`packd#MemoryBox`](https://godoc.org/github.com/gobuffalo/packd#MemoryBox) is a complete, thread-safe, implementation of [`packd#Box`](https://godoc.org/github.com/gobuffalo/packd#Box) 25 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/packd/SHOULDERS.md: -------------------------------------------------------------------------------- 1 | # github.com/gobuffalo/packd Stands on the Shoulders of Giants 2 | 3 | github.com/gobuffalo/packd does not try to reinvent the wheel! Instead, it uses the already great wheels developed by the Go community and puts them all together in the best way possible. Without these giants, this project would not be possible. Please make sure to check them out and thank them for all of their hard work. 4 | 5 | Thank you to the following **GIANTS**: 6 | 7 | 8 | * [github.com/davecgh/go-spew](https://godoc.org/github.com/davecgh/go-spew) 9 | 10 | * [github.com/stretchr/testify](https://godoc.org/github.com/stretchr/testify) 11 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/packd/azure-pipelines.yml: -------------------------------------------------------------------------------- 1 | variables: 2 | GOBIN: "$(GOPATH)/bin" # Go binaries path 3 | GOPATH: "$(system.defaultWorkingDirectory)/gopath" # Go workspace path 4 | modulePath: "$(GOPATH)/src/github.com/$(build.repository.name)" # Path to the module"s code 5 | 6 | jobs: 7 | - job: Windows 8 | pool: 9 | vmImage: "vs2017-win2016" 10 | strategy: 11 | matrix: 12 | go 1.10: 13 | go_version: "1.10" 14 | go 1.11 (on): 15 | go_version: "1.11.5" 16 | GO111MODULE: "on" 17 | go 1.11 (off): 18 | go_version: "1.11.5" 19 | GO111MODULE: "off" 20 | go 1.12 (on): 21 | go_version: "1.12" 22 | GO111MODULE: "on" 23 | go 1.12 (off): 24 | go_version: "1.12" 25 | GO111MODULE: "off" 26 | steps: 27 | - template: azure-tests.yml 28 | 29 | - job: macOS 30 | pool: 31 | vmImage: "macOS-10.13" 32 | strategy: 33 | matrix: 34 | go 1.10: 35 | go_version: "1.10" 36 | go 1.11 (on): 37 | go_version: "1.11.5" 38 | GO111MODULE: "on" 39 | go 1.11 (off): 40 | go_version: "1.11.5" 41 | GO111MODULE: "off" 42 | go 1.12 (on): 43 | go_version: "1.12" 44 | GO111MODULE: "on" 45 | go 1.12 (off): 46 | go_version: "1.12" 47 | GO111MODULE: "off" 48 | steps: 49 | - template: azure-tests.yml 50 | 51 | - job: Linux 52 | pool: 53 | vmImage: "ubuntu-16.04" 54 | strategy: 55 | matrix: 56 | go 1.10: 57 | go_version: "1.10" 58 | go 1.11 (on): 59 | go_version: "1.11.5" 60 | GO111MODULE: "on" 61 | go 1.11 (off): 62 | go_version: "1.11.5" 63 | GO111MODULE: "off" 64 | go 1.12 (on): 65 | go_version: "1.12" 66 | GO111MODULE: "on" 67 | go 1.12 (off): 68 | go_version: "1.12" 69 | GO111MODULE: "off" 70 | steps: 71 | - template: azure-tests.yml 72 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/packd/azure-tests.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | - task: GoTool@0 3 | inputs: 4 | version: $(go_version) 5 | - task: Bash@3 6 | inputs: 7 | targetType: inline 8 | script: | 9 | mkdir -p "$(GOBIN)" 10 | mkdir -p "$(GOPATH)/pkg" 11 | mkdir -p "$(modulePath)" 12 | shopt -s extglob 13 | mv !(gopath) "$(modulePath)" 14 | displayName: "Setup Go Workspace" 15 | - script: | 16 | go get -t -v ./... 17 | go test -race ./... 18 | workingDirectory: "$(modulePath)" 19 | displayName: "Tests" 20 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/packd/file_info.go: -------------------------------------------------------------------------------- 1 | package packd 2 | 3 | import ( 4 | "os" 5 | "time" 6 | ) 7 | 8 | var _ os.FileInfo = fileInfo{} 9 | 10 | type fileInfo struct { 11 | Path string 12 | size int64 13 | modTime time.Time 14 | isDir bool 15 | } 16 | 17 | func (f fileInfo) Name() string { 18 | return f.Path 19 | } 20 | 21 | func (f fileInfo) Size() int64 { 22 | return f.size 23 | } 24 | 25 | func (f fileInfo) Mode() os.FileMode { 26 | return 0444 27 | } 28 | 29 | func (f fileInfo) ModTime() time.Time { 30 | return f.modTime 31 | } 32 | 33 | func (f fileInfo) IsDir() bool { 34 | return f.isDir 35 | } 36 | 37 | func (f fileInfo) Sys() interface{} { 38 | return nil 39 | } 40 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/packd/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/gobuffalo/packd 2 | 3 | go 1.12 4 | 5 | require ( 6 | github.com/davecgh/go-spew v1.1.1 // indirect 7 | github.com/stretchr/testify v1.3.0 8 | ) 9 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/packd/go.sum: -------------------------------------------------------------------------------- 1 | github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= 2 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 3 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 4 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 5 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 6 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 7 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 8 | github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= 9 | github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= 10 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/packd/interfaces.go: -------------------------------------------------------------------------------- 1 | package packd 2 | 3 | import ( 4 | "fmt" 5 | "io" 6 | "net/http" 7 | "os" 8 | ) 9 | 10 | type WalkFunc func(string, File) error 11 | 12 | // Box represents the entirety of the necessary 13 | // interfaces to form a "full" box. 14 | // github.com/gobuffalo/packr#Box is an example of this interface. 15 | type Box interface { 16 | HTTPBox 17 | Lister 18 | Addable 19 | Finder 20 | Walkable 21 | Haser 22 | } 23 | 24 | type Haser interface { 25 | Has(string) bool 26 | } 27 | 28 | type Walker interface { 29 | Walk(wf WalkFunc) error 30 | } 31 | 32 | type Walkable interface { 33 | Walker 34 | WalkPrefix(prefix string, wf WalkFunc) error 35 | } 36 | 37 | type Finder interface { 38 | Find(string) ([]byte, error) 39 | FindString(name string) (string, error) 40 | } 41 | 42 | type HTTPBox interface { 43 | Open(name string) (http.File, error) 44 | } 45 | 46 | type Lister interface { 47 | List() []string 48 | } 49 | 50 | type Addable interface { 51 | AddString(path string, t string) error 52 | AddBytes(path string, t []byte) error 53 | } 54 | 55 | type SimpleFile interface { 56 | fmt.Stringer 57 | io.Reader 58 | io.Writer 59 | Name() string 60 | } 61 | 62 | type HTTPFile interface { 63 | SimpleFile 64 | io.Closer 65 | io.Seeker 66 | Readdir(count int) ([]os.FileInfo, error) 67 | Stat() (os.FileInfo, error) 68 | } 69 | 70 | type File interface { 71 | HTTPFile 72 | FileInfo() (os.FileInfo, error) 73 | } 74 | 75 | // LegacyBox represents deprecated methods 76 | // that older Box implementations might have had. 77 | // github.com/gobuffalo/packr v1 is an example of a LegacyBox. 78 | type LegacyBox interface { 79 | String(name string) string 80 | MustString(name string) (string, error) 81 | Bytes(name string) []byte 82 | MustBytes(name string) ([]byte, error) 83 | } 84 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/packd/internal/takeon/github.com/markbates/errx/.gitignore: -------------------------------------------------------------------------------- 1 | *.log 2 | .DS_Store 3 | doc 4 | tmp 5 | pkg 6 | *.gem 7 | *.pid 8 | coverage 9 | coverage.data 10 | build/* 11 | *.pbxuser 12 | *.mode1v3 13 | .svn 14 | profile 15 | .console_history 16 | .sass-cache/* 17 | .rake_tasks~ 18 | *.log.lck 19 | solr/ 20 | .jhw-cache/ 21 | jhw.* 22 | *.sublime* 23 | node_modules/ 24 | dist/ 25 | generated/ 26 | .vendor/ 27 | bin/* 28 | gin-bin 29 | .idea/ 30 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/packd/internal/takeon/github.com/markbates/errx/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2019 Mark Bates 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/packd/internal/takeon/github.com/markbates/errx/Makefile: -------------------------------------------------------------------------------- 1 | TAGS ?= "" 2 | GO_BIN ?= "go" 3 | 4 | install: 5 | $(GO_BIN) install -tags ${TAGS} -v . 6 | make tidy 7 | 8 | tidy: 9 | ifeq ($(GO111MODULE),on) 10 | $(GO_BIN) mod tidy 11 | else 12 | echo skipping go mod tidy 13 | endif 14 | 15 | deps: 16 | $(GO_BIN) get -tags ${TAGS} -t ./... 17 | make tidy 18 | 19 | build: 20 | $(GO_BIN) build -v . 21 | make tidy 22 | 23 | test: 24 | $(GO_BIN) test -cover -tags ${TAGS} ./... 25 | make tidy 26 | 27 | ci-deps: 28 | $(GO_BIN) get -tags ${TAGS} -t ./... 29 | 30 | ci-test: 31 | $(GO_BIN) test -tags ${TAGS} -race ./... 32 | 33 | lint: 34 | go get github.com/golangci/golangci-lint/cmd/golangci-lint 35 | golangci-lint run --enable-all 36 | make tidy 37 | 38 | update: 39 | ifeq ($(GO111MODULE),on) 40 | rm go.* 41 | $(GO_BIN) mod init 42 | $(GO_BIN) mod tidy 43 | else 44 | $(GO_BIN) get -u -tags ${TAGS} 45 | endif 46 | make test 47 | make install 48 | make tidy 49 | 50 | release-test: 51 | $(GO_BIN) test -tags ${TAGS} -race ./... 52 | make tidy 53 | 54 | release: 55 | $(GO_BIN) get github.com/gobuffalo/release 56 | make tidy 57 | release -y -f version.go --skip-packr 58 | make tidy 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/packd/internal/takeon/github.com/markbates/errx/SHOULDERS.md: -------------------------------------------------------------------------------- 1 | # github.com/markbates/errx Stands on the Shoulders of Giants 2 | 3 | github.com/markbates/errx does not try to reinvent the wheel! Instead, it uses the already great wheels developed by the Go community and puts them all together in the best way possible. Without these giants, this project would not be possible. Please make sure to check them out and thank them for all of their hard work. 4 | 5 | Thank you to the following **GIANTS**: 6 | 7 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/packd/internal/takeon/github.com/markbates/errx/azure-pipelines.yml: -------------------------------------------------------------------------------- 1 | variables: 2 | GOBIN: "$(GOPATH)/bin" # Go binaries path 3 | GOPATH: "$(system.defaultWorkingDirectory)/gopath" # Go workspace path 4 | modulePath: "$(GOPATH)/src/github.com/$(build.repository.name)" # Path to the module"s code 5 | 6 | jobs: 7 | - job: Windows 8 | pool: 9 | vmImage: "vs2017-win2016" 10 | strategy: 11 | matrix: 12 | go 1.10: 13 | go_version: "1.10" 14 | go 1.11 (on): 15 | go_version: "1.11.5" 16 | GO111MODULE: "on" 17 | go 1.11 (off): 18 | go_version: "1.11.5" 19 | GO111MODULE: "off" 20 | go 1.12 (on): 21 | go_version: "1.12" 22 | GO111MODULE: "on" 23 | go 1.12 (off): 24 | go_version: "1.12" 25 | GO111MODULE: "off" 26 | steps: 27 | - template: azure-tests.yml 28 | 29 | - job: macOS 30 | pool: 31 | vmImage: "macOS-10.13" 32 | strategy: 33 | matrix: 34 | go 1.10: 35 | go_version: "1.10" 36 | go 1.11 (on): 37 | go_version: "1.11.5" 38 | GO111MODULE: "on" 39 | go 1.11 (off): 40 | go_version: "1.11.5" 41 | GO111MODULE: "off" 42 | go 1.12 (on): 43 | go_version: "1.12" 44 | GO111MODULE: "on" 45 | go 1.12 (off): 46 | go_version: "1.12" 47 | GO111MODULE: "off" 48 | steps: 49 | - template: azure-tests.yml 50 | 51 | - job: Linux 52 | pool: 53 | vmImage: "ubuntu-16.04" 54 | strategy: 55 | matrix: 56 | go 1.10: 57 | go_version: "1.10" 58 | go 1.11 (on): 59 | go_version: "1.11.5" 60 | GO111MODULE: "on" 61 | go 1.11 (off): 62 | go_version: "1.11.5" 63 | GO111MODULE: "off" 64 | go 1.12 (on): 65 | go_version: "1.12" 66 | GO111MODULE: "on" 67 | go 1.12 (off): 68 | go_version: "1.12" 69 | GO111MODULE: "off" 70 | steps: 71 | - template: azure-tests.yml 72 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/packd/internal/takeon/github.com/markbates/errx/azure-tests.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | - task: GoTool@0 3 | inputs: 4 | version: $(go_version) 5 | - task: Bash@3 6 | inputs: 7 | targetType: inline 8 | script: | 9 | mkdir -p "$(GOBIN)" 10 | mkdir -p "$(GOPATH)/pkg" 11 | mkdir -p "$(modulePath)" 12 | shopt -s extglob 13 | mv !(gopath) "$(modulePath)" 14 | displayName: "Setup Go Workspace" 15 | - script: | 16 | go get -t -v ./... 17 | go test -race ./... 18 | workingDirectory: "$(modulePath)" 19 | displayName: "Tests" 20 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/packd/internal/takeon/github.com/markbates/errx/errx.go: -------------------------------------------------------------------------------- 1 | package errx 2 | 3 | // go2 errors 4 | type Wrapper interface { 5 | Unwrap() error 6 | } 7 | 8 | // pkg/errors 9 | type Causer interface { 10 | Cause() error 11 | } 12 | 13 | func Unwrap(err error) error { 14 | switch e := err.(type) { 15 | case Wrapper: 16 | return e.Unwrap() 17 | case Causer: 18 | return e.Cause() 19 | } 20 | return err 21 | } 22 | 23 | var Cause = Unwrap 24 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/packd/internal/takeon/github.com/markbates/errx/version.go: -------------------------------------------------------------------------------- 1 | package errx 2 | 3 | // Version of errx 4 | const Version = "v1.0.0" 5 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/packd/map.go: -------------------------------------------------------------------------------- 1 | package packd 2 | 3 | import ( 4 | "sort" 5 | "sync" 6 | ) 7 | 8 | // ByteMap wraps sync.Map and uses the following types: 9 | // key: string 10 | // value: []byte 11 | type ByteMap struct { 12 | data sync.Map 13 | } 14 | 15 | // Delete the key from the map 16 | func (m *ByteMap) Delete(key string) { 17 | m.data.Delete(key) 18 | } 19 | 20 | // Load the key from the map. 21 | // Returns []byte or bool. 22 | // A false return indicates either the key was not found 23 | // or the value is not of type []byte 24 | func (m *ByteMap) Load(key string) ([]byte, bool) { 25 | i, ok := m.data.Load(key) 26 | if !ok { 27 | return []byte(``), false 28 | } 29 | s, ok := i.([]byte) 30 | return s, ok 31 | } 32 | 33 | // LoadOrStore will return an existing key or 34 | // store the value if not already in the map 35 | func (m *ByteMap) LoadOrStore(key string, value []byte) ([]byte, bool) { 36 | i, _ := m.data.LoadOrStore(key, value) 37 | s, ok := i.([]byte) 38 | return s, ok 39 | } 40 | 41 | // Range over the []byte values in the map 42 | func (m *ByteMap) Range(f func(key string, value []byte) bool) { 43 | m.data.Range(func(k, v interface{}) bool { 44 | key, ok := k.(string) 45 | if !ok { 46 | return false 47 | } 48 | value, ok := v.([]byte) 49 | if !ok { 50 | return false 51 | } 52 | return f(key, value) 53 | }) 54 | } 55 | 56 | // Store a []byte in the map 57 | func (m *ByteMap) Store(key string, value []byte) { 58 | m.data.Store(key, value) 59 | } 60 | 61 | // Keys returns a list of keys in the map 62 | func (m *ByteMap) Keys() []string { 63 | var keys []string 64 | m.Range(func(key string, value []byte) bool { 65 | keys = append(keys, key) 66 | return true 67 | }) 68 | sort.Strings(keys) 69 | return keys 70 | } 71 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/packd/skip_walker.go: -------------------------------------------------------------------------------- 1 | package packd 2 | 3 | import ( 4 | "path/filepath" 5 | "strings" 6 | ) 7 | 8 | var CommonSkipPrefixes = []string{".", "_", "node_modules", "vendor"} 9 | 10 | // SkipWalker will walk the Walker and call the WalkFunc for files who's directories 11 | // do no match any of the skipPrefixes. If no skipPrefixes are passed, then 12 | // CommonSkipPrefixes is used 13 | func SkipWalker(walker Walker, skipPrefixes []string, wf WalkFunc) error { 14 | if len(skipPrefixes) == 0 { 15 | skipPrefixes = append(skipPrefixes, CommonSkipPrefixes...) 16 | } 17 | return walker.Walk(func(path string, file File) error { 18 | fi, err := file.FileInfo() 19 | if err != nil { 20 | return err 21 | } 22 | 23 | path = strings.Replace(path, "\\", "/", -1) 24 | 25 | parts := strings.Split(path, "/") 26 | if !fi.IsDir() { 27 | parts = parts[:len(parts)-1] 28 | } 29 | 30 | for _, base := range parts { 31 | if base != "." { 32 | for _, skip := range skipPrefixes { 33 | skip = strings.ToLower(skip) 34 | lbase := strings.ToLower(base) 35 | if strings.HasPrefix(lbase, skip) { 36 | return filepath.SkipDir 37 | } 38 | } 39 | } 40 | } 41 | return wf(path, file) 42 | }) 43 | } 44 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/packd/version.go: -------------------------------------------------------------------------------- 1 | package packd 2 | 3 | // Version of packd 4 | const Version = "v0.3.0" 5 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/packr/.codeclimate.yml: -------------------------------------------------------------------------------- 1 | --- 2 | engines: 3 | golint: 4 | enabled: true 5 | checks: 6 | GoLint/Naming/MixedCaps: 7 | enabled: false 8 | govet: 9 | enabled: true 10 | gofmt: 11 | enabled: true 12 | fixme: 13 | enabled: true 14 | ratings: 15 | paths: 16 | - "**.go" 17 | exclude_paths: 18 | - "**/*_test.go" 19 | - "*_test.go" 20 | - "fixtures/" 21 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/packr/.gitignore: -------------------------------------------------------------------------------- 1 | *.log 2 | ./packr2 3 | .DS_Store 4 | doc 5 | tmp 6 | pkg 7 | *.gem 8 | *.pid 9 | coverage 10 | coverage.data 11 | build/* 12 | *.pbxuser 13 | *.mode1v3 14 | .svn 15 | profile 16 | .console_history 17 | .sass-cache/* 18 | .rake_tasks~ 19 | *.log.lck 20 | solr/ 21 | .jhw-cache/ 22 | jhw.* 23 | *.sublime* 24 | node_modules/ 25 | dist/ 26 | generated/ 27 | .vendor/ 28 | bin/* 29 | gin-bin 30 | /packr_darwin_amd64 31 | /packr_linux_amd64 32 | .vscode/ 33 | debug.test 34 | .grifter/ 35 | *-packr.go 36 | 37 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/packr/.gometalinter.json: -------------------------------------------------------------------------------- 1 | { 2 | "Enable": ["vet", "golint", "goimports", "deadcode", "gotype", "ineffassign", "misspell", "nakedret", "unconvert", "megacheck", "varcheck"] 3 | } 4 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/packr/.goreleaser.yml: -------------------------------------------------------------------------------- 1 | # Code generated by github.com/gobuffalo/release. DO NOT EDIT. 2 | # Edit .goreleaser.yml.plush instead 3 | 4 | builds: 5 | - 6 | goos: 7 | - darwin 8 | - linux 9 | - windows 10 | env: 11 | - CGO_ENABLED=0 12 | main: ./packr/main.go 13 | binary: packr 14 | 15 | checksum: 16 | name_template: 'checksums.txt' 17 | 18 | snapshot: 19 | name_template: "{{ .Tag }}-next" 20 | 21 | changelog: 22 | sort: asc 23 | filters: 24 | exclude: 25 | - '^docs:' 26 | - '^test:' 27 | 28 | brew: 29 | github: 30 | owner: gobuffalo 31 | name: homebrew-tap 32 | 33 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/packr/.goreleaser.yml.plush: -------------------------------------------------------------------------------- 1 | builds: 2 | - 3 | goos: 4 | - darwin 5 | - linux 6 | - windows 7 | env: 8 | - CGO_ENABLED=0 9 | main: ./packr/main.go 10 | binary: packr 11 | 12 | checksum: 13 | name_template: 'checksums.txt' 14 | 15 | snapshot: 16 | name_template: "{{ .Tag }}-next" 17 | 18 | changelog: 19 | sort: asc 20 | filters: 21 | exclude: 22 | - '^docs:' 23 | - '^test:' 24 | <%= if (brew) { %> 25 | brew: 26 | github: 27 | owner: gobuffalo 28 | name: homebrew-tap 29 | <% } %> 30 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/packr/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | Copyright (c) 2016 Mark Bates 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 5 | 6 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 7 | 8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 9 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/packr/Makefile: -------------------------------------------------------------------------------- 1 | TAGS ?= "sqlite" 2 | GO_BIN ?= go 3 | 4 | install: deps 5 | echo "installing packr v1" 6 | packr 7 | $(GO_BIN) install -v ./packr 8 | 9 | tidy: 10 | ifeq ($(GO111MODULE),on) 11 | $(GO_BIN) mod tidy 12 | else 13 | echo skipping go mod tidy 14 | endif 15 | 16 | deps: 17 | rm -rf packrd 18 | rm -rf v2/packrd 19 | $(GO_BIN) get github.com/gobuffalo/release 20 | $(GO_BIN) get -tags ${TAGS} -t ./... 21 | $(GO_BIN) install -v ./packr 22 | packr clean 23 | make tidy 24 | 25 | build: deps 26 | packr 27 | $(GO_BIN) build -v . 28 | make tidy 29 | 30 | test: 31 | packr clean 32 | $(GO_BIN) test -tags ${TAGS} ./... 33 | packr clean 34 | 35 | ci-deps: 36 | rm -rf packrd 37 | rm -rf v2/packrd 38 | $(GO_BIN) get -tags ${TAGS} -t ./... 39 | $(GO_BIN) install -v ./packr 40 | packr clean 41 | make tidy 42 | 43 | ci-test: 44 | $(GO_BIN) test -v -tags ${TAGS} -race ./... 45 | make tidy 46 | cd ./v2 && make ci-test 47 | 48 | lint: 49 | gometalinter --vendor ./... --deadline=1m --skip=internal 50 | 51 | update: 52 | $(GO_BIN) get -u -tags ${TAGS} 53 | make tidy 54 | packr 55 | make test 56 | make install 57 | make tidy 58 | 59 | release-test: 60 | $(GO_BIN) test -tags ${TAGS} -race ./... 61 | 62 | release: 63 | release -y -f version.go 64 | make tidy 65 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/packr/SHOULDERS.md: -------------------------------------------------------------------------------- 1 | # github.com/gobuffalo/packr Stands on the Shoulders of Giants 2 | 3 | github.com/gobuffalo/packr does not try to reinvent the wheel! Instead, it uses the already great wheels developed by the Go community and puts them all together in the best way possible. Without these giants, this project would not be possible. Please make sure to check them out and thank them for all of their hard work. 4 | 5 | Thank you to the following **GIANTS**: 6 | 7 | 8 | * [github.com/gobuffalo/envy](https://godoc.org/github.com/gobuffalo/envy) 9 | 10 | * [github.com/gobuffalo/packd](https://godoc.org/github.com/gobuffalo/packd) 11 | 12 | * [github.com/gobuffalo/packr/v2](https://godoc.org/github.com/gobuffalo/packr/v2) 13 | 14 | * [github.com/spf13/cobra](https://godoc.org/github.com/spf13/cobra) 15 | 16 | * [github.com/stretchr/testify](https://godoc.org/github.com/stretchr/testify) 17 | 18 | * [golang.org/x/sync](https://godoc.org/golang.org/x/sync) 19 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/packr/azure-pipelines.yml: -------------------------------------------------------------------------------- 1 | variables: 2 | GOBIN: "$(GOPATH)/bin" # Go binaries path 3 | GOPATH: "$(system.defaultWorkingDirectory)/gopath" # Go workspace path 4 | modulePath: "$(GOPATH)/src/github.com/$(build.repository.name)" # Path to the module"s code 5 | 6 | jobs: 7 | - job: Windows 8 | pool: 9 | vmImage: "vs2017-win2016" 10 | strategy: 11 | matrix: 12 | go 1.10: 13 | go_version: "1.10" 14 | go 1.11 (on): 15 | go_version: "1.11.5" 16 | GO111MODULE: "on" 17 | go 1.11 (off): 18 | go_version: "1.11.5" 19 | GO111MODULE: "off" 20 | go 1.12 (on): 21 | go_version: "1.12" 22 | GO111MODULE: "on" 23 | go 1.12 (off): 24 | go_version: "1.12" 25 | GO111MODULE: "off" 26 | steps: 27 | - template: azure-tests.yml 28 | 29 | - job: macOS 30 | pool: 31 | vmImage: "macOS-10.13" 32 | strategy: 33 | matrix: 34 | go 1.10: 35 | go_version: "1.10" 36 | go 1.11 (on): 37 | go_version: "1.11.5" 38 | GO111MODULE: "on" 39 | go 1.11 (off): 40 | go_version: "1.11.5" 41 | GO111MODULE: "off" 42 | go 1.12 (on): 43 | go_version: "1.12" 44 | GO111MODULE: "on" 45 | go 1.12 (off): 46 | go_version: "1.12" 47 | GO111MODULE: "off" 48 | steps: 49 | - template: azure-tests.yml 50 | 51 | - job: Linux 52 | pool: 53 | vmImage: "ubuntu-16.04" 54 | strategy: 55 | matrix: 56 | go 1.10: 57 | go_version: "1.10" 58 | go 1.11 (on): 59 | go_version: "1.11.5" 60 | GO111MODULE: "on" 61 | go 1.11 (off): 62 | go_version: "1.11.5" 63 | GO111MODULE: "off" 64 | go 1.12 (on): 65 | go_version: "1.12" 66 | GO111MODULE: "on" 67 | go 1.12 (off): 68 | go_version: "1.12" 69 | GO111MODULE: "off" 70 | steps: 71 | - template: azure-tests.yml 72 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/packr/azure-tests.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | - task: GoTool@0 3 | inputs: 4 | version: $(go_version) 5 | - task: Bash@3 6 | inputs: 7 | targetType: inline 8 | script: | 9 | mkdir -p "$(GOBIN)" 10 | mkdir -p "$(GOPATH)/pkg" 11 | mkdir -p "$(modulePath)" 12 | shopt -s extglob 13 | mv !(gopath) "$(modulePath)" 14 | displayName: "Setup Go Workspace" 15 | - script: | 16 | go get -t -v ./... 17 | go test -race ./... 18 | go install -v ./packr 19 | cd v2 20 | go get -t -v ./... 21 | go test -race ./... 22 | go install -v ./packr2 23 | workingDirectory: "$(modulePath)" 24 | displayName: "Tests" 25 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/packr/env.go: -------------------------------------------------------------------------------- 1 | package packr 2 | 3 | import ( 4 | "github.com/gobuffalo/envy" 5 | ) 6 | 7 | // GoPath returns the current GOPATH env var 8 | // or if it's missing, the default. 9 | var GoPath = envy.GoPath 10 | 11 | // GoBin returns the current GO_BIN env var 12 | // or if it's missing, a default of "go" 13 | var GoBin = envy.GoBin 14 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/packr/file.go: -------------------------------------------------------------------------------- 1 | package packr 2 | 3 | import "github.com/gobuffalo/packd" 4 | 5 | type File = packd.File 6 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/packr/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/gobuffalo/packr 2 | 3 | go 1.12 4 | 5 | require ( 6 | github.com/gobuffalo/envy v1.7.0 7 | github.com/gobuffalo/packd v0.3.0 8 | github.com/gobuffalo/packr/v2 v2.5.1 9 | github.com/spf13/cobra v0.0.5 10 | github.com/stretchr/testify v1.3.0 11 | golang.org/x/sync v0.0.0-20190423024810-112230192c58 12 | ) 13 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/packr/packr.go: -------------------------------------------------------------------------------- 1 | package packr 2 | 3 | import ( 4 | "bytes" 5 | "compress/gzip" 6 | "encoding/json" 7 | "runtime" 8 | "strings" 9 | "sync" 10 | ) 11 | 12 | var gil = &sync.Mutex{} 13 | var data = map[string]map[string][]byte{} 14 | 15 | // PackBytes packs bytes for a file into a box. 16 | func PackBytes(box string, name string, bb []byte) { 17 | gil.Lock() 18 | defer gil.Unlock() 19 | if _, ok := data[box]; !ok { 20 | data[box] = map[string][]byte{} 21 | } 22 | data[box][name] = bb 23 | } 24 | 25 | // PackBytesGzip packets the gzipped compressed bytes into a box. 26 | func PackBytesGzip(box string, name string, bb []byte) error { 27 | var buf bytes.Buffer 28 | w := gzip.NewWriter(&buf) 29 | _, err := w.Write(bb) 30 | if err != nil { 31 | return err 32 | } 33 | err = w.Close() 34 | if err != nil { 35 | return err 36 | } 37 | PackBytes(box, name, buf.Bytes()) 38 | return nil 39 | } 40 | 41 | // PackJSONBytes packs JSON encoded bytes for a file into a box. 42 | func PackJSONBytes(box string, name string, jbb string) error { 43 | var bb []byte 44 | err := json.Unmarshal([]byte(jbb), &bb) 45 | if err != nil { 46 | return err 47 | } 48 | PackBytes(box, name, bb) 49 | return nil 50 | } 51 | 52 | // UnpackBytes unpacks bytes for specific box. 53 | func UnpackBytes(box string) { 54 | gil.Lock() 55 | defer gil.Unlock() 56 | delete(data, box) 57 | } 58 | 59 | func osPaths(paths ...string) []string { 60 | if runtime.GOOS == "windows" { 61 | for i, path := range paths { 62 | paths[i] = strings.Replace(path, "/", "\\", -1) 63 | } 64 | } 65 | 66 | return paths 67 | } 68 | 69 | func osPath(path string) string { 70 | if runtime.GOOS == "windows" { 71 | return strings.Replace(path, "/", "\\", -1) 72 | } 73 | return path 74 | } 75 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/packr/version.go: -------------------------------------------------------------------------------- 1 | package packr 2 | 3 | const Version = "v1.30.1" 4 | -------------------------------------------------------------------------------- /vendor/github.com/gobuffalo/packr/walk.go: -------------------------------------------------------------------------------- 1 | package packr 2 | 3 | import ( 4 | "os" 5 | "path/filepath" 6 | "strings" 7 | 8 | "github.com/gobuffalo/packd" 9 | ) 10 | 11 | type WalkFunc = packd.WalkFunc 12 | 13 | // Walk will traverse the box and call the WalkFunc for each file in the box/folder. 14 | func (b Box) Walk(wf WalkFunc) error { 15 | if data[b.Path] == nil { 16 | base, err := filepath.EvalSymlinks(filepath.Join(b.callingDir, b.Path)) 17 | if err != nil { 18 | return err 19 | } 20 | return filepath.Walk(base, func(path string, info os.FileInfo, err error) error { 21 | cleanName, err := filepath.Rel(base, path) 22 | if err != nil { 23 | cleanName = strings.TrimPrefix(path, base) 24 | } 25 | cleanName = filepath.ToSlash(filepath.Clean(cleanName)) 26 | cleanName = strings.TrimPrefix(cleanName, "/") 27 | cleanName = filepath.FromSlash(cleanName) 28 | if info == nil || info.IsDir() { 29 | return nil 30 | } 31 | 32 | file, err := fileFor(path, cleanName) 33 | if err != nil { 34 | return err 35 | } 36 | return wf(cleanName, file) 37 | }) 38 | } 39 | for n := range data[b.Path] { 40 | f, err := b.find(n) 41 | if err != nil { 42 | return err 43 | } 44 | err = wf(n, f) 45 | if err != nil { 46 | return err 47 | } 48 | } 49 | return nil 50 | } 51 | 52 | // WalkPrefix will call box.Walk and call the WalkFunc when it finds paths that have a matching prefix 53 | func (b Box) WalkPrefix(prefix string, wf WalkFunc) error { 54 | opre := osPath(prefix) 55 | return b.Walk(func(path string, f File) error { 56 | if strings.HasPrefix(osPath(path), opre) { 57 | if err := wf(path, f); err != nil { 58 | return err 59 | } 60 | } 61 | return nil 62 | }) 63 | } 64 | -------------------------------------------------------------------------------- /vendor/github.com/golang/protobuf/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/github.com/golang/protobuf/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/github.com/golang/protobuf/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2010 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | 29 | -------------------------------------------------------------------------------- /vendor/github.com/google/btree/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | -------------------------------------------------------------------------------- /vendor/github.com/google/btree/README.md: -------------------------------------------------------------------------------- 1 | # BTree implementation for Go 2 | 3 | ![Travis CI Build Status](https://api.travis-ci.org/google/btree.svg?branch=master) 4 | 5 | This package provides an in-memory B-Tree implementation for Go, useful as 6 | an ordered, mutable data structure. 7 | 8 | The API is based off of the wonderful 9 | http://godoc.org/github.com/petar/GoLLRB/llrb, and is meant to allow btree to 10 | act as a drop-in replacement for gollrb trees. 11 | 12 | See http://godoc.org/github.com/google/btree for documentation. 13 | -------------------------------------------------------------------------------- /vendor/github.com/gorilla/feeds/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | sudo: false 3 | matrix: 4 | include: 5 | - go: 1.8 6 | - go: 1.9 7 | - go: "1.10" 8 | - go: 1.x 9 | - go: tip 10 | allow_failures: 11 | - go: tip 12 | script: 13 | - go get -t -v ./... 14 | - diff -u <(echo -n) <(gofmt -d -s .) 15 | - go vet . 16 | - go test -v -race ./... 17 | -------------------------------------------------------------------------------- /vendor/github.com/gorilla/feeds/AUTHORS: -------------------------------------------------------------------------------- 1 | # This is the official list of gorilla/feeds authors for copyright purposes. 2 | # Please keep the list sorted. 3 | 4 | Dmitry Chestnykh 5 | Eddie Scholtz 6 | Gabriel Simmer 7 | Google LLC (https://opensource.google.com/) 8 | honky 9 | James Gregory 10 | Jason Hall 11 | Jason Moiron 12 | Kamil Kisiel 13 | Kevin Stock 14 | Markus Zimmermann 15 | Matt Silverlock 16 | Matthew Dawson 17 | Milan Aleksic 18 | Milan Aleksić 19 | nlimpid 20 | Paul Petring 21 | Sean Enck 22 | Sue Spence 23 | Supermighty 24 | Toru Fukui 25 | Vabd 26 | Volker 27 | ZhiFeng Hu 28 | weberc2 29 | 30 | -------------------------------------------------------------------------------- /vendor/github.com/gorilla/feeds/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013-2018 The Gorilla Feeds Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are met: 5 | 6 | Redistributions of source code must retain the above copyright notice, this 7 | list of conditions and the following disclaimer. 8 | 9 | Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 14 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 17 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 19 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 20 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 21 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | -------------------------------------------------------------------------------- /vendor/github.com/gorilla/feeds/to-implement.md: -------------------------------------------------------------------------------- 1 | [Full iTunes list](https://help.apple.com/itc/podcasts_connect/#/itcb54353390) 2 | 3 | [Example of ideal iTunes RSS feed](https://help.apple.com/itc/podcasts_connect/#/itcbaf351599) 4 | 5 | ``` 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | ``` -------------------------------------------------------------------------------- /vendor/github.com/gorilla/feeds/uuid.go: -------------------------------------------------------------------------------- 1 | package feeds 2 | 3 | // relevant bits from https://github.com/abneptis/GoUUID/blob/master/uuid.go 4 | 5 | import ( 6 | "crypto/rand" 7 | "fmt" 8 | ) 9 | 10 | type UUID [16]byte 11 | 12 | // create a new uuid v4 13 | func NewUUID() *UUID { 14 | u := &UUID{} 15 | _, err := rand.Read(u[:16]) 16 | if err != nil { 17 | panic(err) 18 | } 19 | 20 | u[8] = (u[8] | 0x80) & 0xBf 21 | u[6] = (u[6] | 0x40) & 0x4f 22 | return u 23 | } 24 | 25 | func (u *UUID) String() string { 26 | return fmt.Sprintf("%x-%x-%x-%x-%x", u[:4], u[4:6], u[6:8], u[8:10], u[10:]) 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/joho/godotenv/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /vendor/github.com/joho/godotenv/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.x 5 | 6 | os: 7 | - linux 8 | - osx 9 | -------------------------------------------------------------------------------- /vendor/github.com/joho/godotenv/LICENCE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 John Barton 2 | 3 | MIT License 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | -------------------------------------------------------------------------------- /vendor/github.com/matttproud/golang_protobuf_extensions/NOTICE: -------------------------------------------------------------------------------- 1 | Copyright 2012 Matt T. Proud (matt.proud@gmail.com) 2 | -------------------------------------------------------------------------------- /vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/.gitignore: -------------------------------------------------------------------------------- 1 | cover.dat 2 | -------------------------------------------------------------------------------- /vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | 3 | cover: 4 | go test -cover -v -coverprofile=cover.dat ./... 5 | go tool cover -func cover.dat 6 | 7 | .PHONY: cover 8 | -------------------------------------------------------------------------------- /vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 Matt T. Proud 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // Package pbutil provides record length-delimited Protocol Buffer streaming. 16 | package pbutil 17 | -------------------------------------------------------------------------------- /vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/encode.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 Matt T. Proud 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package pbutil 16 | 17 | import ( 18 | "encoding/binary" 19 | "io" 20 | 21 | "github.com/golang/protobuf/proto" 22 | ) 23 | 24 | // WriteDelimited encodes and dumps a message to the provided writer prefixed 25 | // with a 32-bit varint indicating the length of the encoded message, producing 26 | // a length-delimited record stream, which can be used to chain together 27 | // encoded messages of the same type together in a file. It returns the total 28 | // number of bytes written and any applicable error. This is roughly 29 | // equivalent to the companion Java API's MessageLite#writeDelimitedTo. 30 | func WriteDelimited(w io.Writer, m proto.Message) (n int, err error) { 31 | buffer, err := proto.Marshal(m) 32 | if err != nil { 33 | return 0, err 34 | } 35 | 36 | var buf [binary.MaxVarintLen32]byte 37 | encodedLength := binary.PutUvarint(buf[:], uint64(len(buffer))) 38 | 39 | sync, err := w.Write(buf[:encodedLength]) 40 | if err != nil { 41 | return sync, err 42 | } 43 | 44 | n, err = w.Write(buffer) 45 | return n + sync, err 46 | } 47 | -------------------------------------------------------------------------------- /vendor/github.com/mauidude/go-readability/README.md: -------------------------------------------------------------------------------- 1 | go-readability 2 | ============== 3 | 4 | go-readability is library for extracting the main content off of an HTML page. This library implements the readability algorithm created by arc90 labs and was heavily inspired by https://github.com/cantino/ruby-readability. 5 | 6 | Installation 7 | ------------ 8 | 9 | `go get github.com/mauidude/go-readability` 10 | 11 | Example 12 | ------- 13 | 14 | ``` 15 | import( 16 | "github.com/mauidude/go-readability" 17 | ) 18 | 19 | ... 20 | 21 | doc, err := readability.NewDocument(html) 22 | if err != nil { 23 | // do something ... 24 | } 25 | 26 | content := doc.Content() 27 | // do something with my content 28 | 29 | ``` 30 | 31 | 32 | Tests 33 | ----- 34 | 35 | To run tests 36 | `go test github.com/mauidude/go-readability` 37 | -------------------------------------------------------------------------------- /vendor/github.com/mmcdole/gofeed/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | *.prof 25 | 26 | .DS_STORE 27 | -------------------------------------------------------------------------------- /vendor/github.com/mmcdole/gofeed/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - tip 4 | - 1.6 5 | - 1.5 6 | - 1.4 7 | install: 8 | - go get -t -v ./... 9 | - go get github.com/go-playground/overalls 10 | - go get github.com/mattn/goveralls 11 | - go get golang.org/x/tools/cmd/cover 12 | script: 13 | - go test -v ./... 14 | - $GOPATH/bin/overalls -project=github.com/mmcdole/gofeed -covermode=count -ignore=.git,vendor -debug 15 | after_success: 16 | - $GOPATH/bin/goveralls -coverprofile=overalls.coverprofile -service=travis-ci 17 | -------------------------------------------------------------------------------- /vendor/github.com/mmcdole/gofeed/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 mmcdole 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/mmcdole/gofeed/detector.go: -------------------------------------------------------------------------------- 1 | package gofeed 2 | 3 | import ( 4 | "io" 5 | "strings" 6 | 7 | "github.com/mmcdole/gofeed/internal/shared" 8 | "github.com/mmcdole/goxpp" 9 | ) 10 | 11 | // FeedType represents one of the possible feed 12 | // types that we can detect. 13 | type FeedType int 14 | 15 | const ( 16 | // FeedTypeUnknown represents a feed that could not have its 17 | // type determiend. 18 | FeedTypeUnknown FeedType = iota 19 | // FeedTypeAtom repesents an Atom feed 20 | FeedTypeAtom 21 | // FeedTypeRSS represents an RSS feed 22 | FeedTypeRSS 23 | ) 24 | 25 | // DetectFeedType attempts to determine the type of feed 26 | // by looking for specific xml elements unique to the 27 | // various feed types. 28 | func DetectFeedType(feed io.Reader) FeedType { 29 | p := xpp.NewXMLPullParser(feed, false, shared.NewReaderLabel) 30 | 31 | _, err := shared.FindRoot(p) 32 | if err != nil { 33 | return FeedTypeUnknown 34 | } 35 | 36 | name := strings.ToLower(p.Name) 37 | switch name { 38 | case "rdf": 39 | return FeedTypeRSS 40 | case "rss": 41 | return FeedTypeRSS 42 | case "feed": 43 | return FeedTypeAtom 44 | default: 45 | return FeedTypeUnknown 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /vendor/github.com/mmcdole/gofeed/extensions/dublincore.go: -------------------------------------------------------------------------------- 1 | package ext 2 | 3 | // DublinCoreExtension represents a feed extension 4 | // for the Dublin Core specification. 5 | type DublinCoreExtension struct { 6 | Title []string `json:"title,omitempty"` 7 | Creator []string `json:"creator,omitempty"` 8 | Author []string `json:"author,omitempty"` 9 | Subject []string `json:"subject,omitempty"` 10 | Description []string `json:"description,omitempty"` 11 | Publisher []string `json:"publisher,omitempty"` 12 | Contributor []string `json:"contributor,omitempty"` 13 | Date []string `json:"date,omitempty"` 14 | Type []string `json:"type,omitempty"` 15 | Format []string `json:"format,omitempty"` 16 | Identifier []string `json:"identifier,omitempty"` 17 | Source []string `json:"source,omitempty"` 18 | Language []string `json:"language,omitempty"` 19 | Relation []string `json:"relation,omitempty"` 20 | Coverage []string `json:"coverage,omitempty"` 21 | Rights []string `json:"rights,omitempty"` 22 | } 23 | 24 | // NewDublinCoreExtension creates a new DublinCoreExtension 25 | // given the generic extension map for the "dc" prefix. 26 | func NewDublinCoreExtension(extensions map[string][]Extension) *DublinCoreExtension { 27 | dc := &DublinCoreExtension{} 28 | dc.Title = parseTextArrayExtension("title", extensions) 29 | dc.Creator = parseTextArrayExtension("creator", extensions) 30 | dc.Author = parseTextArrayExtension("author", extensions) 31 | dc.Subject = parseTextArrayExtension("subject", extensions) 32 | dc.Description = parseTextArrayExtension("description", extensions) 33 | dc.Publisher = parseTextArrayExtension("publisher", extensions) 34 | dc.Contributor = parseTextArrayExtension("contributor", extensions) 35 | dc.Date = parseTextArrayExtension("date", extensions) 36 | dc.Type = parseTextArrayExtension("type", extensions) 37 | dc.Format = parseTextArrayExtension("format", extensions) 38 | dc.Identifier = parseTextArrayExtension("identifier", extensions) 39 | dc.Source = parseTextArrayExtension("source", extensions) 40 | dc.Language = parseTextArrayExtension("language", extensions) 41 | dc.Relation = parseTextArrayExtension("relation", extensions) 42 | dc.Coverage = parseTextArrayExtension("coverage", extensions) 43 | dc.Rights = parseTextArrayExtension("rights", extensions) 44 | return dc 45 | } 46 | -------------------------------------------------------------------------------- /vendor/github.com/mmcdole/gofeed/extensions/extensions.go: -------------------------------------------------------------------------------- 1 | package ext 2 | 3 | // Extensions is the generic extension map for Feeds and Items. 4 | // The first map is for the element namespace prefix (e.g., itunes). 5 | // The second map is for the element name (e.g., author). 6 | type Extensions map[string]map[string][]Extension 7 | 8 | // Extension represents a single XML element that was in a non 9 | // default namespace in a Feed or Item/Entry. 10 | type Extension struct { 11 | Name string `json:"name"` 12 | Value string `json:"value"` 13 | Attrs map[string]string `json:"attrs"` 14 | Children map[string][]Extension `json:"children"` 15 | } 16 | 17 | func parseTextExtension(name string, extensions map[string][]Extension) (value string) { 18 | if extensions == nil { 19 | return 20 | } 21 | 22 | matches, ok := extensions[name] 23 | if !ok || len(matches) == 0 { 24 | return 25 | } 26 | 27 | match := matches[0] 28 | return match.Value 29 | } 30 | 31 | func parseTextArrayExtension(name string, extensions map[string][]Extension) (values []string) { 32 | if extensions == nil { 33 | return 34 | } 35 | 36 | matches, ok := extensions[name] 37 | if !ok || len(matches) == 0 { 38 | return 39 | } 40 | 41 | values = []string{} 42 | for _, m := range matches { 43 | values = append(values, m.Value) 44 | } 45 | return 46 | } 47 | -------------------------------------------------------------------------------- /vendor/github.com/mmcdole/gofeed/internal/shared/charsetconv.go: -------------------------------------------------------------------------------- 1 | package shared 2 | 3 | import ( 4 | "io" 5 | 6 | "golang.org/x/net/html/charset" 7 | ) 8 | 9 | func NewReaderLabel(label string, input io.Reader) (io.Reader, error) { 10 | conv, err := charset.NewReaderLabel(label, input) 11 | 12 | if err != nil { 13 | return nil, err 14 | } 15 | 16 | // Wrap the charset decoder reader with a XML sanitizer 17 | //clean := NewXMLSanitizerReader(conv) 18 | return conv, nil 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/mmcdole/gofeed/internal/shared/xmlsanitizer.go: -------------------------------------------------------------------------------- 1 | package shared 2 | 3 | import ( 4 | "io" 5 | 6 | "golang.org/x/text/transform" 7 | ) 8 | 9 | // NewXMLSanitizerReader creates an io.Reader that 10 | // wraps another io.Reader and removes illegal xml 11 | // characters from the io stream. 12 | func NewXMLSanitizerReader(xml io.Reader) io.Reader { 13 | isIllegal := func(r rune) bool { 14 | return !(r == 0x09 || 15 | r == 0x0A || 16 | r == 0x0D || 17 | r >= 0x20 && r <= 0xDF77 || 18 | r >= 0xE000 && r <= 0xFFFD || 19 | r >= 0x10000 && r <= 0x10FFFF) 20 | } 21 | t := transform.Chain(transform.RemoveFunc(isIllegal)) 22 | return transform.NewReader(xml, t) 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/mmcdole/goxpp/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | *.prof 25 | -------------------------------------------------------------------------------- /vendor/github.com/mmcdole/goxpp/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - tip 4 | - 1.6 5 | - 1.5 6 | - 1.4 7 | install: 8 | - go get github.com/stretchr/testify/assert 9 | - go get golang.org/x/tools/cmd/cover 10 | - go get github.com/mattn/goveralls 11 | script: 12 | - go test -v -covermode=count -coverprofile=coverage.out 13 | - $HOME/gopath/bin/goveralls -coverprofile=coverage.out -service=travis-ci -repotoken=$COVERALLS_TOKEN 14 | 15 | env: 16 | global: 17 | secure: IZqRp8DmY6LLP+9PTjttLFuCeA/IqW4qQWGnNqyc8nwKoqbHTVY/MZav9WrocGBZZGdI/zLghnE3wp2bywPyBoBPJv9oq7NUZ47DGpdkaLazgP9O68dtshOZ/zDZU7kSbGDF6mePVYjPjkBkWFyt13np89n/bB0L0zdsQE3bKukJ0lSnN32aOjphL+nFEfxM5ghnOuZ7ZDyXTjehQNkNZG73T2ttic8pxi1M+xxl1FXODNgTz0D6qs2ZdKSjJeE9n5iOJqNxIRfW1iIXPn8L2UQBV1+8aohxGy22flwz1ZCO2MZJLqdR1apGZdqVrYhKjxOnyyRWfEX3mpl6/EiW1gLqPgpzjKPuu/wiwfUJOBdFbrn5WGoR6f16XJ6bmxo4NGUEtBXeZz932HWl8XXD+CAGfLNw1NAabH1HpNAYBd4CFpiIi5RtU5sRtumzXwjvgHxlRhwIRb6jWqWezBbRL10MrnhnUyyXu1AWV7LrSvPDbXZ/5NL4/fbW/Piop1vhuNhHauLvZxWa1yv9q1CN8Uad8KEiJcjRj6lac7CCTspoEaPEVlL01tJZDllga1XQCJcRJVPSzt0qEzG2XqhwjWaRkbMLqLXJ9/0YsY/QU9BA0mtPwo+2e2J8ZRmqqXNatysNk9l5sH5TBk3lP+n4jFtI0nGndCxwqPHFGsjhPsE= 18 | -------------------------------------------------------------------------------- /vendor/github.com/mmcdole/goxpp/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 mmcdole 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/mmcdole/goxpp/README.md: -------------------------------------------------------------------------------- 1 | # goxpp 2 | 3 | [![Build Status](https://travis-ci.org/mmcdole/goxpp.svg?branch=master)](https://travis-ci.org/mmcdole/goxpp) [![Coverage Status](https://coveralls.io/repos/github/mmcdole/goxpp/badge.svg?branch=master)](https://coveralls.io/github/mmcdole/goxpp?branch=master) [![License](http://img.shields.io/:license-mit-blue.svg)](http://doge.mit-license.org) 4 | [![GoDoc](https://godoc.org/github.com/mmcdole/goxpp?status.svg)](https://godoc.org/github.com/mmcdole/goxpp) 5 | 6 | The `goxpp` library is an XML parser library that is loosely based on the [Java XMLPullParser](http://www.xmlpull.org/v1/download/unpacked/doc/quick_intro.html). This library allows you to easily parse arbitary XML content using a pull parser. You can think of `goxpp` as a lightweight wrapper around Go's XML `Decoder` that provides a set of functions that make it easier to parse XML content than using the raw decoder itself. 7 | 8 | This project is licensed under the [MIT License](https://raw.githubusercontent.com/mmcdole/goxpp/master/LICENSE) 9 | 10 | -------------------------------------------------------------------------------- /vendor/github.com/patrickmn/go-cache/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | This is a list of people who have contributed code to go-cache. They, or their 2 | employers, are the copyright holders of the contributed code. Contributed code 3 | is subject to the license restrictions listed in LICENSE (as they were when the 4 | code was contributed.) 5 | 6 | Dustin Sallings 7 | Jason Mooberry 8 | Sergey Shepelev 9 | Alex Edwards 10 | -------------------------------------------------------------------------------- /vendor/github.com/patrickmn/go-cache/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012-2017 Patrick Mylund Nielsen and the go-cache contributors 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /vendor/github.com/peterbourgon/diskv/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-2012 Peter Bourgon 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/client_golang/NOTICE: -------------------------------------------------------------------------------- 1 | Prometheus instrumentation library for Go applications 2 | Copyright 2012-2015 The Prometheus Authors 3 | 4 | This product includes software developed at 5 | SoundCloud Ltd. (http://soundcloud.com/). 6 | 7 | 8 | The following components are included in this product: 9 | 10 | perks - a fork of https://github.com/bmizerany/perks 11 | https://github.com/beorn7/perks 12 | Copyright 2013-2015 Blake Mizerany, Björn Rabenstein 13 | See https://github.com/beorn7/perks/blob/master/README.md for license details. 14 | 15 | Go support for Protocol Buffers - Google's data interchange format 16 | http://github.com/golang/protobuf/ 17 | Copyright 2010 The Go Authors 18 | See source code for license details. 19 | 20 | Support for streaming Protocol Buffer messages for the Go language (golang). 21 | https://github.com/matttproud/golang_protobuf_extensions 22 | Copyright 2013 Matt T. Proud 23 | Licensed under the Apache License, Version 2.0 24 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/client_golang/prometheus/.gitignore: -------------------------------------------------------------------------------- 1 | command-line-arguments.test 2 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/client_golang/prometheus/README.md: -------------------------------------------------------------------------------- 1 | See [![go-doc](https://godoc.org/github.com/prometheus/client_golang/prometheus?status.svg)](https://godoc.org/github.com/prometheus/client_golang/prometheus). 2 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/client_golang/prometheus/build_info.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Prometheus Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // +build go1.12 15 | 16 | package prometheus 17 | 18 | import "runtime/debug" 19 | 20 | // readBuildInfo is a wrapper around debug.ReadBuildInfo for Go 1.12+. 21 | func readBuildInfo() (path, version, sum string) { 22 | path, version, sum = "unknown", "unknown", "unknown" 23 | if bi, ok := debug.ReadBuildInfo(); ok { 24 | path = bi.Main.Path 25 | version = bi.Main.Version 26 | sum = bi.Main.Sum 27 | } 28 | return 29 | } 30 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/client_golang/prometheus/build_info_pre_1.12.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Prometheus Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // +build !go1.12 15 | 16 | package prometheus 17 | 18 | // readBuildInfo is a wrapper around debug.ReadBuildInfo for Go versions before 19 | // 1.12. Remove this whole file once the minimum supported Go version is 1.12. 20 | func readBuildInfo() (path, version, sum string) { 21 | return "unknown", "unknown", "unknown" 22 | } 23 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/client_golang/prometheus/fnv.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Prometheus Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | package prometheus 15 | 16 | // Inline and byte-free variant of hash/fnv's fnv64a. 17 | 18 | const ( 19 | offset64 = 14695981039346656037 20 | prime64 = 1099511628211 21 | ) 22 | 23 | // hashNew initializies a new fnv64a hash value. 24 | func hashNew() uint64 { 25 | return offset64 26 | } 27 | 28 | // hashAdd adds a string to a fnv64a hash value, returning the updated hash. 29 | func hashAdd(h uint64, s string) uint64 { 30 | for i := 0; i < len(s); i++ { 31 | h ^= uint64(s[i]) 32 | h *= prime64 33 | } 34 | return h 35 | } 36 | 37 | // hashAddByte adds a byte to a fnv64a hash value, returning the updated hash. 38 | func hashAddByte(h uint64, b byte) uint64 { 39 | h ^= uint64(b) 40 | h *= prime64 41 | return h 42 | } 43 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/client_golang/prometheus/observer.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Prometheus Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | package prometheus 15 | 16 | // Observer is the interface that wraps the Observe method, which is used by 17 | // Histogram and Summary to add observations. 18 | type Observer interface { 19 | Observe(float64) 20 | } 21 | 22 | // The ObserverFunc type is an adapter to allow the use of ordinary 23 | // functions as Observers. If f is a function with the appropriate 24 | // signature, ObserverFunc(f) is an Observer that calls f. 25 | // 26 | // This adapter is usually used in connection with the Timer type, and there are 27 | // two general use cases: 28 | // 29 | // The most common one is to use a Gauge as the Observer for a Timer. 30 | // See the "Gauge" Timer example. 31 | // 32 | // The more advanced use case is to create a function that dynamically decides 33 | // which Observer to use for observing the duration. See the "Complex" Timer 34 | // example. 35 | type ObserverFunc func(float64) 36 | 37 | // Observe calls f(value). It implements Observer. 38 | func (f ObserverFunc) Observe(value float64) { 39 | f(value) 40 | } 41 | 42 | // ObserverVec is an interface implemented by `HistogramVec` and `SummaryVec`. 43 | type ObserverVec interface { 44 | GetMetricWith(Labels) (Observer, error) 45 | GetMetricWithLabelValues(lvs ...string) (Observer, error) 46 | With(Labels) Observer 47 | WithLabelValues(...string) Observer 48 | CurryWith(Labels) (ObserverVec, error) 49 | MustCurryWith(Labels) ObserverVec 50 | 51 | Collector 52 | } 53 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/client_golang/prometheus/process_collector_other.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Prometheus Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // +build !windows 15 | 16 | package prometheus 17 | 18 | import ( 19 | "github.com/prometheus/procfs" 20 | ) 21 | 22 | func canCollectProcess() bool { 23 | _, err := procfs.NewDefaultFS() 24 | return err == nil 25 | } 26 | 27 | func (c *processCollector) processCollect(ch chan<- Metric) { 28 | pid, err := c.pidFn() 29 | if err != nil { 30 | c.reportError(ch, nil, err) 31 | return 32 | } 33 | 34 | p, err := procfs.NewProc(pid) 35 | if err != nil { 36 | c.reportError(ch, nil, err) 37 | return 38 | } 39 | 40 | if stat, err := p.Stat(); err == nil { 41 | ch <- MustNewConstMetric(c.cpuTotal, CounterValue, stat.CPUTime()) 42 | ch <- MustNewConstMetric(c.vsize, GaugeValue, float64(stat.VirtualMemory())) 43 | ch <- MustNewConstMetric(c.rss, GaugeValue, float64(stat.ResidentMemory())) 44 | if startTime, err := stat.StartTime(); err == nil { 45 | ch <- MustNewConstMetric(c.startTime, GaugeValue, startTime) 46 | } else { 47 | c.reportError(ch, c.startTime, err) 48 | } 49 | } else { 50 | c.reportError(ch, nil, err) 51 | } 52 | 53 | if fds, err := p.FileDescriptorsLen(); err == nil { 54 | ch <- MustNewConstMetric(c.openFDs, GaugeValue, float64(fds)) 55 | } else { 56 | c.reportError(ch, c.openFDs, err) 57 | } 58 | 59 | if limits, err := p.Limits(); err == nil { 60 | ch <- MustNewConstMetric(c.maxFDs, GaugeValue, float64(limits.OpenFiles)) 61 | ch <- MustNewConstMetric(c.maxVsize, GaugeValue, float64(limits.AddressSpace)) 62 | } else { 63 | c.reportError(ch, nil, err) 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/client_golang/prometheus/timer.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Prometheus Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | package prometheus 15 | 16 | import "time" 17 | 18 | // Timer is a helper type to time functions. Use NewTimer to create new 19 | // instances. 20 | type Timer struct { 21 | begin time.Time 22 | observer Observer 23 | } 24 | 25 | // NewTimer creates a new Timer. The provided Observer is used to observe a 26 | // duration in seconds. Timer is usually used to time a function call in the 27 | // following way: 28 | // func TimeMe() { 29 | // timer := NewTimer(myHistogram) 30 | // defer timer.ObserveDuration() 31 | // // Do actual work. 32 | // } 33 | func NewTimer(o Observer) *Timer { 34 | return &Timer{ 35 | begin: time.Now(), 36 | observer: o, 37 | } 38 | } 39 | 40 | // ObserveDuration records the duration passed since the Timer was created with 41 | // NewTimer. It calls the Observe method of the Observer provided during 42 | // construction with the duration in seconds as an argument. The observed 43 | // duration is also returned. ObserveDuration is usually called with a defer 44 | // statement. 45 | // 46 | // Note that this method is only guaranteed to never observe negative durations 47 | // if used with Go1.9+. 48 | func (t *Timer) ObserveDuration() time.Duration { 49 | d := time.Since(t.begin) 50 | if t.observer != nil { 51 | t.observer.Observe(d.Seconds()) 52 | } 53 | return d 54 | } 55 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/client_golang/prometheus/untyped.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Prometheus Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | package prometheus 15 | 16 | // UntypedOpts is an alias for Opts. See there for doc comments. 17 | type UntypedOpts Opts 18 | 19 | // UntypedFunc works like GaugeFunc but the collected metric is of type 20 | // "Untyped". UntypedFunc is useful to mirror an external metric of unknown 21 | // type. 22 | // 23 | // To create UntypedFunc instances, use NewUntypedFunc. 24 | type UntypedFunc interface { 25 | Metric 26 | Collector 27 | } 28 | 29 | // NewUntypedFunc creates a new UntypedFunc based on the provided 30 | // UntypedOpts. The value reported is determined by calling the given function 31 | // from within the Write method. Take into account that metric collection may 32 | // happen concurrently. If that results in concurrent calls to Write, like in 33 | // the case where an UntypedFunc is directly registered with Prometheus, the 34 | // provided function must be concurrency-safe. 35 | func NewUntypedFunc(opts UntypedOpts, function func() float64) UntypedFunc { 36 | return newValueFunc(NewDesc( 37 | BuildFQName(opts.Namespace, opts.Subsystem, opts.Name), 38 | opts.Help, 39 | nil, 40 | opts.ConstLabels, 41 | ), UntypedValue, function) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/client_model/NOTICE: -------------------------------------------------------------------------------- 1 | Data model artifacts for Prometheus. 2 | Copyright 2012-2015 The Prometheus Authors 3 | 4 | This product includes software developed at 5 | SoundCloud Ltd. (http://soundcloud.com/). 6 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/common/NOTICE: -------------------------------------------------------------------------------- 1 | Common libraries shared by Prometheus Go components. 2 | Copyright 2015 The Prometheus Authors 3 | 4 | This product includes software developed at 5 | SoundCloud Ltd. (http://soundcloud.com/). 6 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/common/expfmt/expfmt.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Prometheus Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Package expfmt contains tools for reading and writing Prometheus metrics. 15 | package expfmt 16 | 17 | // Format specifies the HTTP content type of the different wire protocols. 18 | type Format string 19 | 20 | // Constants to assemble the Content-Type values for the different wire protocols. 21 | const ( 22 | TextVersion = "0.0.4" 23 | ProtoType = `application/vnd.google.protobuf` 24 | ProtoProtocol = `io.prometheus.client.MetricFamily` 25 | ProtoFmt = ProtoType + "; proto=" + ProtoProtocol + ";" 26 | 27 | // The Content-Type values for the different wire protocols. 28 | FmtUnknown Format = `` 29 | FmtText Format = `text/plain; version=` + TextVersion + `; charset=utf-8` 30 | FmtProtoDelim Format = ProtoFmt + ` encoding=delimited` 31 | FmtProtoText Format = ProtoFmt + ` encoding=text` 32 | FmtProtoCompact Format = ProtoFmt + ` encoding=compact-text` 33 | ) 34 | 35 | const ( 36 | hdrContentType = "Content-Type" 37 | hdrAccept = "Accept" 38 | ) 39 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/common/expfmt/fuzz.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Prometheus Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Build only when actually fuzzing 15 | // +build gofuzz 16 | 17 | package expfmt 18 | 19 | import "bytes" 20 | 21 | // Fuzz text metric parser with with github.com/dvyukov/go-fuzz: 22 | // 23 | // go-fuzz-build github.com/prometheus/common/expfmt 24 | // go-fuzz -bin expfmt-fuzz.zip -workdir fuzz 25 | // 26 | // Further input samples should go in the folder fuzz/corpus. 27 | func Fuzz(in []byte) int { 28 | parser := TextParser{} 29 | _, err := parser.TextToMetricFamilies(bytes.NewReader(in)) 30 | 31 | if err != nil { 32 | return 0 33 | } 34 | 35 | return 1 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/common/model/fnv.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Prometheus Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | package model 15 | 16 | // Inline and byte-free variant of hash/fnv's fnv64a. 17 | 18 | const ( 19 | offset64 = 14695981039346656037 20 | prime64 = 1099511628211 21 | ) 22 | 23 | // hashNew initializies a new fnv64a hash value. 24 | func hashNew() uint64 { 25 | return offset64 26 | } 27 | 28 | // hashAdd adds a string to a fnv64a hash value, returning the updated hash. 29 | func hashAdd(h uint64, s string) uint64 { 30 | for i := 0; i < len(s); i++ { 31 | h ^= uint64(s[i]) 32 | h *= prime64 33 | } 34 | return h 35 | } 36 | 37 | // hashAddByte adds a byte to a fnv64a hash value, returning the updated hash. 38 | func hashAddByte(h uint64, b byte) uint64 { 39 | h ^= uint64(b) 40 | h *= prime64 41 | return h 42 | } 43 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/common/model/model.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Prometheus Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Package model contains common data structures that are shared across 15 | // Prometheus components and libraries. 16 | package model 17 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/.gitignore: -------------------------------------------------------------------------------- 1 | /fixtures/ 2 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/.golangci.yml: -------------------------------------------------------------------------------- 1 | linters: 2 | enable: 3 | - staticcheck 4 | - govet 5 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/MAINTAINERS.md: -------------------------------------------------------------------------------- 1 | * Johannes 'fish' Ziemke @discordianfish 2 | * Paul Gier @pgier 3 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright 2018 The Prometheus Authors 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | 14 | include Makefile.common 15 | 16 | %/.unpacked: %.ttar 17 | @echo ">> extracting fixtures" 18 | ./ttar -C $(dir $*) -x -f $*.ttar 19 | touch $@ 20 | 21 | update_fixtures: 22 | rm -vf fixtures/.unpacked 23 | ./ttar -c -f fixtures.ttar fixtures/ 24 | 25 | .PHONY: build 26 | build: 27 | 28 | .PHONY: test 29 | test: fixtures/.unpacked common-test 30 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/NOTICE: -------------------------------------------------------------------------------- 1 | procfs provides functions to retrieve system, kernel and process 2 | metrics from the pseudo-filesystem proc. 3 | 4 | Copyright 2014-2015 The Prometheus Authors 5 | 6 | This product includes software developed at 7 | SoundCloud Ltd. (http://soundcloud.com/). 8 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Prometheus Team 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Package procfs provides functions to retrieve system, kernel and process 15 | // metrics from the pseudo-filesystem proc. 16 | // 17 | // Example: 18 | // 19 | // package main 20 | // 21 | // import ( 22 | // "fmt" 23 | // "log" 24 | // 25 | // "github.com/prometheus/procfs" 26 | // ) 27 | // 28 | // func main() { 29 | // p, err := procfs.Self() 30 | // if err != nil { 31 | // log.Fatalf("could not get process: %s", err) 32 | // } 33 | // 34 | // stat, err := p.NewStat() 35 | // if err != nil { 36 | // log.Fatalf("could not get process stat: %s", err) 37 | // } 38 | // 39 | // fmt.Printf("command: %s\n", stat.Comm) 40 | // fmt.Printf("cpu time: %fs\n", stat.CPUTime()) 41 | // fmt.Printf("vsize: %dB\n", stat.VirtualMemory()) 42 | // fmt.Printf("rss: %dB\n", stat.ResidentMemory()) 43 | // } 44 | // 45 | package procfs 46 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/fs.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Prometheus Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | package procfs 15 | 16 | import ( 17 | "github.com/prometheus/procfs/internal/fs" 18 | ) 19 | 20 | // FS represents the pseudo-filesystem sys, which provides an interface to 21 | // kernel data structures. 22 | type FS struct { 23 | proc fs.FS 24 | } 25 | 26 | // DefaultMountPoint is the common mount point of the proc filesystem. 27 | const DefaultMountPoint = fs.DefaultProcMountPoint 28 | 29 | // NewDefaultFS returns a new proc FS mounted under the default proc mountPoint. 30 | // It will error if the mount point directory can't be read or is a file. 31 | func NewDefaultFS() (FS, error) { 32 | return NewFS(DefaultMountPoint) 33 | } 34 | 35 | // NewFS returns a new proc FS mounted under the given proc mountPoint. It will error 36 | // if the mount point directory can't be read or is a file. 37 | func NewFS(mountPoint string) (FS, error) { 38 | fs, err := fs.NewFS(mountPoint) 39 | if err != nil { 40 | return FS{}, err 41 | } 42 | return FS{fs}, nil 43 | } 44 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/prometheus/procfs 2 | 3 | go 1.12 4 | 5 | require ( 6 | github.com/google/go-cmp v0.3.1 7 | golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e 8 | ) 9 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/go.sum: -------------------------------------------------------------------------------- 1 | github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg= 2 | github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= 3 | golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY= 4 | golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 5 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/internal/fs/fs.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Prometheus Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | package fs 15 | 16 | import ( 17 | "fmt" 18 | "os" 19 | "path/filepath" 20 | ) 21 | 22 | const ( 23 | // DefaultProcMountPoint is the common mount point of the proc filesystem. 24 | DefaultProcMountPoint = "/proc" 25 | 26 | // DefaultSysMountPoint is the common mount point of the sys filesystem. 27 | DefaultSysMountPoint = "/sys" 28 | 29 | // DefaultConfigfsMountPoint is the common mount point of the configfs 30 | DefaultConfigfsMountPoint = "/sys/kernel/config" 31 | ) 32 | 33 | // FS represents a pseudo-filesystem, normally /proc or /sys, which provides an 34 | // interface to kernel data structures. 35 | type FS string 36 | 37 | // NewFS returns a new FS mounted under the given mountPoint. It will error 38 | // if the mount point can't be read. 39 | func NewFS(mountPoint string) (FS, error) { 40 | info, err := os.Stat(mountPoint) 41 | if err != nil { 42 | return "", fmt.Errorf("could not read %s: %s", mountPoint, err) 43 | } 44 | if !info.IsDir() { 45 | return "", fmt.Errorf("mount point %s is not a directory", mountPoint) 46 | } 47 | 48 | return FS(mountPoint), nil 49 | } 50 | 51 | // Path appends the given path elements to the filesystem path, adding separators 52 | // as necessary. 53 | func (fs FS) Path(p ...string) string { 54 | return filepath.Join(append([]string{string(fs)}, p...)...) 55 | } 56 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/internal/util/readfile.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Prometheus Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | package util 15 | 16 | import ( 17 | "io" 18 | "io/ioutil" 19 | "os" 20 | ) 21 | 22 | // ReadFileNoStat uses ioutil.ReadAll to read contents of entire file. 23 | // This is similar to ioutil.ReadFile but without the call to os.Stat, because 24 | // many files in /proc and /sys report incorrect file sizes (either 0 or 4096). 25 | // Reads a max file size of 512kB. For files larger than this, a scanner 26 | // should be used. 27 | func ReadFileNoStat(filename string) ([]byte, error) { 28 | const maxBufferSize = 1024 * 512 29 | 30 | f, err := os.Open(filename) 31 | if err != nil { 32 | return nil, err 33 | } 34 | defer f.Close() 35 | 36 | reader := io.LimitReader(f, maxBufferSize) 37 | return ioutil.ReadAll(reader) 38 | } 39 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/internal/util/sysreadfile.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Prometheus Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // +build linux,!appengine 15 | 16 | package util 17 | 18 | import ( 19 | "bytes" 20 | "os" 21 | "syscall" 22 | ) 23 | 24 | // SysReadFile is a simplified ioutil.ReadFile that invokes syscall.Read directly. 25 | // https://github.com/prometheus/node_exporter/pull/728/files 26 | // 27 | // Note that this function will not read files larger than 128 bytes. 28 | func SysReadFile(file string) (string, error) { 29 | f, err := os.Open(file) 30 | if err != nil { 31 | return "", err 32 | } 33 | defer f.Close() 34 | 35 | // On some machines, hwmon drivers are broken and return EAGAIN. This causes 36 | // Go's ioutil.ReadFile implementation to poll forever. 37 | // 38 | // Since we either want to read data or bail immediately, do the simplest 39 | // possible read using syscall directly. 40 | const sysFileBufferSize = 128 41 | b := make([]byte, sysFileBufferSize) 42 | n, err := syscall.Read(int(f.Fd()), b) 43 | if err != nil { 44 | return "", err 45 | } 46 | 47 | return string(bytes.TrimSpace(b[:n])), nil 48 | } 49 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/internal/util/sysreadfile_compat.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Prometheus Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // +build linux,appengine !linux 15 | 16 | package util 17 | 18 | import ( 19 | "fmt" 20 | ) 21 | 22 | // SysReadFile is here implemented as a noop for builds that do not support 23 | // the read syscall. For example Windows, or Linux on Google App Engine. 24 | func SysReadFile(file string) (string, error) { 25 | return "", fmt.Errorf("not supported on this platform") 26 | } 27 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/proc_environ.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Prometheus Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | package procfs 15 | 16 | import ( 17 | "strings" 18 | 19 | "github.com/prometheus/procfs/internal/util" 20 | ) 21 | 22 | // Environ reads process environments from /proc//environ 23 | func (p Proc) Environ() ([]string, error) { 24 | environments := make([]string, 0) 25 | 26 | data, err := util.ReadFileNoStat(p.path("environ")) 27 | if err != nil { 28 | return environments, err 29 | } 30 | 31 | environments = strings.Split(string(data), "\000") 32 | if len(environments) > 0 { 33 | environments = environments[:len(environments)-1] 34 | } 35 | 36 | return environments, nil 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/proc_io.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Prometheus Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | package procfs 15 | 16 | import ( 17 | "fmt" 18 | 19 | "github.com/prometheus/procfs/internal/util" 20 | ) 21 | 22 | // ProcIO models the content of /proc//io. 23 | type ProcIO struct { 24 | // Chars read. 25 | RChar uint64 26 | // Chars written. 27 | WChar uint64 28 | // Read syscalls. 29 | SyscR uint64 30 | // Write syscalls. 31 | SyscW uint64 32 | // Bytes read. 33 | ReadBytes uint64 34 | // Bytes written. 35 | WriteBytes uint64 36 | // Bytes written, but taking into account truncation. See 37 | // Documentation/filesystems/proc.txt in the kernel sources for 38 | // detailed explanation. 39 | CancelledWriteBytes int64 40 | } 41 | 42 | // IO creates a new ProcIO instance from a given Proc instance. 43 | func (p Proc) IO() (ProcIO, error) { 44 | pio := ProcIO{} 45 | 46 | data, err := util.ReadFileNoStat(p.path("io")) 47 | if err != nil { 48 | return pio, err 49 | } 50 | 51 | ioFormat := "rchar: %d\nwchar: %d\nsyscr: %d\nsyscw: %d\n" + 52 | "read_bytes: %d\nwrite_bytes: %d\n" + 53 | "cancelled_write_bytes: %d\n" 54 | 55 | _, err = fmt.Sscanf(string(data), ioFormat, &pio.RChar, &pio.WChar, &pio.SyscR, 56 | &pio.SyscW, &pio.ReadBytes, &pio.WriteBytes, &pio.CancelledWriteBytes) 57 | 58 | return pio, err 59 | } 60 | -------------------------------------------------------------------------------- /vendor/github.com/prometheus/procfs/proc_ns.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Prometheus Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | package procfs 15 | 16 | import ( 17 | "fmt" 18 | "os" 19 | "strconv" 20 | "strings" 21 | ) 22 | 23 | // Namespace represents a single namespace of a process. 24 | type Namespace struct { 25 | Type string // Namespace type. 26 | Inode uint32 // Inode number of the namespace. If two processes are in the same namespace their inodes will match. 27 | } 28 | 29 | // Namespaces contains all of the namespaces that the process is contained in. 30 | type Namespaces map[string]Namespace 31 | 32 | // Namespaces reads from /proc//ns/* to get the namespaces of which the 33 | // process is a member. 34 | func (p Proc) Namespaces() (Namespaces, error) { 35 | d, err := os.Open(p.path("ns")) 36 | if err != nil { 37 | return nil, err 38 | } 39 | defer d.Close() 40 | 41 | names, err := d.Readdirnames(-1) 42 | if err != nil { 43 | return nil, fmt.Errorf("failed to read contents of ns dir: %v", err) 44 | } 45 | 46 | ns := make(Namespaces, len(names)) 47 | for _, name := range names { 48 | target, err := os.Readlink(p.path("ns", name)) 49 | if err != nil { 50 | return nil, err 51 | } 52 | 53 | fields := strings.SplitN(target, ":", 2) 54 | if len(fields) != 2 { 55 | return nil, fmt.Errorf("failed to parse namespace type and inode from '%v'", target) 56 | } 57 | 58 | typ := fields[0] 59 | inode, err := strconv.ParseUint(strings.Trim(fields[1], "[]"), 10, 32) 60 | if err != nil { 61 | return nil, fmt.Errorf("failed to parse inode from '%v': %v", fields[1], err) 62 | } 63 | 64 | ns[name] = Namespace{typ, uint32(inode)} 65 | } 66 | 67 | return ns, nil 68 | } 69 | -------------------------------------------------------------------------------- /vendor/github.com/rogpeppe/go-internal/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/github.com/rogpeppe/go-internal/modfile/gopkgin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // TODO: Figure out what gopkg.in should do. 6 | 7 | package modfile 8 | 9 | import "strings" 10 | 11 | // ParseGopkgIn splits gopkg.in import paths into their constituent parts 12 | func ParseGopkgIn(path string) (root, repo, major, subdir string, ok bool) { 13 | if !strings.HasPrefix(path, "gopkg.in/") { 14 | return 15 | } 16 | f := strings.Split(path, "/") 17 | if len(f) >= 2 { 18 | if elem, v, ok := dotV(f[1]); ok { 19 | root = strings.Join(f[:2], "/") 20 | repo = "github.com/go-" + elem + "/" + elem 21 | major = v 22 | subdir = strings.Join(f[2:], "/") 23 | return root, repo, major, subdir, true 24 | } 25 | } 26 | if len(f) >= 3 { 27 | if elem, v, ok := dotV(f[2]); ok { 28 | root = strings.Join(f[:3], "/") 29 | repo = "github.com/" + f[1] + "/" + elem 30 | major = v 31 | subdir = strings.Join(f[3:], "/") 32 | return root, repo, major, subdir, true 33 | } 34 | } 35 | return 36 | } 37 | 38 | func dotV(name string) (elem, v string, ok bool) { 39 | i := len(name) - 1 40 | for i >= 0 && '0' <= name[i] && name[i] <= '9' { 41 | i-- 42 | } 43 | if i <= 2 || i+1 >= len(name) || name[i-1] != '.' || name[i] != 'v' || name[i+1] == '0' && len(name) != i+2 { 44 | return "", "", false 45 | } 46 | return name[:i-1], name[i:], true 47 | } 48 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/aliases.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build windows 6 | // +build go1.9 7 | 8 | package windows 9 | 10 | import "syscall" 11 | 12 | type Errno = syscall.Errno 13 | type SysProcAttr = syscall.SysProcAttr 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/empty.s: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !go1.12 6 | 7 | // This file is here to allow bodyless functions with go:linkname for Go 1.11 8 | // and earlier (see https://golang.org/issue/23311). 9 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/env_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Windows environment variables. 6 | 7 | package windows 8 | 9 | import ( 10 | "syscall" 11 | "unicode/utf16" 12 | "unsafe" 13 | ) 14 | 15 | func Getenv(key string) (value string, found bool) { 16 | return syscall.Getenv(key) 17 | } 18 | 19 | func Setenv(key, value string) error { 20 | return syscall.Setenv(key, value) 21 | } 22 | 23 | func Clearenv() { 24 | syscall.Clearenv() 25 | } 26 | 27 | func Environ() []string { 28 | return syscall.Environ() 29 | } 30 | 31 | // Returns a default environment associated with the token, rather than the current 32 | // process. If inheritExisting is true, then this environment also inherits the 33 | // environment of the current process. 34 | func (token Token) Environ(inheritExisting bool) (env []string, err error) { 35 | var block *uint16 36 | err = CreateEnvironmentBlock(&block, token, inheritExisting) 37 | if err != nil { 38 | return nil, err 39 | } 40 | defer DestroyEnvironmentBlock(block) 41 | blockp := uintptr(unsafe.Pointer(block)) 42 | for { 43 | entry := (*[(1 << 30) - 1]uint16)(unsafe.Pointer(blockp))[:] 44 | for i, v := range entry { 45 | if v == 0 { 46 | entry = entry[:i] 47 | break 48 | } 49 | } 50 | if len(entry) == 0 { 51 | break 52 | } 53 | env = append(env, string(utf16.Decode(entry))) 54 | blockp += 2 * (uintptr(len(entry)) + 1) 55 | } 56 | return env, nil 57 | } 58 | 59 | func Unsetenv(key string) error { 60 | return syscall.Unsetenv(key) 61 | } 62 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/eventlog.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build windows 6 | 7 | package windows 8 | 9 | const ( 10 | EVENTLOG_SUCCESS = 0 11 | EVENTLOG_ERROR_TYPE = 1 12 | EVENTLOG_WARNING_TYPE = 2 13 | EVENTLOG_INFORMATION_TYPE = 4 14 | EVENTLOG_AUDIT_SUCCESS = 8 15 | EVENTLOG_AUDIT_FAILURE = 16 16 | ) 17 | 18 | //sys RegisterEventSource(uncServerName *uint16, sourceName *uint16) (handle Handle, err error) [failretval==0] = advapi32.RegisterEventSourceW 19 | //sys DeregisterEventSource(handle Handle) (err error) = advapi32.DeregisterEventSource 20 | //sys ReportEvent(log Handle, etype uint16, category uint16, eventId uint32, usrSId uintptr, numStrings uint16, dataSize uint32, strings **uint16, rawData *byte) (err error) = advapi32.ReportEventW 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/exec_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Fork, exec, wait, etc. 6 | 7 | package windows 8 | 9 | // EscapeArg rewrites command line argument s as prescribed 10 | // in http://msdn.microsoft.com/en-us/library/ms880421. 11 | // This function returns "" (2 double quotes) if s is empty. 12 | // Alternatively, these transformations are done: 13 | // - every back slash (\) is doubled, but only if immediately 14 | // followed by double quote ("); 15 | // - every double quote (") is escaped by back slash (\); 16 | // - finally, s is wrapped with double quotes (arg -> "arg"), 17 | // but only if there is space or tab inside s. 18 | func EscapeArg(s string) string { 19 | if len(s) == 0 { 20 | return "\"\"" 21 | } 22 | n := len(s) 23 | hasSpace := false 24 | for i := 0; i < len(s); i++ { 25 | switch s[i] { 26 | case '"', '\\': 27 | n++ 28 | case ' ', '\t': 29 | hasSpace = true 30 | } 31 | } 32 | if hasSpace { 33 | n += 2 34 | } 35 | if n == len(s) { 36 | return s 37 | } 38 | 39 | qs := make([]byte, n) 40 | j := 0 41 | if hasSpace { 42 | qs[j] = '"' 43 | j++ 44 | } 45 | slashes := 0 46 | for i := 0; i < len(s); i++ { 47 | switch s[i] { 48 | default: 49 | slashes = 0 50 | qs[j] = s[i] 51 | case '\\': 52 | slashes++ 53 | qs[j] = s[i] 54 | case '"': 55 | for ; slashes > 0; slashes-- { 56 | qs[j] = '\\' 57 | j++ 58 | } 59 | qs[j] = '\\' 60 | j++ 61 | qs[j] = s[i] 62 | } 63 | j++ 64 | } 65 | if hasSpace { 66 | for ; slashes > 0; slashes-- { 67 | qs[j] = '\\' 68 | j++ 69 | } 70 | qs[j] = '"' 71 | j++ 72 | } 73 | return string(qs[:j]) 74 | } 75 | 76 | func CloseOnExec(fd Handle) { 77 | SetHandleInformation(Handle(fd), HANDLE_FLAG_INHERIT, 0) 78 | } 79 | 80 | // FullPath retrieves the full path of the specified file. 81 | func FullPath(name string) (path string, err error) { 82 | p, err := UTF16PtrFromString(name) 83 | if err != nil { 84 | return "", err 85 | } 86 | n := uint32(100) 87 | for { 88 | buf := make([]uint16, n) 89 | n, err = GetFullPathName(p, uint32(len(buf)), &buf[0], nil) 90 | if err != nil { 91 | return "", err 92 | } 93 | if n <= uint32(len(buf)) { 94 | return UTF16ToString(buf[:n]), nil 95 | } 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/memory_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package windows 6 | 7 | const ( 8 | MEM_COMMIT = 0x00001000 9 | MEM_RESERVE = 0x00002000 10 | MEM_DECOMMIT = 0x00004000 11 | MEM_RELEASE = 0x00008000 12 | MEM_RESET = 0x00080000 13 | MEM_TOP_DOWN = 0x00100000 14 | MEM_WRITE_WATCH = 0x00200000 15 | MEM_PHYSICAL = 0x00400000 16 | MEM_RESET_UNDO = 0x01000000 17 | MEM_LARGE_PAGES = 0x20000000 18 | 19 | PAGE_NOACCESS = 0x01 20 | PAGE_READONLY = 0x02 21 | PAGE_READWRITE = 0x04 22 | PAGE_WRITECOPY = 0x08 23 | PAGE_EXECUTE_READ = 0x20 24 | PAGE_EXECUTE_READWRITE = 0x40 25 | PAGE_EXECUTE_WRITECOPY = 0x80 26 | ) 27 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/mkerrors.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2019 The Go Authors. All rights reserved. 4 | # Use of this source code is governed by a BSD-style 5 | # license that can be found in the LICENSE file. 6 | 7 | set -e 8 | shopt -s nullglob 9 | 10 | winerror="$(printf '%s\n' "/mnt/c/Program Files (x86)/Windows Kits/"/*/Include/*/shared/winerror.h | sort -Vr | head -n 1)" 11 | [[ -n $winerror ]] || { echo "Unable to find winerror.h" >&2; exit 1; } 12 | 13 | declare -A errors 14 | 15 | { 16 | echo "// Code generated by 'mkerrors.bash'; DO NOT EDIT." 17 | echo 18 | echo "package windows" 19 | echo "import \"syscall\"" 20 | echo "const (" 21 | 22 | while read -r line; do 23 | unset vtype 24 | if [[ $line =~ ^#define\ +([A-Z0-9_]+k?)\ +([A-Z0-9_]+\()?([A-Z][A-Z0-9_]+k?)\)? ]]; then 25 | key="${BASH_REMATCH[1]}" 26 | value="${BASH_REMATCH[3]}" 27 | elif [[ $line =~ ^#define\ +([A-Z0-9_]+k?)\ +([A-Z0-9_]+\()?((0x)?[0-9A-Fa-f]+)L?\)? ]]; then 28 | key="${BASH_REMATCH[1]}" 29 | value="${BASH_REMATCH[3]}" 30 | vtype="${BASH_REMATCH[2]}" 31 | elif [[ $line =~ ^#define\ +([A-Z0-9_]+k?)\ +\(\(([A-Z]+)\)((0x)?[0-9A-Fa-f]+)L?\) ]]; then 32 | key="${BASH_REMATCH[1]}" 33 | value="${BASH_REMATCH[3]}" 34 | vtype="${BASH_REMATCH[2]}" 35 | else 36 | continue 37 | fi 38 | [[ -n $key && -n $value ]] || continue 39 | [[ -z ${errors["$key"]} ]] || continue 40 | errors["$key"]="$value" 41 | if [[ -v vtype ]]; then 42 | if [[ $key == FACILITY_* || $key == NO_ERROR ]]; then 43 | vtype="" 44 | elif [[ $vtype == *HANDLE* || $vtype == *HRESULT* ]]; then 45 | vtype="Handle" 46 | else 47 | vtype="syscall.Errno" 48 | fi 49 | last_vtype="$vtype" 50 | else 51 | vtype="" 52 | if [[ $last_vtype == Handle && $value == NO_ERROR ]]; then 53 | value="S_OK" 54 | elif [[ $last_vtype == syscall.Errno && $value == NO_ERROR ]]; then 55 | value="ERROR_SUCCESS" 56 | fi 57 | fi 58 | 59 | echo "$key $vtype = $value" 60 | done < "$winerror" 61 | 62 | echo ")" 63 | } | gofmt > "zerrors_windows.go" 64 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/mkknownfolderids.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2019 The Go Authors. All rights reserved. 4 | # Use of this source code is governed by a BSD-style 5 | # license that can be found in the LICENSE file. 6 | 7 | set -e 8 | shopt -s nullglob 9 | 10 | knownfolders="$(printf '%s\n' "/mnt/c/Program Files (x86)/Windows Kits/"/*/Include/*/um/KnownFolders.h | sort -Vr | head -n 1)" 11 | [[ -n $knownfolders ]] || { echo "Unable to find KnownFolders.h" >&2; exit 1; } 12 | 13 | { 14 | echo "// Code generated by 'mkknownfolderids.bash'; DO NOT EDIT." 15 | echo 16 | echo "package windows" 17 | echo "type KNOWNFOLDERID GUID" 18 | echo "var (" 19 | while read -r line; do 20 | [[ $line =~ DEFINE_KNOWN_FOLDER\((FOLDERID_[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+)\) ]] || continue 21 | printf "%s = &KNOWNFOLDERID{0x%08x, 0x%04x, 0x%04x, [8]byte{0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x}}\n" \ 22 | "${BASH_REMATCH[1]}" $(( "${BASH_REMATCH[2]}" )) $(( "${BASH_REMATCH[3]}" )) $(( "${BASH_REMATCH[4]}" )) \ 23 | $(( "${BASH_REMATCH[5]}" )) $(( "${BASH_REMATCH[6]}" )) $(( "${BASH_REMATCH[7]}" )) $(( "${BASH_REMATCH[8]}" )) \ 24 | $(( "${BASH_REMATCH[9]}" )) $(( "${BASH_REMATCH[10]}" )) $(( "${BASH_REMATCH[11]}" )) $(( "${BASH_REMATCH[12]}" )) 25 | done < "$knownfolders" 26 | echo ")" 27 | } | gofmt > "zknownfolderids_windows.go" 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/mksyscall.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build generate 6 | 7 | package windows 8 | 9 | //go:generate go run golang.org/x/sys/windows/mkwinsyscall -output zsyscall_windows.go eventlog.go service.go syscall_windows.go security_windows.go 10 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/race.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build windows,race 6 | 7 | package windows 8 | 9 | import ( 10 | "runtime" 11 | "unsafe" 12 | ) 13 | 14 | const raceenabled = true 15 | 16 | func raceAcquire(addr unsafe.Pointer) { 17 | runtime.RaceAcquire(addr) 18 | } 19 | 20 | func raceReleaseMerge(addr unsafe.Pointer) { 21 | runtime.RaceReleaseMerge(addr) 22 | } 23 | 24 | func raceReadRange(addr unsafe.Pointer, len int) { 25 | runtime.RaceReadRange(addr, len) 26 | } 27 | 28 | func raceWriteRange(addr unsafe.Pointer, len int) { 29 | runtime.RaceWriteRange(addr, len) 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/race0.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build windows,!race 6 | 7 | package windows 8 | 9 | import ( 10 | "unsafe" 11 | ) 12 | 13 | const raceenabled = false 14 | 15 | func raceAcquire(addr unsafe.Pointer) { 16 | } 17 | 18 | func raceReleaseMerge(addr unsafe.Pointer) { 19 | } 20 | 21 | func raceReadRange(addr unsafe.Pointer, len int) { 22 | } 23 | 24 | func raceWriteRange(addr unsafe.Pointer, len int) { 25 | } 26 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/str.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build windows 6 | 7 | package windows 8 | 9 | func itoa(val int) string { // do it here rather than with fmt to avoid dependency 10 | if val < 0 { 11 | return "-" + itoa(-val) 12 | } 13 | var buf [32]byte // big enough for int64 14 | i := len(buf) - 1 15 | for val >= 10 { 16 | buf[i] = byte(val%10 + '0') 17 | i-- 18 | val /= 10 19 | } 20 | buf[i] = byte(val + '0') 21 | return string(buf[i:]) 22 | } 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/types_windows_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package windows 6 | 7 | type WSAData struct { 8 | Version uint16 9 | HighVersion uint16 10 | Description [WSADESCRIPTION_LEN + 1]byte 11 | SystemStatus [WSASYS_STATUS_LEN + 1]byte 12 | MaxSockets uint16 13 | MaxUdpDg uint16 14 | VendorInfo *byte 15 | } 16 | 17 | type Servent struct { 18 | Name *byte 19 | Aliases **byte 20 | Port uint16 21 | Proto *byte 22 | } 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/types_windows_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package windows 6 | 7 | type WSAData struct { 8 | Version uint16 9 | HighVersion uint16 10 | MaxSockets uint16 11 | MaxUdpDg uint16 12 | VendorInfo *byte 13 | Description [WSADESCRIPTION_LEN + 1]byte 14 | SystemStatus [WSASYS_STATUS_LEN + 1]byte 15 | } 16 | 17 | type Servent struct { 18 | Name *byte 19 | Aliases **byte 20 | Proto *byte 21 | Port uint16 22 | } 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/types_windows_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package windows 6 | 7 | type WSAData struct { 8 | Version uint16 9 | HighVersion uint16 10 | Description [WSADESCRIPTION_LEN + 1]byte 11 | SystemStatus [WSASYS_STATUS_LEN + 1]byte 12 | MaxSockets uint16 13 | MaxUdpDg uint16 14 | VendorInfo *byte 15 | } 16 | 17 | type Servent struct { 18 | Name *byte 19 | Aliases **byte 20 | Port uint16 21 | Proto *byte 22 | } 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/encoding/japanese/all.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package japanese 6 | 7 | import ( 8 | "golang.org/x/text/encoding" 9 | ) 10 | 11 | // All is a list of all defined encodings in this package. 12 | var All = []encoding.Encoding{EUCJP, ISO2022JP, ShiftJIS} 13 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/encoding/simplifiedchinese/all.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package simplifiedchinese 6 | 7 | import ( 8 | "golang.org/x/text/encoding" 9 | ) 10 | 11 | // All is a list of all defined encodings in this package. 12 | var All = []encoding.Encoding{GB18030, GBK, HZGB2312} 13 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/internal/language/common.go: -------------------------------------------------------------------------------- 1 | // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. 2 | 3 | package language 4 | 5 | // This file contains code common to the maketables.go and the package code. 6 | 7 | // AliasType is the type of an alias in AliasMap. 8 | type AliasType int8 9 | 10 | const ( 11 | Deprecated AliasType = iota 12 | Macro 13 | Legacy 14 | 15 | AliasTypeUnknown AliasType = -1 16 | ) 17 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/internal/language/compact.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package language 6 | 7 | // CompactCoreInfo is a compact integer with the three core tags encoded. 8 | type CompactCoreInfo uint32 9 | 10 | // GetCompactCore generates a uint32 value that is guaranteed to be unique for 11 | // different language, region, and script values. 12 | func GetCompactCore(t Tag) (cci CompactCoreInfo, ok bool) { 13 | if t.LangID > langNoIndexOffset { 14 | return 0, false 15 | } 16 | cci |= CompactCoreInfo(t.LangID) << (8 + 12) 17 | cci |= CompactCoreInfo(t.ScriptID) << 12 18 | cci |= CompactCoreInfo(t.RegionID) 19 | return cci, true 20 | } 21 | 22 | // Tag generates a tag from c. 23 | func (c CompactCoreInfo) Tag() Tag { 24 | return Tag{ 25 | LangID: Language(c >> 20), 26 | RegionID: Region(c & 0x3ff), 27 | ScriptID: Script(c>>12) & 0xff, 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/internal/language/compact/compact.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Package compact defines a compact representation of language tags. 6 | // 7 | // Common language tags (at least all for which locale information is defined 8 | // in CLDR) are assigned a unique index. Each Tag is associated with such an 9 | // ID for selecting language-related resources (such as translations) as well 10 | // as one for selecting regional defaults (currency, number formatting, etc.) 11 | // 12 | // It may want to export this functionality at some point, but at this point 13 | // this is only available for use within x/text. 14 | package compact // import "golang.org/x/text/internal/language/compact" 15 | 16 | import ( 17 | "sort" 18 | "strings" 19 | 20 | "golang.org/x/text/internal/language" 21 | ) 22 | 23 | // ID is an integer identifying a single tag. 24 | type ID uint16 25 | 26 | func getCoreIndex(t language.Tag) (id ID, ok bool) { 27 | cci, ok := language.GetCompactCore(t) 28 | if !ok { 29 | return 0, false 30 | } 31 | i := sort.Search(len(coreTags), func(i int) bool { 32 | return cci <= coreTags[i] 33 | }) 34 | if i == len(coreTags) || coreTags[i] != cci { 35 | return 0, false 36 | } 37 | return ID(i), true 38 | } 39 | 40 | // Parent returns the ID of the parent or the root ID if id is already the root. 41 | func (id ID) Parent() ID { 42 | return parents[id] 43 | } 44 | 45 | // Tag converts id to an internal language Tag. 46 | func (id ID) Tag() language.Tag { 47 | if int(id) >= len(coreTags) { 48 | return specialTags[int(id)-len(coreTags)] 49 | } 50 | return coreTags[id].Tag() 51 | } 52 | 53 | var specialTags []language.Tag 54 | 55 | func init() { 56 | tags := strings.Split(specialTagsStr, " ") 57 | specialTags = make([]language.Tag, len(tags)) 58 | for i, t := range tags { 59 | specialTags[i] = language.MustParse(t) 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/internal/language/coverage.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package language 6 | 7 | // BaseLanguages returns the list of all supported base languages. It generates 8 | // the list by traversing the internal structures. 9 | func BaseLanguages() []Language { 10 | base := make([]Language, 0, NumLanguages) 11 | for i := 0; i < langNoIndexOffset; i++ { 12 | // We included "und" already for the value 0. 13 | if i != nonCanonicalUnd { 14 | base = append(base, Language(i)) 15 | } 16 | } 17 | i := langNoIndexOffset 18 | for _, v := range langNoIndex { 19 | for k := 0; k < 8; k++ { 20 | if v&1 == 1 { 21 | base = append(base, Language(i)) 22 | } 23 | v >>= 1 24 | i++ 25 | } 26 | } 27 | return base 28 | } 29 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/internal/language/tags.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package language 6 | 7 | // MustParse is like Parse, but panics if the given BCP 47 tag cannot be parsed. 8 | // It simplifies safe initialization of Tag values. 9 | func MustParse(s string) Tag { 10 | t, err := Parse(s) 11 | if err != nil { 12 | panic(err) 13 | } 14 | return t 15 | } 16 | 17 | // MustParseBase is like ParseBase, but panics if the given base cannot be parsed. 18 | // It simplifies safe initialization of Base values. 19 | func MustParseBase(s string) Language { 20 | b, err := ParseBase(s) 21 | if err != nil { 22 | panic(err) 23 | } 24 | return b 25 | } 26 | 27 | // MustParseScript is like ParseScript, but panics if the given script cannot be 28 | // parsed. It simplifies safe initialization of Script values. 29 | func MustParseScript(s string) Script { 30 | scr, err := ParseScript(s) 31 | if err != nil { 32 | panic(err) 33 | } 34 | return scr 35 | } 36 | 37 | // MustParseRegion is like ParseRegion, but panics if the given region cannot be 38 | // parsed. It simplifies safe initialization of Region values. 39 | func MustParseRegion(s string) Region { 40 | r, err := ParseRegion(s) 41 | if err != nil { 42 | panic(err) 43 | } 44 | return r 45 | } 46 | 47 | // Und is the root language. 48 | var Und Tag 49 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/language/go1_1.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !go1.2 6 | 7 | package language 8 | 9 | import "sort" 10 | 11 | func sortStable(s sort.Interface) { 12 | ss := stableSort{ 13 | s: s, 14 | pos: make([]int, s.Len()), 15 | } 16 | for i := range ss.pos { 17 | ss.pos[i] = i 18 | } 19 | sort.Sort(&ss) 20 | } 21 | 22 | type stableSort struct { 23 | s sort.Interface 24 | pos []int 25 | } 26 | 27 | func (s *stableSort) Len() int { 28 | return len(s.pos) 29 | } 30 | 31 | func (s *stableSort) Less(i, j int) bool { 32 | return s.s.Less(i, j) || !s.s.Less(j, i) && s.pos[i] < s.pos[j] 33 | } 34 | 35 | func (s *stableSort) Swap(i, j int) { 36 | s.s.Swap(i, j) 37 | s.pos[i], s.pos[j] = s.pos[j], s.pos[i] 38 | } 39 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/language/go1_2.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build go1.2 6 | 7 | package language 8 | 9 | import "sort" 10 | 11 | var sortStable = sort.Stable 12 | --------------------------------------------------------------------------------