Skip to content

struct: preserve embedded pointer defaults when mapping - #422

Closed
Narek-Khachikyan wants to merge 1 commit into
go-ini:mainfrom
Narek-Khachikyan:fix/preserve-embedded-defaults
Closed

Narek-Khachikyan wants to merge 1 commit into
go-ini:mainfrom
Narek-Khachikyan:fix/preserve-embedded-defaults

Conversation

@Narek-Khachikyan

Copy link
Copy Markdown

Describe the pull request

MapToWithMapper replaces initialized embedded pointers before mapping, so values absent from the INI file lose their defaults. Allocate embedded pointers only when nil. Existing pointers retain their values while configured keys still update them.

Fixes #274.

Proof: both regressions fail before the fix and pass afterward. go test -race ./..., go vet ./..., and golangci-lint run pass.

Checklist

  • I agree to follow the Code of Conduct by submitting this pull request.
  • I have read and acknowledge the Contributing guide.
  • I have added test cases to cover the new code.

@Narek-Khachikyan Narek-Khachikyan closed this by deleting the head repository Nov 9, 2026
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.

MapToWithMapper deletes default values

1 participant