upd(all): vendor update
This commit is contained in:
36
Gopkg.lock
generated
36
Gopkg.lock
generated
@@ -186,6 +186,14 @@
|
||||
revision = "66b9c49e59c6c48f0ffce28c2d8b8a5678502c6d"
|
||||
version = "v1.4.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:296377f7f7d4eac172d95a2194ae07d4f32f21e5fe679fdfc7c53d8ac6a13bb7"
|
||||
name = "github.com/goware/statik"
|
||||
packages = ["fs"]
|
||||
pruneopts = "UT"
|
||||
revision = "08d4f2fbd5475554890b11fb3891da2b84f95ecd"
|
||||
version = "v0.2.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:870d441fe217b8e689d7949fef6e43efbc787e50f200cb1e70dbca9204a1d6be"
|
||||
name = "github.com/inconshreveable/mousetrap"
|
||||
@@ -339,14 +347,6 @@
|
||||
pruneopts = "UT"
|
||||
revision = "40f3c57fb1983891f95378042bd0bfd590f52384"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:77b730fa4c2d98f3ddf492acbea351eb6b0560fa5eace4105a6fc33ff937bb1b"
|
||||
name = "github.com/rakyll/statik"
|
||||
packages = ["fs"]
|
||||
pruneopts = "UT"
|
||||
revision = "3bac566d30cdbeddef402a80f3d6305860e59f12"
|
||||
version = "v0.1.6"
|
||||
|
||||
[[projects]]
|
||||
branch = "go1"
|
||||
digest = "1:da739d4a1d07b7bc909020a2de4fef276edb9731e1e114e6de233ff0fa3fc9d4"
|
||||
@@ -393,14 +393,6 @@
|
||||
revision = "298182f68c66c05229eb03ac171abe6e309ee79a"
|
||||
version = "v1.0.3"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:867c2915fb252b272b86235c13cffb60627ecc35e1f334c77aaf7f154fbba352"
|
||||
name = "github.com/titpetric/dockertest"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "3cd6aeb62a5fe526e54b1af7c05c5c9a2eac16dd"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:8a90d635c58170aff3184be7da859c76ad941d7d11fa37edb28943a133cae186"
|
||||
@@ -412,14 +404,6 @@
|
||||
pruneopts = "UT"
|
||||
revision = "c1dcb85af748151b6cabfac413d7e243d7214b13"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:539aa04b8528cceeaa4e7f22034d1f463d0753ec5716b4571b766b7770ff79b5"
|
||||
name = "github.com/titpetric/statik"
|
||||
packages = ["fs"]
|
||||
pruneopts = "UT"
|
||||
revision = "859ade2637a43c0070c6dc52fd4725767086a01b"
|
||||
version = "v0.1.6"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:2ebbbb9481b5021db546cd1759e656a87758280f12740d7098016249a8778595"
|
||||
@@ -558,6 +542,7 @@
|
||||
"github.com/gomodule/redigo/redis",
|
||||
"github.com/gorilla/sessions",
|
||||
"github.com/gorilla/websocket",
|
||||
"github.com/goware/statik/fs",
|
||||
"github.com/jmoiron/sqlx",
|
||||
"github.com/jmoiron/sqlx/types",
|
||||
"github.com/joho/godotenv",
|
||||
@@ -572,13 +557,10 @@
|
||||
"github.com/namsral/flag",
|
||||
"github.com/pkg/errors",
|
||||
"github.com/prometheus/client_golang/prometheus",
|
||||
"github.com/rakyll/statik/fs",
|
||||
"github.com/spf13/afero",
|
||||
"github.com/spf13/cobra",
|
||||
"github.com/titpetric/dockertest",
|
||||
"github.com/titpetric/factory",
|
||||
"github.com/titpetric/factory/resputil",
|
||||
"github.com/titpetric/statik/fs",
|
||||
"golang.org/x/crypto/bcrypt",
|
||||
"golang.org/x/oauth2",
|
||||
"gopkg.in/Masterminds/squirrel.v1",
|
||||
|
||||
0
vendor/github.com/rakyll/statik/LICENSE → vendor/github.com/goware/statik/LICENSE
generated
vendored
0
vendor/github.com/rakyll/statik/LICENSE → vendor/github.com/goware/statik/LICENSE
generated
vendored
15
vendor/github.com/titpetric/statik/fs/fs.go → vendor/github.com/goware/statik/fs/fs.go
generated
vendored
15
vendor/github.com/titpetric/statik/fs/fs.go → vendor/github.com/goware/statik/fs/fs.go
generated
vendored
@@ -29,8 +29,6 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
var zipData string
|
||||
|
||||
// file holds unzipped read-only file contents and file metadata.
|
||||
type file struct {
|
||||
os.FileInfo
|
||||
@@ -42,20 +40,11 @@ type statikFS struct {
|
||||
files map[string]file
|
||||
}
|
||||
|
||||
// Register registers zip contents data, later used to initialize
|
||||
// the statik file system.
|
||||
func Register(data string) {
|
||||
zipData = data
|
||||
}
|
||||
|
||||
// New creates a new file system with the registered zip contents data.
|
||||
// It unzips all files and stores them in an in-memory map.
|
||||
func New(zipDatas ...string) (http.FileSystem, error) {
|
||||
if (len(zipDatas) > 0) {
|
||||
zipData = zipDatas[0]
|
||||
}
|
||||
func New(zipData string) (http.FileSystem, error) {
|
||||
if zipData == "" {
|
||||
return nil, errors.New("statik/fs: no zip data registered")
|
||||
return nil, errors.New("statik/fs: empty zip data")
|
||||
}
|
||||
zipReader, err := zip.NewReader(strings.NewReader(zipData), int64(len(zipData)))
|
||||
if err != nil {
|
||||
216
vendor/github.com/rakyll/statik/fs/fs.go
generated
vendored
216
vendor/github.com/rakyll/statik/fs/fs.go
generated
vendored
@@ -1,216 +0,0 @@
|
||||
// Copyright 2014 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// Package fs contains an HTTP file system that works with zip contents.
|
||||
package fs
|
||||
|
||||
import (
|
||||
"archive/zip"
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
var zipData string
|
||||
|
||||
// file holds unzipped read-only file contents and file metadata.
|
||||
type file struct {
|
||||
os.FileInfo
|
||||
data []byte
|
||||
fs *statikFS
|
||||
}
|
||||
|
||||
type statikFS struct {
|
||||
files map[string]file
|
||||
dirs map[string][]string
|
||||
}
|
||||
|
||||
// Register registers zip contents data, later used to initialize
|
||||
// the statik file system.
|
||||
func Register(data string) {
|
||||
zipData = data
|
||||
}
|
||||
|
||||
// New creates a new file system with the registered zip contents data.
|
||||
// It unzips all files and stores them in an in-memory map.
|
||||
func New() (http.FileSystem, error) {
|
||||
if zipData == "" {
|
||||
return nil, errors.New("statik/fs: no zip data registered")
|
||||
}
|
||||
zipReader, err := zip.NewReader(strings.NewReader(zipData), int64(len(zipData)))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
files := make(map[string]file, len(zipReader.File))
|
||||
dirs := make(map[string][]string)
|
||||
fs := &statikFS{files: files, dirs: dirs}
|
||||
for _, zipFile := range zipReader.File {
|
||||
fi := zipFile.FileInfo()
|
||||
f := file{FileInfo: fi, fs: fs}
|
||||
f.data, err = unzip(zipFile)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("statik/fs: error unzipping file %q: %s", zipFile.Name, err)
|
||||
}
|
||||
files["/"+zipFile.Name] = f
|
||||
}
|
||||
for fn := range files {
|
||||
// go up directories recursively in order to care deep directory
|
||||
for dn := path.Dir(fn); dn != fn; {
|
||||
if _, ok := files[dn]; !ok {
|
||||
files[dn] = file{FileInfo: dirInfo{dn}, fs: fs}
|
||||
} else {
|
||||
break
|
||||
}
|
||||
fn, dn = dn, path.Dir(dn)
|
||||
}
|
||||
}
|
||||
for fn := range files {
|
||||
dn := path.Dir(fn)
|
||||
if fn != dn {
|
||||
fs.dirs[dn] = append(fs.dirs[dn], path.Base(fn))
|
||||
}
|
||||
}
|
||||
for _, s := range fs.dirs {
|
||||
sort.Strings(s)
|
||||
}
|
||||
return fs, nil
|
||||
}
|
||||
|
||||
var _ = os.FileInfo(dirInfo{})
|
||||
|
||||
type dirInfo struct {
|
||||
name string
|
||||
}
|
||||
|
||||
func (di dirInfo) Name() string { return path.Base(di.name) }
|
||||
func (di dirInfo) Size() int64 { return 0 }
|
||||
func (di dirInfo) Mode() os.FileMode { return 0755 | os.ModeDir }
|
||||
func (di dirInfo) ModTime() time.Time { return time.Time{} }
|
||||
func (di dirInfo) IsDir() bool { return true }
|
||||
func (di dirInfo) Sys() interface{} { return nil }
|
||||
|
||||
func unzip(zf *zip.File) ([]byte, error) {
|
||||
rc, err := zf.Open()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rc.Close()
|
||||
return ioutil.ReadAll(rc)
|
||||
}
|
||||
|
||||
// Open returns a file matching the given file name, or os.ErrNotExists if
|
||||
// no file matching the given file name is found in the archive.
|
||||
// If a directory is requested, Open returns the file named "index.html"
|
||||
// in the requested directory, if that file exists.
|
||||
func (fs *statikFS) Open(name string) (http.File, error) {
|
||||
name = strings.Replace(name, "//", "/", -1)
|
||||
if f, ok := fs.files[name]; ok {
|
||||
return newHTTPFile(f), nil
|
||||
}
|
||||
return nil, os.ErrNotExist
|
||||
}
|
||||
|
||||
func newHTTPFile(file file) *httpFile {
|
||||
if file.IsDir() {
|
||||
return &httpFile{file: file, isDir: true}
|
||||
}
|
||||
return &httpFile{file: file, reader: bytes.NewReader(file.data)}
|
||||
}
|
||||
|
||||
// httpFile represents an HTTP file and acts as a bridge
|
||||
// between file and http.File.
|
||||
type httpFile struct {
|
||||
file
|
||||
|
||||
reader *bytes.Reader
|
||||
isDir bool
|
||||
dirIdx int
|
||||
}
|
||||
|
||||
// Read reads bytes into p, returns the number of read bytes.
|
||||
func (f *httpFile) Read(p []byte) (n int, err error) {
|
||||
if f.reader == nil && f.isDir {
|
||||
return 0, io.EOF
|
||||
}
|
||||
return f.reader.Read(p)
|
||||
}
|
||||
|
||||
// Seek seeks to the offset.
|
||||
func (f *httpFile) Seek(offset int64, whence int) (ret int64, err error) {
|
||||
return f.reader.Seek(offset, whence)
|
||||
}
|
||||
|
||||
// Stat stats the file.
|
||||
func (f *httpFile) Stat() (os.FileInfo, error) {
|
||||
return f, nil
|
||||
}
|
||||
|
||||
// IsDir returns true if the file location represents a directory.
|
||||
func (f *httpFile) IsDir() bool {
|
||||
return f.isDir
|
||||
}
|
||||
|
||||
// Readdir returns an empty slice of files, directory
|
||||
// listing is disabled.
|
||||
func (f *httpFile) Readdir(count int) ([]os.FileInfo, error) {
|
||||
var fis []os.FileInfo
|
||||
if !f.isDir {
|
||||
return fis, nil
|
||||
}
|
||||
di, ok := f.FileInfo.(dirInfo)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("failed to read directory: %q", f.Name())
|
||||
}
|
||||
|
||||
// If count is positive, the specified number of files will be returned,
|
||||
// and if negative, all remaining files will be returned.
|
||||
// The reading position of which file is returned is held in dirIndex.
|
||||
fnames := f.file.fs.dirs[di.name]
|
||||
flen := len(fnames)
|
||||
|
||||
// If dirIdx reaches the end and the count is a positive value,
|
||||
// an io.EOF error is returned.
|
||||
// In other cases, no error will be returned even if, for example,
|
||||
// you specified more counts than the number of remaining files.
|
||||
start := f.dirIdx
|
||||
if start >= flen && count > 0 {
|
||||
return fis, io.EOF
|
||||
}
|
||||
var end int
|
||||
if count < 0 {
|
||||
end = flen
|
||||
} else {
|
||||
end = start + count
|
||||
}
|
||||
if end > flen {
|
||||
end = flen
|
||||
}
|
||||
for i := start; i < end; i++ {
|
||||
fis = append(fis, f.file.fs.files[path.Join(di.name, fnames[i])].FileInfo)
|
||||
}
|
||||
f.dirIdx += len(fis)
|
||||
return fis, nil
|
||||
}
|
||||
|
||||
func (f *httpFile) Close() error {
|
||||
return nil
|
||||
}
|
||||
24
vendor/github.com/titpetric/dockertest/.gitignore
generated
vendored
24
vendor/github.com/titpetric/dockertest/.gitignore
generated
vendored
@@ -1,24 +0,0 @@
|
||||
# Compiled Object files, Static and Dynamic libs (Shared Objects)
|
||||
*.o
|
||||
*.a
|
||||
*.so
|
||||
|
||||
# Folders
|
||||
_obj
|
||||
_test
|
||||
|
||||
# Architecture specific extensions/prefixes
|
||||
*.[568vq]
|
||||
[568vq].out
|
||||
|
||||
*.cgo1.go
|
||||
*.cgo2.c
|
||||
_cgo_defun.c
|
||||
_cgo_gotypes.go
|
||||
_cgo_export.*
|
||||
|
||||
_testmain.go
|
||||
|
||||
*.exe
|
||||
*.test
|
||||
*.prof
|
||||
10
vendor/github.com/titpetric/dockertest/.travis.yml
generated
vendored
10
vendor/github.com/titpetric/dockertest/.travis.yml
generated
vendored
@@ -1,10 +0,0 @@
|
||||
language: go
|
||||
go:
|
||||
- 1.8
|
||||
|
||||
sudo: required
|
||||
services:
|
||||
- docker
|
||||
|
||||
script:
|
||||
- go test -race -v ./...
|
||||
21
vendor/github.com/titpetric/dockertest/LICENSE
generated
vendored
21
vendor/github.com/titpetric/dockertest/LICENSE
generated
vendored
@@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017 Ian Chiles (fortytw2)
|
||||
|
||||
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:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
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.
|
||||
69
vendor/github.com/titpetric/dockertest/README.md
generated
vendored
69
vendor/github.com/titpetric/dockertest/README.md
generated
vendored
@@ -1,69 +0,0 @@
|
||||
# Dockertest [](https://travis-ci.org/fortytw2/dockertest)
|
||||
|
||||
`dockertest` allows you to quickly and easily test database interactions by
|
||||
creating and destroying databases within your tests using `docker`.
|
||||
|
||||
It works by controlling the docker daemon running locally with `exec.Command`.
|
||||
The flow is as follows ->
|
||||
|
||||
1. find a free port on the local machine
|
||||
2. launch docker container and bind that port
|
||||
3. wait until the container needs to be shutdown
|
||||
|
||||
`dockertest` is inspired by https://divan.github.io/posts/integration_testing/
|
||||
and https://github.com/ory-am/dockertest - however, it does not add 300k loc of dependencies (guesstimated) to your project. See https://github.com/fsouza/go-dockerclient/issues/599 for more info on this.
|
||||
|
||||
# Installation
|
||||
|
||||
```sh
|
||||
go get -u github.com/fortytw2/dockertest
|
||||
```
|
||||
|
||||
currently the tests depend on `github.com/lib/pq`
|
||||
|
||||
# How good is it?
|
||||
|
||||
Currently the manipulation of the docker daemon is somewhat fragile, as it depends on `exec.Command` and a well placed `time.Sleep` for shutdown. In an
|
||||
ideal world, this would use the docker api via the docker socket directly,
|
||||
but it currently works well enough for now. Contributions welcome
|
||||
|
||||
# Usage
|
||||
|
||||
Postgres example copied from `github.com/fortytw2/hydrocarbon`
|
||||
|
||||
```go
|
||||
func TestDBBits(t *testing.T) {
|
||||
container, err := dockertest.RunContainer("postgres:alpine", "5432", func(addr string) error {
|
||||
db, err := sql.Open("postgres", "postgres://postgres:postgres@"+addr+"?sslmode=disable")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return db.Ping()
|
||||
})
|
||||
defer container.Shutdown()
|
||||
if err != nil {
|
||||
t.Fatalf("could not start postgres, %s", err)
|
||||
}
|
||||
|
||||
db, err := sql.Open("postgres", "postgres://postgres:postgres@" + container.Addr + "?sslmode=disable")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// run tests on the db, etc
|
||||
}
|
||||
```
|
||||
|
||||
It should be trivial to adapt the above bits to work just as well from a
|
||||
`TestMain` function, if you want to avoid running a new container for each
|
||||
individual test function - subtests also help here.
|
||||
|
||||
### Docker-machine host
|
||||
|
||||
Note that dockertest will give priority to the `DOCKER_MACHINE_NAME` when looking for your container address and will fallback to `localhost` if it fails to find it.
|
||||
|
||||
# License
|
||||
|
||||
MIT, see LICENSE
|
||||
|
||||
128
vendor/github.com/titpetric/dockertest/container.go
generated
vendored
128
vendor/github.com/titpetric/dockertest/container.go
generated
vendored
@@ -1,128 +0,0 @@
|
||||
package dockertest
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
)
|
||||
|
||||
// A Container is a container inside docker
|
||||
type Container struct {
|
||||
Name string
|
||||
Args []string
|
||||
Addr string
|
||||
cmd *exec.Cmd
|
||||
}
|
||||
|
||||
// Shutdown ends the container
|
||||
func (c *Container) Shutdown() {
|
||||
if c != nil {
|
||||
c.cmd.Process.Signal(syscall.SIGINT)
|
||||
// Wait till the process exits.
|
||||
c.cmd.Wait()
|
||||
}
|
||||
}
|
||||
|
||||
// Shutdown ends the container
|
||||
func (c *Container) Terminate() {
|
||||
if c != nil {
|
||||
c.cmd.Process.Signal(syscall.SIGTERM)
|
||||
// Wait till the process exits.
|
||||
c.cmd.Wait()
|
||||
}
|
||||
}
|
||||
|
||||
// RunContainer runs a given docker image and returns a port on which the
|
||||
// container can be reached
|
||||
func RunContainer(name string, port string, waitFunc func(addr string) error, args ...string) (*Container, error) {
|
||||
free := freePort()
|
||||
host := getHost()
|
||||
addr := fmt.Sprintf("%s:%d", host, free)
|
||||
argsFull := append([]string{"run"}, args...)
|
||||
argsFull = append(argsFull, "-p", fmt.Sprintf("%d:%s", free, port), name)
|
||||
cmd := exec.Command("docker", argsFull...)
|
||||
// run this in the background
|
||||
|
||||
err := cmd.Start()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not run container, %s", err)
|
||||
}
|
||||
for {
|
||||
if err := waitFunc(addr); err != nil {
|
||||
continue
|
||||
}
|
||||
time.Sleep(time.Millisecond * 150)
|
||||
}
|
||||
|
||||
return &Container{
|
||||
Name: name,
|
||||
Addr: addr,
|
||||
Args: args,
|
||||
cmd: cmd,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// RunContainer runs a given docker image and returns a port on which the
|
||||
// container can be reached
|
||||
func RunContainerContext(ctx context.Context, name string, port string, waitFunc func(addr string) error, args ...string) (*Container, error) {
|
||||
free := freePort()
|
||||
host := getHost()
|
||||
addr := fmt.Sprintf("%s:%d", host, free)
|
||||
argsFull := append([]string{"run"}, args...)
|
||||
argsFull = append(argsFull, "-p", fmt.Sprintf("%d:%s", free, port), name)
|
||||
cmd := exec.Command("docker", argsFull...)
|
||||
// run this in the background
|
||||
|
||||
err := cmd.Start()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not run container, %s", err)
|
||||
}
|
||||
|
||||
result := &Container{
|
||||
Name: name,
|
||||
Addr: addr,
|
||||
Args: args,
|
||||
cmd: cmd,
|
||||
}
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-time.After(time.Millisecond * 150):
|
||||
if err := waitFunc(addr); err != nil {
|
||||
continue
|
||||
}
|
||||
return result, nil
|
||||
case <-ctx.Done():
|
||||
// we still need to Shutdown cmd
|
||||
return result, ctx.Err()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func getHost() string {
|
||||
out, err := exec.Command("docker-machine", "ip", os.Getenv("DOCKER_MACHINE_NAME")).Output()
|
||||
if err == nil {
|
||||
return strings.TrimSpace(string(out[:]))
|
||||
}
|
||||
return "localhost"
|
||||
}
|
||||
|
||||
func freePort() int {
|
||||
addr, err := net.ResolveTCPAddr("tcp", "localhost:0")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
l, err := net.ListenTCP("tcp", addr)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer l.Close()
|
||||
|
||||
return l.Addr().(*net.TCPAddr).Port
|
||||
}
|
||||
202
vendor/github.com/titpetric/statik/LICENSE
generated
vendored
202
vendor/github.com/titpetric/statik/LICENSE
generated
vendored
@@ -1,202 +0,0 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2014 Google Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
79
vendor/github.com/titpetric/statik/fs/walk.go
generated
vendored
79
vendor/github.com/titpetric/statik/fs/walk.go
generated
vendored
@@ -1,79 +0,0 @@
|
||||
// Copyright 2014 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package fs
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
"net/http"
|
||||
"path"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
// Walk walks the file tree rooted at root,
|
||||
// calling walkFn for each file or directory in the tree, including root.
|
||||
// All errors that arise visiting files and directories are filtered by walkFn.
|
||||
//
|
||||
// As with filepath.Walk, if the walkFn returns filepath.SkipDir, then the directory is skipped.
|
||||
func Walk(hfs http.FileSystem, root string, walkFn filepath.WalkFunc) error {
|
||||
dh, err := hfs.Open(root)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
di, err := dh.Stat()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fis, err := dh.Readdir(-1)
|
||||
dh.Close()
|
||||
if err = walkFn(root, di, err); err != nil {
|
||||
if err == filepath.SkipDir {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
for _, fi := range fis {
|
||||
fn := path.Join(root, fi.Name())
|
||||
if fi.IsDir() {
|
||||
if err = Walk(hfs, fn, walkFn); err != nil {
|
||||
if err == filepath.SkipDir {
|
||||
continue
|
||||
}
|
||||
return err
|
||||
}
|
||||
continue
|
||||
}
|
||||
if err = walkFn(fn, fi, nil); err != nil {
|
||||
if err == filepath.SkipDir {
|
||||
continue
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ReadFile reads the contents of the file of hfs specified by name.
|
||||
// Just as ioutil.ReadFile does.
|
||||
func ReadFile(hfs http.FileSystem, name string) ([]byte, error) {
|
||||
fh, err := hfs.Open(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var buf bytes.Buffer
|
||||
_, err = io.Copy(&buf, fh)
|
||||
fh.Close()
|
||||
return buf.Bytes(), err
|
||||
}
|
||||
Reference in New Issue
Block a user