Skip to content

Conversation

@chengpeng-wang
Copy link

Hi, I found that when *excludeInterfaces at line 79 in the file mockgen/parse.go is in the form of ",,,," and " , , ", the function parseExcludeInterfaces will create unnecessary map allocation or maintain whitespace entries as the names of excluded interfaces [Link], which is not necessary.

With this patch, the function parseExcludeInterfaces now returns nil instead, which more accurately represents the absence of exclusions and avoids a redundant allocation.

This change is fully backward-compatible and requires no changes in downstream code. I think this patch can improve the code quality due to the better input validation and format check. Please let me know whether you need more adjustment on the patch.

@chengpeng-wang chengpeng-wang changed the title Avoid unnecessary map allocation in parseExcludeInterfaces for empty … Avoid unnecessary map allocation in parseExcludeInterfaces Jun 4, 2025
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.

1 participant