Skip to content

feat: simplify key-valuer and adds 100% coverage#6

Merged
rjfonseca merged 1 commit into
mainfrom
feat/simplify-keyvaluer
Jun 20, 2025
Merged

feat: simplify key-valuer and adds 100% coverage#6
rjfonseca merged 1 commit into
mainfrom
feat/simplify-keyvaluer

Conversation

@rjfonseca
Copy link
Copy Markdown
Member

@rjfonseca rjfonseca commented Jun 18, 2025

Removes Stringer interface from the key-valuer interface.

Refactors with.go to remove an escaping param and better readability.

Adds 100% test coverage and fixes some minor issues when looping over
nil key-values.

Copilot AI review requested due to automatic review settings June 18, 2025 12:49
@rjfonseca rjfonseca requested a review from xico42 as a code owner June 18, 2025 12:49
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR simplifies the KeyValuer interface by removing its String() method and refactors with.go for clearer function-name handling.

  • Drops String() from KeyValuer and updates callers to use stringify.
  • Introduces funcNameWithLineNumber helper and cleans up isAnonymousFunction.
  • Updates formatter to call stringify(kv.Value()) instead of kv.String().

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
with.go Extracted and optimized function-name-with-line helper; refactored anonymous check
kv.go Removed String() from interface and internal stringer; switched to fmt.Stringer
formatter.go Replaced kv.String() with stringify(kv.Value()) in output
Comments suppressed due to low confidence (2)

with.go:78

  • The new helper funcNameWithLineNumber and the updated isAnonymousFunction logic aren’t covered by existing tests; consider adding unit tests to validate both normal and anonymous function name formatting.
func funcNameWithLineNumber(funcName string, line int) string {

with.go:68

  • [nitpick] The comment describes only the dot-containing case but omits the behavior when no dot is found; consider updating it to fully explain both branches.
// It does this by checking if the function name contains a dot (.) and starts with "func" after the last dot.

Comment thread with.go Outdated
@rjfonseca rjfonseca force-pushed the feat/simplify-keyvaluer branch 2 times, most recently from 9b85bbc to f842566 Compare June 20, 2025 12:08
Removes Stringer interface from the key-valuer interface.

Refactors with.go to remove an escaping param and better readability.

Adds 100% test coverage and fixes some minor issues when looping over
nil key-values.
@rjfonseca rjfonseca force-pushed the feat/simplify-keyvaluer branch from f842566 to e1d1cfa Compare June 20, 2025 12:29
@rjfonseca rjfonseca changed the title feat: simplify key-valuer interface feat: simplify key-valuer and adds 100% coverage Jun 20, 2025
@rjfonseca rjfonseca merged commit d7c3b15 into main Jun 20, 2025
3 checks passed
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.

3 participants