Skip to content

v2.1.3: Code quality, documentation, and test improvements - #16

Merged
mkenney merged 3 commits into
mainfrom
v2.1.3-dev
May 14, 2026
Merged

v2.1.3: Code quality, documentation, and test improvements#16
mkenney merged 3 commits into
mainfrom
v2.1.3-dev

Conversation

@mkenney

@mkenney mkenney commented May 14, 2026

Copy link
Copy Markdown
Member

Added

  • Doc comments added to previously undocumented exported and internal symbols:
    • Tmap type
    • ErrorSignedToUnsigned, ErrorInvalidOption, ErrorStrErrorCastingFunc, ErrorStrUnableToCast (clarifying the string vars are format strings, not error values)
    • castToType — all 8 dispatch cases documented
  • New godoc examples: ExampleTo_map, ExampleTo_struct, ExampleToE_mapDuplicateKeyError, ExampleToE_structNested, ExampleToE_structStrict, ExampleToE_mapToPrivateStruct.

Changed

  • Renamed the sentinel error variable Error to ErrorUnableToCast. Error is retained as a deprecated alias with a // Deprecated: godoc annotation for backward compatibility.
  • Example function suffixes converted from snake_case to camelCase (e.g. ExampleToE_mapFromMap) so all examples appear in godoc. Suffixes containing underscores are silently dropped by godoc.

Fixed

  • ToE doc referenced non-existent type Ops (correct type is Op) and contained double word "the the" — corrected.
  • ToStructE doc omitted *struct as a valid source type — corrected.
  • toSlice doc was circular and meaningless — rewritten.
  • ops.Global doc omitted FORMAT from the global flag list and DECODE from the local flag list — corrected.
  • parseOps doc omitted FORMAT and DECODE from its description of preserved values — corrected.
  • ops struct doc incorrectly stated all non-default flags are pre-parsed to bool; FORMAT and DECODE are stored as strings — corrected.
  • TestPointerDerefLoop "pointer-to-interface" sub-test used errors.New whose concrete pointer type is opaque; replaced with a local ptrReceiverError type that has Error() on *T only, making the pointer-receiver guard explicit and self-documenting.

Copilot AI review requested due to automatic review settings May 14, 2026 01:01
@mkenney
mkenney marked this pull request as ready for review May 14, 2026 01:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 is a v2.1.3 maintenance release focused on documentation, test clarity, and a backwards-compatible rename of the sentinel error variable. It renames Error to ErrorUnableToCast (keeping Error as a deprecated alias), adds doc comments to previously undocumented symbols, fixes several doc inaccuracies, renames example functions from snake_case suffixes to camelCase so godoc surfaces them, and adds new godoc examples.

Changes:

  • Rename sentinel error ErrorErrorUnableToCast (with deprecated alias) and update all test assertions.
  • Documentation fixes/additions across to.go, to.type.go, to.struct.go, to.slice.go, util.reflect.go, including correcting the global/local flag lists (FORMAT/DECODE).
  • Rename example functions and add new godoc examples (map/struct conversions, duplicate-key, strict mode, private fields).

Reviewed changes

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

Show a summary per file
File Description
to.type.go Adds ErrorUnableToCast, deprecated Error alias, doc comments for sentinel/format strings, ops/Tmap/parseOps doc fixes.
to.go Doc grammar fixes for To/ToE.
to.struct.go Doc clarifies *struct source; switches to ErrorUnableToCast.
to.slice.go Rewritten toSlice doc comment.
util.reflect.go Adds dispatch order doc to castToType.
test.examples_test.go Renames examples to camelCase, adds new examples, removes commented-out block.
CHANGELOG.md Adds v2.1.3 entry.
to.*_test.go (many) Mechanical rename of cast.Errorcast.ErrorUnableToCast in assertions and messages, minor gofmt alignment.
test.panic_test.go, test.options_test.go Same rename in tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test.options_test.go Outdated
Copilot AI review requested due to automatic review settings May 14, 2026 01:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread CHANGELOG.md
@mkenney mkenney changed the title v2.1.2: Code quality, documentation, and test improvements v2.1.3: Code quality, documentation, and test improvements May 14, 2026
@mkenney
mkenney merged commit 1e08169 into main May 14, 2026
7 checks passed
@mkenney
mkenney deleted the v2.1.3-dev branch May 14, 2026 01:10
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.

2 participants