You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Key assumes named Key exists in section and returns a zero-value when not.
func (s *Section) Key(name string) *Key {
key, err := s.GetKey(name)
if err != nil {
// It's OK here because the only possible error is empty key name,
// but if it's empty, this piece of code won't be executed.
key, _ = s.NewKey(name, "")
return key
}
return key
}
Version
1.66.6
Describe the bug
https://github.com/go-ini/ini/blob/main/section.go#L169
注释有点没看懂,为什么传入空键值,代码不会执行?我传入了空键值,导致返回了一个nil,由于没有检查,导致了panic。按理说这里不应该返回nil吧。
To reproduce
Expected behavior
是否可以改为传入空键值时不返回nil,或者说为什么不支持空字符串作为键值?
Additional context
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: