traefik / yaegi

Yaegi is Another Elegant Go Interpreter
https://pkg.go.dev/github.com/traefik/yaegi
Apache License 2.0
6.78k stars 341 forks source link

import \"slices\" error: unable to find source related to: \"slices\" #1608

Closed darkweak closed 5 months ago

darkweak commented 5 months ago

The following program sample.go triggers an unexpected result

package main

import (
    "fmt"
    "strings"
)

func main() {
    vals := []string{"A", "B", "C"}
    if slices.Contains(vals, "*") {
        fmt.Println("found")
        return
    }

    fmt.Println("not found")
}

Expected result

found

Got

import \"slices\" error: unable to find source related to: \"slices\"

Yaegi Version

v0.15.1

Additional Notes

That affects the latest Traefik version!

ldez commented 5 months ago

Hello,

Yaegi supports go1.19 and go1.20. https://github.com/traefik/yaegi?tab=readme-ov-file#features

go1.21 and higher are not supported https://github.com/traefik/yaegi/pull/1598

https://github.com/traefik/yaegi/issues/1601 https://github.com/traefik/yaegi/issues/1597