Closed laushunyu closed 1 year ago
sample.go
package main import ( "fmt" "github.com/traefik/yaegi/interp" "github.com/traefik/yaegi/stdlib" ) func main() { interpreter := interp.New(interp.Options{}) interpreter.Use(stdlib.Symbols) _, err := interpreter.Compile(`package main import ( _ "embed" ) //go:embed symbol.go var raw []byte func SelfSrc() []byte { return raw }`) if err != nil { panic(err) } mainSymbols := interpreter.Symbols("main")["main"] SelfSrc := mainSymbols["SelfSrc"].Interface().(func() []byte) fmt.Printf("src code: %s", SelfSrc()) }
# go run . src code: <src code of sample.go>
# go run . src code:
v0.15.1
hi, I found embed.FS symbol in stdlib, but //go:embed not work, is it expected?😇
embed.FS
//go:embed
The following program
sample.go
triggers an unexpected resultExpected result
Got
Yaegi Version
v0.15.1
Additional Notes
hi, I found
embed.FS
symbol in stdlib, but//go:embed
not work, is it expected?😇