Repository navigation
Conversation
TestTablesCoverAPI walks docs/api.txt, the generated list of the package's API, and fails when an exported function or method takes a field pointer, or a relation pointer, and is in none of the tables. An API added without an entry is caught here rather than at run time, where only the call that misses a probe reports ErrNotProbe, and only if it is reached. Names are matched by receiver, so a Query and a Join method are told apart from the function of the same name. Methods of a receiver antvet does not follow are left out: a ModelBuilder's are judged by the key and relation rules where Configure is read, and an Expr or Window names no model a call could disagree with. The few functions that take a pointer unjudged are listed in the test. A function in aggregates is still held to its fieldFuncs entry: the aggregate path reads its field from where fieldFuncs puts it, so a missing entry there loses the check even though the function is known.
lx3133584
force-pushed
the
test/antvet-api-table-guard
branch
from
December 1, 2026 01:21
cb568a5 to
b43f45b
Compare
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.
Fixes #102, or rather the part of it left: the table entries are in since #291, so what remains is the guard from the fix idea, and a test now holds an API to a table entry instead of leaving it to a call that fails at run time.
TestTablesCoverAPIwalksdocs/api.txt, the generated list of the package's API, and fails when an exported function or method takes a field pointer (*V ...*V) or a relation pointer (*[]R,*[]T,**R,**T,**C) and is in no table. Names are told apart by receiver, soQuery.Latestis not taken for a functionLatest. A function whose entry infieldFuncsgoes missing still fails even though the analyzer knows it fromaggregates, because the aggregate path reads the field from wherefieldFuncsputs it.Methods of receivers antvet does not follow are left out: a
ModelBuilder's are judged by the key and relation rules where a model'sConfigureis read, and anExprorWindownames no model a call could disagree with. The few functions that take a pointer on purpose without being judged (Coalesce,Lag,DatePartand the like) are listed in the test, so a new one still has to be seen.Removing
Latest,Oldest,LoadorRecursiveOnefrom the tables, or an entry fromfieldFuncs, fails the test; adding them back passes it.go vet ./...andgo test ./...pass undertools/antvet.