Bug fix: omitempty
关键字,给它赋的值恰好等于默认空值的话,在转为 json 之后也不会输出这个 field
#539
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
CheckPath
这个字段默认是false,就算赋值了,只有true才能被json解析,这个是“omitempty” 关键字的LineColor
这个字段也是,如果直接给Color结构体,就算注明omitempty
关键字也无用,需要指针,这样 Golang 就能知道一个指针的“空值”是多少了,否则面对一个我们自定义的结构, Golang 是猜不出我们想要的空值的详情
https://www.jianshu.com/p/a2ed0d23d1b0