亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

traefik.go:命令 traefik 錯誤:無法評估新:未定義:xxx

traefik.go:命令 traefik 錯誤:無法評估新:未定義:xxx

Go
蝴蝶刀刀 2022-12-13 10:44:41
我正在嘗試構建一個 Traefik 插件并基于https://github.com/traefik/plugindemo#local-mode在本地模式下對其進行測試現在這個插件什么都不做,只返回“Hello”。這是我的文件結構:在traefik/plugins-local/src/github.com/Hongbo-Miao/traefik-plugin-disable-graphql-introspection文件夾中,我有:.traefik.ymlentryPoints:  graphql-server-entrypoint:    address: :9000api:  insecure: true  dashboard: trueproviders:  file:    filename: dynamic_conf.yamllog:  level: DEBUGexperimental:  localPlugins:    traefik-plugin-disable-graphql-introspection:      modulename: github.com/Hongbo-Miao/traefik-plugin-disable-graphql-introspectiongo.modmodule github.com/Hongbo-Miao/traefik-plugin-disable-graphql-introspectiongo 1.17主程序package mainimport (    "context"    "net/http")type Config struct{}func CreateConfig() *Config {    return &Config{}}type DisableGraphQLIntrospection struct {    next http.Handler    name string}func New(ctx context.Context, next http.Handler, config *Config, name string) (http.Handler, error) {    return &DisableGraphQLIntrospection{        next: next,        name: name,    }, nil}func (a *DisableGraphQLIntrospection) ServeHTTP(rw http.ResponseWriter, req *http.Request) {    rw.Write([]byte("hello"))}在根文件夾中,我有traefik.yamlentryPoints:  graphql-server-entrypoint:    address: :9000api:  insecure: true  dashboard: trueproviders:  file:    filename: dynamic_conf.yamllog:  level: DEBUGexperimental:  localPlugins:    traefik-plugin-disable-graphql-introspection:      modulename: github.com/Hongbo-Miao/traefik-plugin-disable-graphql-introspection
查看完整描述

1 回答

?
繁星點點滴滴

TA貢獻1803條經驗 獲得超3個贊

得到了 Tom Moulard 的答復,謝謝!https://github.com/traefik/plugindemo/issues/15#issuecomment-1123741949

你的錯誤是八重木找不到包New的功能traefik_plugin_disable_graphql_introspection。因此,您可以判斷 Yaegi 找到了您的插件并加載了它,但找不到包。package main要解決此問題,您需要將插件代碼中的行更改為package traefik_plugin_disable_graphql_introspection.

main.go文件中更改為后package main,它現在可以工作了!package traefik_plugin_disable_graphql_introspection


查看完整回答
反對 回復 2022-12-13
  • 1 回答
  • 0 關注
  • 127 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號