Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export test-specific functions without go:linkname #657

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

adombeck
Copy link
Contributor

@adombeck adombeck commented Nov 27, 2024

Using go:linkname is poorly supported by tooling, for example it breaks code navigation because IDEs don't support going to the function's implementation.

To still make it clear that those functions are only for use in tests, and to group test-specific functions together in code completion lists, we are now prefixing them with "Z_ForTests". The "Z_" should ensure that they are listed at the end (although that doesn't work for Intellij unfortunately).

UDENG-5449

I was surprised that "DumpToYaml" modifies some values in the returned
YAML. The new name should be less surprising.

It also contains the acronym YAML in uppercase, as recommended by the Go
Code Review Comments: https://go.dev/wiki/CodeReviewComments#initialisms

Also improves the doc comment of the function.
Using go:linkname is poorly supported by tooling, for example it breaks
code navigation because IDEs don't support going to the function's
implementation.

To still make it clear that those functions are only for use in tests,
and to group test-specific functions together in code completion lists,
we are now prefixing them with "Z_ForTests". The "Z_" should ensure that
they are listed at the end (although that doesn't work for Intellij
unfortunately).
@adombeck
Copy link
Contributor Author

Blocked by #641

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