From 16cfa40e46a4e2fe43961f50d905e55225c91b63 Mon Sep 17 00:00:00 2001 From: bufdev Date: Thu, 18 Jul 2024 22:11:25 +0200 Subject: [PATCH] Add comments to addFuncs --- .../internal/bufbreakingcheck/util.go | 16 ++++++++++++++-- .../buflint/internal/buflintcheck/util.go | 8 +++++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/private/bufpkg/bufcheck/bufbreaking/internal/bufbreakingcheck/util.go b/private/bufpkg/bufcheck/bufbreaking/internal/bufbreakingcheck/util.go index c92cd81b93..14441e643f 100644 --- a/private/bufpkg/bufcheck/bufbreaking/internal/bufbreakingcheck/util.go +++ b/private/bufpkg/bufcheck/bufbreaking/internal/bufbreakingcheck/util.go @@ -91,8 +91,20 @@ var ( // addFunc adds a FileAnnotation. // -// Both the Descriptor and Location can be nil. -type addFunc func(bufprotosource.Descriptor, []bufprotosource.Descriptor, bufprotosource.Location, string, ...interface{}) +// descriptor is what the FileAnnotation applies to. +// extraIgnoreDescriptors are extra descriptors to check for ignores. This is used in situations +// where the file we care about has been deleted, and we want to use the previous file to check +// for things like config ignores or unstable packages. +// location is the granular Location of the FileAnnotation. +// +// descriptor, extraIgnoreDescriptors, and location can be nil. +type addFunc func( + descriptor bufprotosource.Descriptor, + extraIgnoreDescriptors []bufprotosource.Descriptor, + location bufprotosource.Location, + format string, + args ...interface{}, +) // corpus is a store of the previous files and files given to a check function. // diff --git a/private/bufpkg/bufcheck/buflint/internal/buflintcheck/util.go b/private/bufpkg/bufcheck/buflint/internal/buflintcheck/util.go index 5c285a667a..3c5814c4a1 100644 --- a/private/bufpkg/bufcheck/buflint/internal/buflintcheck/util.go +++ b/private/bufpkg/bufcheck/buflint/internal/buflintcheck/util.go @@ -32,7 +32,13 @@ import ( // location != descriptor.Location(). // // descriptor, location, and extraIgnoreLocations can be nil. -type addFunc func(descriptior bufprotosource.Descriptor, location bufprotosource.Location, extraIgnoreLocations []bufprotosource.Location, message string, args ...interface{}) +type addFunc func( + descriptior bufprotosource.Descriptor, + location bufprotosource.Location, + extraIgnoreLocations []bufprotosource.Location, + format string, + args ...interface{}, +) func fieldToLowerSnakeCase(s string) string { // Try running this on googleapis and watch