You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following program sample.go triggers an unexpected result
package main
import (
"context""fmt""log""time""github.com/traefik/yaegi/interp""github.com/traefik/yaegi/stdlib"
)
funcmain() {
i:=interp.New(interp.Options{})
i.Use(stdlib.Symbols)
i.Use(interp.Symbols)
ctx, cancel:=context.WithTimeout(context.Background(), time.Second*5)
_, err:=i.EvalWithContext(ctx, `package main import ( "fmt" "time" ) func main() { fmt.Println("print in main") go func() { for { select { case <-time.After(time.Second): fmt.Println("print in goroutine") } } }() }`)
iferr!=nil {
log.Fatal(err)
}
gofunc() {
<-ctx.Done()
fmt.Println("context canceled")
// i.Stop() // calling stop method manually can stop backend goroutine
}()
time.Sleep(time.Second*3)
cancel()
select {}
}
Expected result
$ go run ./sample.go print in mainprint in goroutineprint in goroutinecontext canceledprint in goroutineprint in goroutineprint in goroutineprint in goroutineprint in goroutineprint in goroutineprint in goroutine
Got
$ yaegi ./sample.go// output
Yaegi Version
v0.16.1
Additional Notes
No response
The text was updated successfully, but these errors were encountered:
The following program
sample.go
triggers an unexpected resultExpected result
Got
Yaegi Version
v0.16.1
Additional Notes
No response
The text was updated successfully, but these errors were encountered: