traefik / yaegi

Yaegi is Another Elegant Go Interpreter

Home Page:https://pkg.go.dev/github.com/traefik/yaegi

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

package unsafe \"unsafe\" has no symbol Slice"

section1Q84 opened this issue · comments

The following program sample.go triggers an unexpected result

package main

import (
  "github.com/traefik/yaegi/stdlib"
  "github.com/traefik/yaegi/stdlib/unsafe"
)

var payload = `
package main

func main() {
  StringToBytes("a")
}
func StringToBytes(s string) []byte {
	return unsafe.Slice(unsafe.StringData(s), len(s))
}
`

func main() {
  i := interp.New(interp.Options{})
  i.Use(stdlib.Symbols)
  i.Use(unsafe.Symbols)
}

Expected result

normal

Got

package unsafe \"unsafe\" has no symbol Slice"

Yaegi Version

latest

Additional Notes

No response