first go:embed 1.16 implementation
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
module github.com/owncloud/ocis/graph-explorer
|
||||
|
||||
go 1.13
|
||||
go 1.16
|
||||
|
||||
require (
|
||||
contrib.go.opencensus.io/exporter/jaeger v0.2.1
|
||||
@@ -16,7 +16,6 @@ require (
|
||||
github.com/spf13/viper v1.7.1
|
||||
github.com/thejerf/suture/v4 v4.0.0
|
||||
go.opencensus.io v0.23.0
|
||||
golang.org/x/net v0.0.0-20210119194325-5f4716e94777
|
||||
)
|
||||
|
||||
replace (
|
||||
|
||||
@@ -346,7 +346,6 @@ github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5Kwzbycv
|
||||
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
|
||||
github.com/fatih/structs v1.0.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
|
||||
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
|
||||
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjrss6TZTdY2VfCqZPbv5k3iBFa2ZQ=
|
||||
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
|
||||
github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
|
||||
github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package graph_explorer
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"io/fs"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
//go:embed assets/*
|
||||
var assets embed.FS
|
||||
|
||||
// Assets FS
|
||||
var Assets http.FileSystem
|
||||
|
||||
func init() {
|
||||
embedFS, err := fs.Sub(assets, "assets")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
Assets = http.FS(embedFS)
|
||||
}
|
||||
@@ -1,15 +1,12 @@
|
||||
package assets
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
graph_explorer "github.com/owncloud/ocis/graph-explorer"
|
||||
"github.com/owncloud/ocis/graph-explorer/pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/log"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
//go:generate make -C ../.. embed.yml
|
||||
|
||||
// assets gets initialized by New and provides the handler.
|
||||
type assets struct {
|
||||
logger log.Logger
|
||||
@@ -18,12 +15,7 @@ type assets struct {
|
||||
|
||||
// Open just implements the HTTP filesystem interface.
|
||||
func (a assets) Open(original string) (http.File, error) {
|
||||
return FS.OpenFile(
|
||||
CTX,
|
||||
original,
|
||||
os.O_RDONLY,
|
||||
0644,
|
||||
)
|
||||
return graph_explorer.Assets.Open(original)
|
||||
}
|
||||
|
||||
// New returns a new http filesystem to serve assets.
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
package assets
|
||||
|
||||
import (
|
||||
// Fake the import to make the dep tree happy.
|
||||
_ "golang.org/x/net/context"
|
||||
|
||||
// Fake the import to make the dep tree happy.
|
||||
_ "golang.org/x/net/webdav"
|
||||
)
|
||||
File diff suppressed because one or more lines are too long
@@ -1,16 +0,0 @@
|
||||
---
|
||||
pkg: "assets"
|
||||
dest: "."
|
||||
output: "embed.go"
|
||||
fmt: true
|
||||
noprefix: true
|
||||
|
||||
compression:
|
||||
compress: true
|
||||
|
||||
custom:
|
||||
- files:
|
||||
- "../../assets/"
|
||||
base: "../../assets/"
|
||||
prefix: ""
|
||||
...
|
||||
Reference in New Issue
Block a user