Open GodGavin opened 3 years ago
It works with compiler instructions. The imported type should be string
, []byte
or FS.
Short example, don't forget to import embed
:
//go:embed hello.txt
var f embed.FS
data, _ := f.ReadFile("hello.txt")
print(string(data))
For more information, you can check this issue : https://github.com/golang/go/issues/41191
Another example, as string :
package main
import _"embed"
func main() {
//go:embed "hello.txt"
var s string
print(s)
}
You can't. The manifest has to be in a specific section of the exe file. This is different from the embed package.
You may use go-winres, if you wish. It builds the manifest for you:
go install github.com/tc-hib/go-winres@latest
go-winres simply --manifest gui
Or in the code, for go generate
:
//go:generate go-winres simply --manifest gui
in the incoming go-1.16 , we can use the ‘’embed‘’ lib to embed static resources,so how can i use this way to embed the manifest file to build the exe instead of using the "github.com/akavel/rsrc" lib ;thanks