Skip to content

section: return a zero-value Key for empty names - #395

Open
team-humaki wants to merge 1 commit into
go-ini:mainfrom
team-humaki:key-empty-name-zero-value
Open

team-humaki wants to merge 1 commit into
go-ini:mainfrom
team-humaki:key-empty-name-zero-value

Conversation

@team-humaki

Copy link
Copy Markdown

Fixes #358

Section.Key is documented to return a zero-value when the name is missing. NewKey still rejects empty names, and the error was discarded, so Key("") was nil.

Return a zero-value Key instead of inserting an empty name. NewKey("") still errors.

Key() documents a zero-value when the name is missing, but NewKey
rejects empty names and the error was discarded, so Key("") was nil
and paniced callers. Return newKey instead of inserting an empty name.

Fixes go-ini#358

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Section.Key passing a empty key name will return a nil

1 participant