From eb9ed15195db1822e0e6faee3d0f160b907cc457 Mon Sep 17 00:00:00 2001 From: divolgin Date: Mon, 20 Jul 2020 21:46:19 +0000 Subject: [PATCH] go mod updates --- go.mod | 2 +- go.sum | 8 ++--- .../elazarl/go-bindata-assetfs/README.md | 32 ++++++++++++++----- .../elazarl/go-bindata-assetfs/assetfs.go | 14 ++++++-- .../elazarl/go-bindata-assetfs/doc.go | 2 +- vendor/modules.txt | 2 +- 6 files changed, 40 insertions(+), 20 deletions(-) diff --git a/go.mod b/go.mod index b7fb14c07..eecfcb27a 100644 --- a/go.mod +++ b/go.mod @@ -28,7 +28,7 @@ require ( github.com/docker/go-units v0.3.3 github.com/docker/spdystream v0.0.0-20170912183627-bc6354cbbc29 // indirect github.com/dsnet/compress v0.0.0-20171208185109-cc9eb1d7ad76 // indirect - github.com/elazarl/go-bindata-assetfs v1.0.0 + github.com/elazarl/go-bindata-assetfs v1.0.1 github.com/elazarl/goproxy v0.0.0-20190711103511-473e67f1d7d2 // indirect github.com/elazarl/goproxy/ext v0.0.0-20190711103511-473e67f1d7d2 // indirect github.com/emicklei/go-restful v2.8.1+incompatible // indirect diff --git a/go.sum b/go.sum index 9915ca955..682c2a3f0 100644 --- a/go.sum +++ b/go.sum @@ -126,8 +126,8 @@ github.com/dsnet/compress v0.0.0-20171208185109-cc9eb1d7ad76 h1:eX+pdPPlD279OWgd github.com/dsnet/compress v0.0.0-20171208185109-cc9eb1d7ad76/go.mod h1:KjxHHirfLaw19iGT70HvVjHQsL1vq1SRQB4yOsAfy2s= github.com/dylanmei/iso8601 v0.1.0/go.mod h1:w9KhXSgIyROl1DefbMYIE7UVSIvELTbMrCfx+QkYnoQ= github.com/dylanmei/winrmtest v0.0.0-20170819153634-c2fbb09e6c08/go.mod h1:VBVDFSBXCIW8JaHQpI8lldSKfYaLMzP9oyq6IJ4fhzY= -github.com/elazarl/go-bindata-assetfs v1.0.0 h1:G/bYguwHIzWq9ZoyUQqrjTmJbbYn3j3CKKpKinvZLFk= -github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4= +github.com/elazarl/go-bindata-assetfs v1.0.1 h1:m0kkaHRKEu7tUIUFVwhGGGYClXvyl4RE03qmvRTNfbw= +github.com/elazarl/go-bindata-assetfs v1.0.1/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4= github.com/elazarl/goproxy v0.0.0-20190711103511-473e67f1d7d2 h1:aZtFdDNWY/yH86JPR2WX/PN63635VsE/f/nXNPAbYxY= github.com/elazarl/goproxy v0.0.0-20190711103511-473e67f1d7d2/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= github.com/elazarl/goproxy/ext v0.0.0-20190711103511-473e67f1d7d2 h1:dWB6v3RcOy03t/bUadywsbyrQwCqZeNIEX6M1OtSZOM= @@ -195,10 +195,6 @@ github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4er github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef h1:veQD95Isof8w9/WXiA+pa3tz3fJXkt5B7QaRBrM62gk= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1 h1:qGJ6qTW+x6xX/my+8YUVl4WNpX9B7+/l2tRsHGZ7f2s= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/mock v1.4.1 h1:ocYkMQY5RrXTYgXl7ICpV0IXwlEQGwKIsery4gyXa1U= -github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.3 h1:GV+pQPG/EUUbkh47niozDcADz6go/dUwhVzdUQHIVRw= github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= diff --git a/vendor/github.com/elazarl/go-bindata-assetfs/README.md b/vendor/github.com/elazarl/go-bindata-assetfs/README.md index 27ee48f09..b326dca19 100644 --- a/vendor/github.com/elazarl/go-bindata-assetfs/README.md +++ b/vendor/github.com/elazarl/go-bindata-assetfs/README.md @@ -1,6 +1,6 @@ # go-bindata-assetfs -Serve embedded files from [jteeuwen/go-bindata](https://github.com/jteeuwen/go-bindata) with `net/http`. +Serve embedded files from [go-bindata](https://github.com/go-bindata/go-bindata) with `net/http`. [GoDoc](http://godoc.org/github.com/elazarl/go-bindata-assetfs) @@ -8,12 +8,12 @@ Serve embedded files from [jteeuwen/go-bindata](https://github.com/jteeuwen/go-b Install with - $ go get github.com/jteeuwen/go-bindata/... + $ go get github.com/go-bindata/go-bindata/... $ go get github.com/elazarl/go-bindata-assetfs/... ### Creating embedded data -Usage is identical to [jteeuwen/go-bindata](https://github.com/jteeuwen/go-bindata) usage, +Usage is identical to [go-bindata](https://github.com/go-bindata/go-bindata) usage, instead of running `go-bindata` run `go-bindata-assetfs`. The tool will create a `bindata_assetfs.go` file, which contains the embedded data. @@ -37,10 +37,26 @@ You can always just run the `go-bindata` tool, and then use - import "github.com/elazarl/go-bindata-assetfs" - ... - http.Handle("/", - http.FileServer( - &assetfs.AssetFS{Asset: Asset, AssetDir: AssetDir, AssetInfo: AssetInfo, Prefix: "data"})) +```go +import "github.com/elazarl/go-bindata-assetfs" +... +http.Handle("/", +http.FileServer( +&assetfs.AssetFS{Asset: Asset, AssetDir: AssetDir, AssetInfo: AssetInfo, Prefix: "data"})) +``` to serve files embedded from the `data` directory. + +## SPA applications + +For single page applications you can use `Fallback: "index.html"` in AssetFS context, so if route doesn't match the pattern it will fallback to file specified. + +example + +```go +import "github.com/elazarl/go-bindata-assetfs" +... +http.Handle("/", +http.FileServer( +&assetfs.AssetFS{Asset: Asset, AssetDir: AssetDir, AssetInfo: AssetInfo, Prefix: "data", Fallback: "index.html"})) +``` diff --git a/vendor/github.com/elazarl/go-bindata-assetfs/assetfs.go b/vendor/github.com/elazarl/go-bindata-assetfs/assetfs.go index 04f6d7a39..81874973d 100644 --- a/vendor/github.com/elazarl/go-bindata-assetfs/assetfs.go +++ b/vendor/github.com/elazarl/go-bindata-assetfs/assetfs.go @@ -137,6 +137,8 @@ type AssetFS struct { AssetInfo func(path string) (os.FileInfo, error) // Prefix would be prepended to http requests Prefix string + // Fallback file that is served if no other is found + Fallback string } func (fs *AssetFS) Open(name string) (http.File, error) { @@ -153,9 +155,13 @@ func (fs *AssetFS) Open(name string) (http.File, error) { } return NewAssetFile(name, b, timestamp), nil } - if children, err := fs.AssetDir(name); err == nil { - return NewAssetDirectory(name, children, fs), nil - } else { + children, err := fs.AssetDir(name) + + if err != nil { + if len(fs.Fallback) > 0 { + return fs.Open(fs.Fallback) + } + // If the error is not found, return an error that will // result in a 404 error. Otherwise the server returns // a 500 error for files not found. @@ -164,4 +170,6 @@ func (fs *AssetFS) Open(name string) (http.File, error) { } return nil, err } + + return NewAssetDirectory(name, children, fs), nil } diff --git a/vendor/github.com/elazarl/go-bindata-assetfs/doc.go b/vendor/github.com/elazarl/go-bindata-assetfs/doc.go index a664249f3..8f8f2c3db 100644 --- a/vendor/github.com/elazarl/go-bindata-assetfs/doc.go +++ b/vendor/github.com/elazarl/go-bindata-assetfs/doc.go @@ -1,7 +1,7 @@ // assetfs allows packages to serve static content embedded // with the go-bindata tool with the standard net/http package. // -// See https://github.com/jteeuwen/go-bindata for more information +// See https://github.com/go-bindata/go-bindata for more information // about embedding binary data with go-bindata. // // Usage example, after running diff --git a/vendor/modules.txt b/vendor/modules.txt index a42ff603d..515fa379c 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -142,7 +142,7 @@ github.com/dsnet/compress/bzip2/internal/sais github.com/dsnet/compress/internal github.com/dsnet/compress/internal/errors github.com/dsnet/compress/internal/prefix -# github.com/elazarl/go-bindata-assetfs v1.0.0 +# github.com/elazarl/go-bindata-assetfs v1.0.1 github.com/elazarl/go-bindata-assetfs # github.com/emicklei/go-restful v2.8.1+incompatible github.com/emicklei/go-restful