jinzhu / copier

Copier for golang, copy value from struct to struct and more
MIT License
5.58k stars 489 forks source link

nopanic Tag无效 #163

Open jassls opened 2 years ago

jassls commented 2 years ago

Reproducible Example

copier:"must,nopanic"无法返回错误

Description

copier:"must,nopanic" 在未发生拷贝时无法返回错误 copier:"must, nopanic" 在未发生拷贝时可以返回错误 区别逗号后多了一个空格 go version 1.16

daidai21 commented 2 years ago

这里没有去除空格 https://github.com/jinzhu/copier/blob/0e264e93b8f4334ee24e3d8811e3f76c50734258/copier.go#L577

e.g. t.Logf(ToString(strings.Split("a, b,c", ","))) -> ["a"," b","c"]

" nopanic"的flg没有解析出来

Haimiandiaodiao commented 1 year ago

https://github.com/jinzhu/copier/blob/f0faaa445b76a1d8c9246d7cfd2113a65a0cfe44/copier.go#L692 问题应该是 声明了error 但是没有返回