dc0f7b5f77
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 storagenode. Change-Id: I8bef81236be6829ed37ed4c16ef693677b93a631
24 lines
435 B
Go
24 lines
435 B
Go
// Copyright (C) 2022 Storj Labs, Inc.
|
|
// See LICENSE for copying information.
|
|
|
|
package storagenodeweb
|
|
|
|
import (
|
|
"embed"
|
|
"fmt"
|
|
"io/fs"
|
|
)
|
|
|
|
//go:embed dist/*
|
|
var assets embed.FS
|
|
|
|
// Assets contains either the built storagenode from web/storagenode/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
|
|
}()
|