gogf / gf

GoFrame is a modular, powerful, high-performance and enterprise-class application development framework of Golang.
https://goframe.org
MIT License
11.48k stars 1.57k forks source link

github.com/gogf/gf/v2/frame/g cannot get instance #3703

Open YoungBoyGod opened 1 month ago

YoungBoyGod commented 1 month ago

Go version

go 1.22.4 amd64

GoFrame version

2.7.1

Can this bug be reproduced with the latest release?

Option Yes

What did you do?

i want to get client instance,but get null.

test one: ` package gerritLogicV1

import ( "HaiTangOps/internal/model/gerritModelV1" "HaiTangOps/internal/service" "context" //"github.com/andygrunwald/go-gerrit" "github.com/gogf/gf/v2/frame/g" "golang.org/x/build/gerrit" )

type sGerritV1 struct{}

func New() *sGerritV1 { return &sGerritV1{} }

func init() { service.RegisterGerritV1(New()) } func (s sGerritV1) GetGerritInstance(ctx context.Context, input gerritModelV1.GetGerritInstanceInput) (output *gerrit.Client) { // todo 需要增加登录gerrit 的功能模块 g.Log().Debug(context.Background(), "input", input) // 1.输入地址,用户名密码 client := gerrit.NewClient(input.Url, gerrit.BasicAuth(input.Username, input.Password)) g.Log("gerrit").Debug(ctx, "output", client) return client

}

2024-07-23 20:49:34.763 [DEBU] input {"Username":"aadmin","Password":"admin","Url":"http://192.168.10.211:8080"} 2024-07-23 20:49:34.763 [DEBU] {bc25aeb279d8e41780d46416e24a9e43} output {"HTTPClient":null} 2024-07-23 20:49:34.763 [INFO] {bc25aeb279d8e41780d46416e24a9e43} {"HTTPClient":null} ` test two: image

What did you see happen?

i donnt kown why i cannot get client instance use gf i try use gin ,it is ok。 so what is wrong ?

What did you expect to see?

i want get the instance in gf image

YoungBoyGod commented 1 month ago

image it seem run to a loop