Documentation ¶
Overview ¶
Package asset implements asset embedding via implementing http.FileSystem interface.
To use the package you would define:
//go:generate go run ../private/asset/generate/main.go -pkg main -dir ../../web/bootstrap -var embeddedAssets -out console.resource.go var embeddedAssets http.FileSystem
This will generate a new "console.resource.go" which contains the content of "../../web/bootstrap".
In the program initialization you can select based on whether the embedded resources exist or not:
var assets http.FileSystem if *staticAssetDirectory != "" { assets = http.Dir(*staticAssetDirectory) } else if embeddedAssets == nil { assets = embeddedAssets } else { assets = http.Dir(defaultAssetLocation) }
Then write the service in terms of http.FileSystem, which hides the actual thing used for loading.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Asset ¶
Asset describes a tree of asset files and directories.
func (*Asset) InmemoryCode ¶
InmemoryCode generates a function closure []byte that can be assigned to a variable.
type File ¶
File defines a readable file
type FileInfo ¶
type FileInfo struct {
// contains filtered or unexported fields
}
FileInfo implements file info.
type InmemoryFileSystem ¶
InmemoryFileSystem defines an inmemory http.FileSystem
func Inmemory ¶
func Inmemory(root *Asset) *InmemoryFileSystem
Inmemory creates an InmemoryFileSystem from