-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
引入新请求类型,修复「添加企业客户标签」功能 #126
Conversation
合并后麻烦加个tag |
hi~ 这个mr有问题嘛 我看一直没有回复or合并 @xen0n |
Hi,不好意思前面在做别的开源项目。 这里目前是直接把 doc md 中的 JSON 列的语义当成 Go 的 struct tag 了,严格意义上属于实现细节泄漏,不过目前因为 主要就是我想不明白为啥以前没问题的调用,现在就不行了?“空字符错误”具体是个啥我也不清楚。如果有可能的话补个测试或者至少说明一下想做的事情,预期的结果,实际的响应会比较好。 |
我的需求需要用到添加企业客户标签这个接口,此接口若有key但值为空的话,会报错unexpected empty string |
我知道了,此处不该复用结构体。。定义一个专门的小结构体就行了。不用加omitempty... |
不行的 有些参数是选填,如果真的需要有值的话,这些key还是要带上的,所以我加了omitempty |
又看了下文档,有些懂了,这接口里很多字段说的都是“必填:否”,这时候传一个空值和不传确实语义不同。 有个比较难顶的地方在于,如果不使用指针类型或者额外 flags,Go 无论在编译时还是运行时都无法区分传一个空值和不传值两种情况。我们是否有必要弄一个 |
赞同,确实需要新建一个struct,学到了 感谢 @xen0n |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
改完之后把提交 squash 成一个应该就可以了
5b2e62d
to
b26b7b6
Compare
提交已squash成一个 @xen0n |
f9809fd
to
082e8dc
Compare
fix invalid group id unexpected empty string build(deps): bump github.com/urfave/cli/v2 from 2.23.6 to 2.23.7 Bumps [github.com/urfave/cli/v2](https://github.com/urfave/cli) from 2.23.6 to 2.23.7. - [Release notes](https://github.com/urfave/cli/releases) - [Changelog](https://github.com/urfave/cli/blob/main/docs/CHANGELOG.md) - [Commits](urfave/cli@v2.23.6...v2.23.7) --- updated-dependencies: - dependency-name: github.com/urfave/cli/v2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> fix invalid group id unexpected empty string build(deps): bump github.com/urfave/cli/v2 from 2.23.6 to 2.23.7 Bumps [github.com/urfave/cli/v2](https://github.com/urfave/cli) from 2.23.6 to 2.23.7. - [Release notes](https://github.com/urfave/cli/releases) - [Changelog](https://github.com/urfave/cli/blob/main/docs/CHANGELOG.md) - [Commits](urfave/cli@v2.23.6...v2.23.7) --- updated-dependencies: - dependency-name: github.com/urfave/cli/v2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> add omitempty fix invalid group id unexpected empty string fix go mod fix
082e8dc
to
2068419
Compare
帮你改了 PR 标题,今天下班前会有一个新 tag,不 bump 大版本(因为按照当前改动的性质,先前这个接口想必是不能正常使用的,所以能够假定不会存在野生代码依赖了先前的方法签名) 十分感谢贡献! bors r+ |
Build succeeded:
|
tag 请慢用! |
新增omitempty,防止请求时报空字符错误