Files
coder/site/site_embed.go
Kyle Carberry 61aacff444 chore: Refactor site to improve testing (#2014)
It was difficult to develop this package due to the
embed build tag being mandatory on the tests. The logic
to test doesn't require any embedded files.
2022-06-03 04:27:21 +00:00

25 lines
413 B
Go

//go:build embed
// +build embed
package site
import (
"embed"
"io/fs"
)
//go:embed out
//go:embed out/bin/*
var site embed.FS
func FS() fs.FS {
// the out directory is where webpack builds are created. It is in the same
// directory as this file (package site).
out, err := fs.Sub(site, "out")
if err != nil {
// This can't happen... Go would throw a compilation error.
panic(err)
}
return out
}