storj/web/multinode/assets.go
Egon Elbre 28c9403702 multinode,web/multinode: use go:embed for assets
Go can now directly embed files without relying on external tools.
This makes code use go:embed and avoid the external tooling.

go:embed requires files to be present in the embedded directory,
hence we need to add .keep to "dist" folder. We also add one to
public/.keep, such that it won't be deleted when building multinode.

Change-Id: I53ac3d5ac76e44f740d95221acf0da99fc256d42
2022-03-11 11:10:37 +02:00

24 lines
429 B
Go

// Copyright (C) 2022 Storj Labs, Inc.
// See LICENSE for copying information.
package multinodeweb
import (
"embed"
"fmt"
"io/fs"
)
//go:embed dist/*
var assets embed.FS
// Assets contains either the built multinode from web/multinode/dist directory
// or it is empty.
var Assets = func() fs.FS {
dist, err := fs.Sub(assets, "dist")
if err != nil {
panic(fmt.Errorf("invalid embedding: %w", err))
}
return dist
}()