Repository navigation
fix: stringify *string values in toString - #487
Open
sb123sb123 wants to merge 1 commit into
Open
sb123sb123 wants to merge 1 commit into
sb123sb123 wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
toStringcurrently formats*stringvalues withfmt.Sprintf("%v", v), exposing the pointer address; a nil*stringis rendered as<nil>. Handle*stringexplicitly so the referenced value is returned, with an empty string for nil pointers.Fixes #439
Changes
*stringhandling tostrval.*stringvalues.Testing
go test ./... -run "TestToStringPointers|TestToString" -count=1� passgo vet ./...� passgofmt -w strings.go strings_test.goandgit diff --check� passgo test ./... -count=1� the existingTestHtmlDatefails on this Windows runner (2019-06-14received vs2019-06-13expected); the same failure was reproduced with the implementation reverted, so it is unrelated.go test -cover . -count=1� same pre-existingTestHtmlDatefailure; coverage reached 84.4%.proxy.golang.orgwas unreachable from the runner, so dependencies were fetched throughhttps://goproxy.cn,direct; no dependency files changed.Local validation used the available G-drive Go 1.26.7 toolchain; repository CI remains the coverage for its Go 1.22-1.24 matrix.
AI assistance
This change was prepared with AI assistance from Codex. The implementation, regression test, complete diff, signature, and test results were reviewed before submission.