zinx icon indicating copy to clipboard operation
zinx copied to clipboard

项目自定义 flag 参数不能解析

Open threeq opened this issue 1 year ago • 4 comments

在 lobalobj.go 的 init 方法中 199 行调用 uflag.Parse() 导致项目中自定义参数不生效 image

threeq avatar Aug 14 '23 02:08 threeq

@threeq 这确实是个好问题,可以讨论下有没有更好的办法来解决。

aceld avatar Aug 16 '23 02:08 aceld

我们现在的做法是把这里注释掉。在项目中的 Init 方法调用 uflag.Parse()

https://github.com/threeq/zinx/commit/be85c35c474ab6cf62c5a0435436b41dd8c3156d

threeq avatar Aug 30 '23 09:08 threeq

// (防止 go test 出现"flag provided but not defined: -test.paniconexit0"等错误)

这个问题我们这里没有出现,我们用的是 go 1.20.7 版本

threeq avatar Aug 30 '23 09:08 threeq

zinx 不应该用flag 占用 用户的flag~ 我有一个pr , 可以通过环境变量导入 configPath

valiner avatar Sep 08 '23 04:09 valiner