Skip to content

Fix package example names for current Go#34

Open
HNO3Miracle wants to merge 1 commit into
HumanSecurity:mainfrom
HNO3Miracle:fix-example-names-current-go
Open

Fix package example names for current Go#34
HNO3Miracle wants to merge 1 commit into
HumanSecurity:mainfrom
HNO3Miracle:fix-example-names-current-go

Conversation

@HNO3Miracle

Copy link
Copy Markdown

Current Go rejects several examples because their names are interpreted as examples for identifiers that do not exist in this package:

  • ExampleBasicUnmarshal -> BasicUnmarshal
  • ExampleExcludeKnownFields -> ExcludeKnownFields
  • ExampleUnmarshalErrorHandling -> UnmarshalErrorHandling
  • ExampleUnmarshalFromJSONMapErrorHandling -> UnmarshalFromJSONMapErrorHandling

These are package-level examples, so this renames them to the documented package-example form using a lowercase suffix after an underscore. This keeps the examples visible and executable without introducing fake exported identifiers.

This came up while packaging marshmallow for openRuyi with the current Go toolchain.

Validation:

  • go test ./...

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