first go:embed 1.16 implementation
This commit is contained in:
@@ -15,7 +15,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 (
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package assets
|
||||
|
||||
import (
|
||||
"github.com/owncloud/ocis/web"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
@@ -9,8 +10,6 @@ import (
|
||||
"github.com/owncloud/ocis/web/pkg/config"
|
||||
)
|
||||
|
||||
//go:generate make -C ../.. embed.yml
|
||||
|
||||
// assets gets initialized by New and provides the handler.
|
||||
type assets struct {
|
||||
logger log.Logger
|
||||
@@ -42,12 +41,7 @@ func (a assets) Open(original string) (http.File, error) {
|
||||
}
|
||||
}
|
||||
|
||||
return FS.OpenFile(
|
||||
CTX,
|
||||
original,
|
||||
os.O_RDONLY,
|
||||
0644,
|
||||
)
|
||||
return web.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,23 +0,0 @@
|
||||
---
|
||||
pkg: "assets"
|
||||
dest: "."
|
||||
output: "embed.go"
|
||||
fmt: true
|
||||
noprefix: true
|
||||
|
||||
compression:
|
||||
compress: true
|
||||
|
||||
custom:
|
||||
- files:
|
||||
- "../../assets/"
|
||||
base: "../../assets/"
|
||||
prefix: ""
|
||||
exclude:
|
||||
- "appinfo/**"
|
||||
- "LICENSE/**"
|
||||
- "CHANGELOG.md"
|
||||
- "README.md"
|
||||
- "config.json"
|
||||
|
||||
...
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package web
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"io/fs"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
//go:embed assets/*
|
||||
//go:embed assets/js/*
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user