traefik/yaegi

Panic on import "github.com/aws/aws-sdk-go-v2/aws"

Closed this issue · 6 comments

repl panics when I try to import "github.com/aws/aws-sdk-go-v2/aws":

{/User/kaixia} go get -u "github.com/aws/aws-sdk-go-v2/aws"
{/User/kaixia} yaegi 
> import "github.com/aws/aws-sdk-go-v2/aws"                            
panic: reflect.StructOf: field 0 has no type

goroutine 1 [running]:
reflect.StructOf(0xc00019e820, 0x3, 0x4, 0x0, 0x0)
        /usr/local/Cellar/go/1.12.6/libexec/src/reflect/type.go:2369 +0x357c
github.com/containous/yaegi/interp.(*itype).TypeOf(0xc000292680, 0xc000265200, 0xc0001ca360)
        /Users/kaixia/.xiaket/go/src/github.com/containous/yaegi/interp/type.go:720 +0x788
github.com/containous/yaegi/interp.(*itype).TypeOf(0xc000292d00, 0x1, 0x1)
        /Users/kaixia/.xiaket/go/src/github.com/containous/yaegi/interp/type.go:713 +0x8c7
github.com/containous/yaegi/interp.(*itype).frameType(0xc000292d00, 0x11d0daa, 0xc000265380)
        /Users/kaixia/.xiaket/go/src/github.com/containous/yaegi/interp/type.go:761 +0x13f
github.com/containous/yaegi/interp.(*scope).add(0xc000265380, 0xc000292d00, 0x0)
(more traceback omitted.)

As you can see, in line 1, I've downloaded the package to local GOPATH.

The interpreter is faster than I've expected in many cases, great work!

There is a bug in yaegi when parsing the aws package or one of its dependencies (if any). We will investigate. Otherwise, thank you for your nice comment about the interpreter speed.

One more question here, will yasgi support downloading dependencies defined in go.mod/Gopkg.toml?

@jiacai2050 I think it has already been raised in #259

mpl commented

As far as I can tell, the original bug is now fixed, but we now get this:

> import "github.com/aws/aws-sdk-go-v2/aws"
1:21: import "github.com/aws/aws-sdk-go-v2/aws" error: /Users/mpl/src/github.com/aws/aws-sdk-go-v2/aws/chain_provider.go:5:2: import "github.com/aws/aws-sdk-go-v2/aws/awserr" error: /Users/mpl/src/github.com/aws/aws-sdk-go-v2/aws/awserr/types.go:157:23: cannot use type github.com/aws/aws-sdk-go-v2/aws/awserr.awsError as type error

so we might as well keep the issue open for now.

As per v0.12.0, I have the following:

> import import "github.com/aws/aws-sdk-go-v2/aws"
: 0x14000112130

Not tested further, but at least the initial import works.

I am still getting this issue, tried with traefik:v2.10.4

Any suggestions?