Import error while using in a Traefik plugin #235
Replies: 3 comments 3 replies
-
I've created a 7 line program that creates a connection, a channel, and closes them both, vendor'ed the modules and it builds fine. I highly doubt that vendoring this module is broken in any way, and it looks like something specific to your environment/setup/code. go.modmodule localtest
go 1.21.5
require github.com/rabbitmq/amqp091-go v1.9.0 // indirect main.gopackage main
import (
"log"
amqp "github.com/rabbitmq/amqp091-go"
)
func main() {
log.Println("hello world!")
conn, _ := amqp.Dial("amqp://localhost")
ch, _ := conn.Channel()
log.Println("I have a channel!")
conn.Close()
ch.Close()
log.Println("Bye world!")
} commandsgo get github.com/rabbitmq/amqp091-go
go mod vendor
go build -mod=vendor main.go I'll be happy to look at this issue if you can repro without traefik, or other external dependencies, in the mix. |
Beta Was this translation helpful? Give feedback.
-
I never said that the problem was related to the placement of the module in the vendor directory, I just mentioned all the details. |
Beta Was this translation helpful? Give feedback.
-
According to my research, this issue may be related to Yaegi, a traefik plugin runtime environment. I'm still not 100% sure and would appreciate any help. |
Beta Was this translation helpful? Give feedback.
-
Describe the bug
I am trying to implement a Traefik plugin here https://github.com/ion-toolbox/traefik-jwt-eddsa
When Traefik loads the plugin, I receive an error message
ERR github.com/traefik/traefik/v3/cmd/traefik/traefik.go:220 > Plugins are disabled because an error has occurred. error="github.com/ion-toolbox/traefik-jwt-eddsa: failed to import plugin code \"github.com/ion-toolbox/traefik-jwt-eddsa\": 1:21: import \"github.com/ion-toolbox/traefik-jwt-eddsa\" error: plugins-local/src/github.com/ion-toolbox/traefik-jwt-eddsa/plugin.go:9:2: import \"github.com/rabbitmq/amqp091-go\" error: plugins-local/src/github.com/ion-toolbox/traefik-jwt-eddsa/vendor/github.com/rabbitmq/amqp091-go/channel.go:425:18: cannot use type func(amqp091.frame) as type func(*struct {},amqp091.frame)"
As you can see, an exception fires at the import directive, i.e. my own code doesn't start.
FYI: as per traefik plugin documentation, all the modules have to be vendored.
Reproduction steps
Expected behavior
The plugin should start
Additional context
No response
Beta Was this translation helpful? Give feedback.
All reactions