Skip to content

Commit

Permalink
Clean up godoc comments (#3613)
Browse files Browse the repository at this point in the history
  • Loading branch information
pkwarren authored Jan 31, 2025
1 parent cc52cd6 commit 62416f0
Show file tree
Hide file tree
Showing 48 changed files with 70 additions and 72 deletions.
2 changes: 1 addition & 1 deletion private/buf/bufcli/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ func newPluginDataProvider(
if err != nil {
return nil, err
}
delegateModuleDataProvider := bufpluginapi.NewPluingDataProvider(
delegateModuleDataProvider := bufpluginapi.NewPluginDataProvider(
container.Logger(),
pluginClientProvider,
)
Expand Down
2 changes: 1 addition & 1 deletion private/buf/bufcli/flags_args.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ func BindArchiveStatus(flagSet *pflag.FlagSet, addr *string, flagName string) {
)
}

// Binds a string pointer flag, which indicates flag presence, i.e. `--flag ""` is not the same as not passing the flag.
// BindStringPointer binds a string pointer flag, which indicates flag presence, i.e. `--flag ""` is not the same as not passing the flag.
//
// This is useful for buf registry organization/module update, where we only modify the fields specified.
//
Expand Down
10 changes: 5 additions & 5 deletions private/buf/buffetch/buffetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ var (
//
// This does not include deprecated formats.
SourceOrModuleFormatsString = stringutil.SliceToString(sourceOrModuleFormatsNotDeprecated)
// DirOrProtoFileFormats is the string representation of all dir or proto file formats.
// DirOrProtoFileFormatsString is the string representation of all dir or proto file formats.
//
// This does not include deprecated formats.
DirOrProtoFileFormatsString = stringutil.SliceToString(dirOrProtoFileFormats)
Expand Down Expand Up @@ -146,7 +146,7 @@ type ProtoFileRef interface {
SourceRef
DirOrProtoFileRef
ProtoFilePath() string
// True if the FileScheme is Stdio, Stdout, Stdin, or Null.
// IsDevPath returns true if the FileScheme is Stdio, Stdout, Stdin, or Null.
IsDevPath() bool
IncludePackageFiles() bool
internalProtoFileRef() internal.ProtoFileRef
Expand All @@ -167,7 +167,7 @@ type MessageRefParser interface {
type SourceRefParser interface {
// GetSourceRef gets the reference for the source file.
GetSourceRef(ctx context.Context, value string) (SourceRef, error)
// GetSourceRef gets the reference for the source file.
// GetSourceRefForInputConfig gets the reference for the source file.
GetSourceRefForInputConfig(
ctx context.Context,
inputConfig bufconfig.InputConfig,
Expand Down Expand Up @@ -233,8 +233,8 @@ type RefParser interface {
DirRefParser
SourceOrModuleRefParser

// TODO FUTURE: should this be renamed to GetRefForString?
// GetRef gets the reference for the message file, source bucket, or module.
// TODO FUTURE: should this be renamed to GetRefForString?
GetRef(ctx context.Context, value string) (Ref, error)
// GetRefForInputConfig gets the reference for the message file, source bucket, or module.
GetRefForInputConfig(ctx context.Context, inputConfig bufconfig.InputConfig) (Ref, error)
Expand Down Expand Up @@ -328,7 +328,7 @@ type SourceReader interface {
// GetReadBucketCloserOption is an option for a GetSourceReadBucketCloser call.
type GetReadBucketCloserOption func(*getReadBucketCloserOptions)

// GetReadBucketCloserCopyToInMemory says to copy the returned ReadBucketCloser to an
// GetReadBucketCloserWithCopyToInMemory says to copy the returned ReadBucketCloser to an
// in-memory ReadBucketCloser. This can be a performance optimization at the expense of memory.
func GetReadBucketCloserWithCopyToInMemory() GetReadBucketCloserOption {
return func(getReadBucketCloserOptions *getReadBucketCloserOptions) {
Expand Down
4 changes: 2 additions & 2 deletions private/buf/buffetch/internal/internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ type ProtoFileWriter interface {
) (io.WriteCloser, error)
}

// NewProtoWriter returns a new ProtoWriter.
// NewProtoFileWriter returns a new ProtoFileWriter.
func NewProtoFileWriter(
logger *slog.Logger,
) ProtoFileWriter {
Expand Down Expand Up @@ -820,7 +820,7 @@ func WithGetFileKeepFileCompression() GetFileOption {
// GetReadBucketCloserOption is a GetReadBucketCloser option.
type GetReadBucketCloserOption func(*getReadBucketCloserOptions)

// WithGetBucketCopyToInMemory says to copy the returned ReadBucketCloser to an
// WithGetReadBucketCloserCopyToInMemory says to copy the returned ReadBucketCloser to an
// in-memory ReadBucket. This can be a performance optimization at the expense of memory.
func WithGetReadBucketCloserCopyToInMemory() GetReadBucketCloserOption {
return func(getReadBucketCloserOptions *getReadBucketCloserOptions) {
Expand Down
2 changes: 1 addition & 1 deletion private/buf/buflsp/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func (f *file) Update(ctx context.Context, version int32, text string) {
f.hasText = true
}

// FetchSettings refreshes configuration settings for this file.
// RefreshSettings refreshes configuration settings for this file.
//
// This only needs to happen when the file is open or when the client signals
// that configuration settings have changed.
Expand Down
2 changes: 1 addition & 1 deletion private/buf/buflsp/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func (r *report) Error(err reporter.ErrorWithPos) error {
return nil
}

// Error implements reporter.Handler for *diagnostics.
// Warning implements reporter.Handler for *diagnostics.
func (r *report) Warning(err reporter.ErrorWithPos) {
r.diagnostics = append(r.diagnostics, newDiagnostic(err, true))

Expand Down
7 changes: 3 additions & 4 deletions private/buf/buflsp/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ func (s *server) DidOpen(
return nil
}

// DidOpen is called whenever the client opens a document. This is our signal to parse
// DidChange is called whenever the client opens a document. This is our signal to parse
// the file.
func (s *server) DidChange(
ctx context.Context,
Expand Down Expand Up @@ -320,8 +320,7 @@ func (s *server) Formatting(
}, nil
}

// DidOpen is called whenever the client opens a document. This is our signal to parse
// the file.
// DidClose is called whenever the client closes a document.
func (s *server) DidClose(
ctx context.Context,
params *protocol.DidCloseTextDocumentParams,
Expand All @@ -332,7 +331,7 @@ func (s *server) DidClose(

// -- Language functionality methods.

// Definition is the entry point for hover inlays.
// Hover is the entry point for hover inlays.
func (s *server) Hover(
ctx context.Context,
params *protocol.HoverParams,
Expand Down
2 changes: 1 addition & 1 deletion private/buf/buflsp/symbol.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func (s *symbol) ReferencePath() (path []string, absolute bool) {
return
}

// Resolve attempts to resolve an unresolved reference across fileManager.
// ResolveCrossFile attempts to resolve an unresolved reference across fileManager.
func (s *symbol) ResolveCrossFile(ctx context.Context) {
switch kind := s.kind.(type) {
case *definition:
Expand Down
4 changes: 2 additions & 2 deletions private/buf/bufworkspace/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type WorkspaceModuleKeyOption interface {
applyToWorkspaceModuleKeyConfig(*workspaceModuleKeyConfig)
}

// WorkspaceOption is an option for a new Workspace created by either a Bucket or ModuleKey.
// WorkspaceBucketAndModuleKeyOption is an option for a new Workspace created by either a Bucket or ModuleKey.
type WorkspaceBucketAndModuleKeyOption interface {
WorkspaceBucketOption
WorkspaceModuleKeyOption
Expand Down Expand Up @@ -89,7 +89,7 @@ func WithTargetPaths(targetPaths []string, targetExcludePaths []string) Workspac
// This flag will only work if no buf.work.yaml is detected, and the buf.yaml is a v1beta1
// buf.yaml, v1 buf.yaml, or no buf.yaml. This flag will not work if a buf.work.yaml is
// detected, or a v2 buf.yaml is detected.

//
// If used with NewWorkspaceForModuleKey, this has no effect on the build,
// i.e. excludes are not respected, and the module name is ignored. This matches old behavior.
//
Expand Down
4 changes: 2 additions & 2 deletions private/buf/bufworkspace/workspace_dep_manager_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (

// WorkspaceDepManagerProvider provides WorkspaceDepManagers.
type WorkspaceDepManagerProvider interface {
// GetWorkspaceDepManagerForBucket returns a new WorkspaceDepManager for the given Bucket.
// GetWorkspaceDepManager returns a new WorkspaceDepManager for the given Bucket.
//
// If the workspace is not updateable, an error is returned.
//
Expand All @@ -34,7 +34,7 @@ type WorkspaceDepManagerProvider interface {
//
// Otherwise, this builds a Workspace with a single module at the TargetSubDirPath (which may be "."), ignoring buf.work.yamls.
// Directories with buf.work.yamls cannot be directly targeted.

//
// Note this is the same logic as if WithIgnoreAndDisallowV1BufWorkYAMLs is applied with WorkspaceProvider!! If you want an equivalent
// Workspace, you need to use this option!
//
Expand Down
2 changes: 1 addition & 1 deletion private/buf/cmd/buf/command/beta/internal/internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"pluginrpc.com/pluginrpc"
)

// NewPluginCommand returns a new Command.
// NewCommand returns a new Command.
func NewCommand(
name string,
builder appext.SubCommandBuilder,
Expand Down
2 changes: 1 addition & 1 deletion private/buf/cmd/buf/command/dep/internal/internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
"github.com/bufbuild/buf/private/pkg/syserror"
)

// ModuleKeysAndTransitiveDepModuleKeysForModuleKeys gets the ModuleKeys for the
// ModuleKeysAndTransitiveDepModuleKeysForModuleRefs gets the ModuleKeys for the
// ModuleRefs, and all the transitive dependencies.
func ModuleKeysAndTransitiveDepModuleKeysForModuleRefs(
ctx context.Context,
Expand Down
2 changes: 1 addition & 1 deletion private/bufpkg/bufanalysis/bufanalysis.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ func NewFileAnnotationSet(fileAnnotations ...FileAnnotation) FileAnnotationSet {
return newFileAnnotationSet(fileAnnotations)
}

// PrintFileAnnotations prints the file annotations separated by newlines.
// PrintFileAnnotationSet prints the file annotations separated by newlines.
func PrintFileAnnotationSet(writer io.Writer, fileAnnotationSet FileAnnotationSet, formatString string) error {
format, err := ParseFormat(formatString)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions private/bufpkg/bufcheck/bufcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ type Rule interface {
// BufcheckCategories returns the Rule's Categories.
BufcheckCategories() []Category

// Plugin returns the name of the plugin that created this Rule.
// PluginName returns the name of the plugin that created this Rule.
//
// Names are freeform.
//
Expand All @@ -82,7 +82,7 @@ type Rule interface {
type Category interface {
check.Category

// Plugin returns the name of the plugin that created this Category.
// PluginName returns the name of the plugin that created this Category.
//
// Names are freeform.
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ var (
},
),
}
// FieldSameLabelV1Beta1RuleBuilder is a rule spec builder.
// BreakingFieldSameLabelV1Beta1RuleSpecBuilder is a rule spec builder.
BreakingFieldSameLabelV1Beta1RuleSpecBuilder = &bufcheckserverutil.RuleSpecBuilder{
ID: "FIELD_SAME_LABEL",
Purpose: "Checks that fields have the same labels in a given message.",
Expand Down Expand Up @@ -373,7 +373,7 @@ var (
Type: check.RuleTypeBreaking,
Handler: bufcheckserverhandle.HandleBreakingFileSameJavaGenericServices,
}
// BreakingFileSamePyGenericServicesRuleBuilder is a rule spec builder.
// BreakingFileSamePyGenericServicesRuleSpecBuilder is a rule spec builder.
BreakingFileSamePyGenericServicesRuleSpecBuilder = &bufcheckserverutil.RuleSpecBuilder{
ID: "FILE_SAME_PY_GENERIC_SERVICES",
Purpose: "Checks that files have the same value for the py_generic_services option.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func handleBreakingExtensionNoDelete(
return nil
}

// HandleBreakingFileDelete is a check function.
// HandleBreakingFileNoDelete is a check function.
var HandleBreakingFileNoDelete = bufcheckserverutil.NewRuleHandler(handleBreakingFileNoDelete)

func handleBreakingFileNoDelete(
Expand Down Expand Up @@ -1164,7 +1164,7 @@ func handleBreakingFileSameJavaPackage(
)
}

// HandleBreakingfileSameObjcClassPrefix is a check function.
// HandleBreakingFileSameObjcClassPrefix is a check function.
var HandleBreakingFileSameObjcClassPrefix = bufcheckserverutil.NewBreakingFilePairRuleHandler(handleBreakingFileSameObjcClassPrefix)

func handleBreakingFileSameObjcClassPrefix(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func NewLintDirPathToFilesRuleHandler(
)
}

// NewLintFilesRuleHandler returns a new check.RuleHandler for the given function.
// NewLintFileRuleHandler returns a new check.RuleHandler for the given function.
//
// The function will be called for each File in the request.
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func GetServiceSuffix(options option.Options) (string, error) {
return defaultServiceSuffix, nil
}

// CommentExcludes are lines of comments that should be excluded for the COMMENT.* Rules.
// GetCommentExcludes are lines of comments that should be excluded for the COMMENT.* Rules.
//
// If a comment line starts with one of these excludes, it is not considered an actual comment.
//
Expand Down
2 changes: 1 addition & 1 deletion private/bufpkg/bufconfig/buf_gen_yaml_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func GetBufGenYAMLFileForPrefix(
return getFileForPrefix(ctx, bucket, prefix, bufGenYAMLFileNames, bufGenYAMLFileNameToSupportedFileVersions, readBufGenYAMLFile)
}

// GetBufGenYAMLFileForPrefix gets the buf.gen.yaml file version at the given bucket prefix.
// GetBufGenYAMLFileVersionForPrefix gets the buf.gen.yaml file version at the given bucket prefix.
//
// The buf.gen.yaml file will be attempted to be read at prefix/buf.gen.yaml.
func GetBufGenYAMLFileVersionForPrefix(
Expand Down
2 changes: 1 addition & 1 deletion private/bufpkg/bufconfig/buf_work_yaml_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func GetBufWorkYAMLFileForPrefix(
return getFileForPrefix(ctx, bucket, prefix, bufWorkYAMLFileNames, bufWorkYAMLFileNameToSupportedFileVersions, readBufWorkYAMLFile)
}

// GetBufWorkYAMLFileForPrefix gets the buf.work.yaml file version at the given bucket prefix.
// GetBufWorkYAMLFileVersionForPrefix gets the buf.work.yaml file version at the given bucket prefix.
//
// The buf.work.yaml file will be attempted to be read at prefix/buf.work.yaml.
func GetBufWorkYAMLFileVersionForPrefix(
Expand Down
4 changes: 2 additions & 2 deletions private/bufpkg/bufconfig/buf_yaml_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ func GetBufYAMLFileForOverride(override string) (BufYAMLFile, error) {
return readFile(bytes.NewReader(data), fileName, readBufYAMLFile)
}

// GetBufYAMLFileForOverride get the buf.yaml file for either the usually-flag-based override,
// GetBufYAMLFileForPrefixOrOverride get the buf.yaml file for either the usually-flag-based override,
// or if the override is not set, falls back to the prefix.
func GetBufYAMLFileForPrefixOrOverride(
ctx context.Context,
Expand All @@ -208,7 +208,7 @@ func GetBufYAMLFileForPrefixOrOverride(
return GetBufYAMLFileForPrefix(ctx, bucket, prefix)
}

// GetBufYAMLFileForPrefix gets the buf.yaml file version at the given bucket prefix.
// GetBufYAMLFileVersionForPrefix gets the buf.yaml file version at the given bucket prefix.
//
// The buf.yaml file will be attempted to be read at prefix/buf.yaml.
func GetBufYAMLFileVersionForPrefix(
Expand Down
2 changes: 1 addition & 1 deletion private/bufpkg/bufconfig/check_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func NewEnabledCheckConfig(
)
}

// NewEnabledCheckConfig returns a new enabled CheckConfig for only the use IDs and categories.
// NewEnabledCheckConfigForUseIDsAndCategories returns a new enabled CheckConfig for only the use IDs and categories.
func NewEnabledCheckConfigForUseIDsAndCategories(
fileVersion FileVersion,
use []string,
Expand Down
2 changes: 1 addition & 1 deletion private/bufpkg/bufconfig/file_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
)

const (
// FileVersionV1Beta represents v1beta1 files.
// FileVersionV1Beta1 represents v1beta1 files.
FileVersionV1Beta1 FileVersion = iota + 1
// FileVersionV1 represents v1 files.
FileVersionV1
Expand Down
4 changes: 2 additions & 2 deletions private/bufpkg/bufconfig/generate_managed_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,13 @@ type ManagedOverrideRule interface {
isManagedOverrideRule()
}

// NewFieldOptionOverrideRule returns a new ManagedOverrideRule for a file option.
// NewManagedOverrideRuleForFileOption returns a new ManagedOverrideRule for a file option.
func NewManagedOverrideRuleForFileOption(
path string,
moduleFullName string,
fileOption FileOption,
value interface{},
) (*managedOverrideRule, error) {
) (ManagedOverrideRule, error) {
return newFileOptionManagedOverrideRule(
path,
moduleFullName,
Expand Down
2 changes: 1 addition & 1 deletion private/bufpkg/bufmodule/bufmodulestore/commit_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ type CommitStore interface {
notFoundCommitKeys []bufmodule.CommitKey,
err error,
)
// Put puts the Commits to the store.
// PutCommits puts the Commits to the store.
PutCommits(ctx context.Context, commits []bufmodule.Commit) error
}

Expand Down
6 changes: 3 additions & 3 deletions private/bufpkg/bufmodule/bufmodulestore/module_data_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ type ModuleDatasResult interface {
isModuleDatasResult()
}

// ModuleStore reads and writes ModulesDatas.
// ModuleDataStore reads and writes ModulesDatas.
type ModuleDataStore interface {
// GetModuleDatasForModuleKey gets the ModuleDatas from the store for the ModuleKeys.
// GetModuleDatasForModuleKeys gets the ModuleDatas from the store for the ModuleKeys.
//
// Returns the found ModuleDatas, and the input ModuleKeys that were not found, each
// ordered by the order of the input ModuleKeys.
Expand All @@ -69,7 +69,7 @@ type ModuleDataStore interface {
err error,
)

// Put puts the ModuleDatas to the store.
// PutModuleDatas puts the ModuleDatas to the store.
PutModuleDatas(ctx context.Context, moduleDatas []bufmodule.ModuleData) error
}

Expand Down
2 changes: 1 addition & 1 deletion private/bufpkg/bufmodule/file_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func ParseFileType(s string) (FileType, error) {
return c, nil
}

// FileType returns the FileType for the given path.
// FileTypeForPath returns the FileType for the given path.
//
// Returns error if the path cannot be classified as a FileType, that is if it is not a
// .proto file, license file, or documentation file.
Expand Down
3 changes: 1 addition & 2 deletions private/bufpkg/bufmodule/module_set_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ type ModuleSetBuilder interface {
//
// Remote modules are rarely targets. However, if we are reading a ModuleSet from a
// ModuleProvider for example with a buf build buf.build/foo/bar call, then this

// specific Module will be targeted, while its dependencies will not be.
//
// Returns the same ModuleSetBuilder.
Expand Down Expand Up @@ -168,7 +167,7 @@ func LocalModuleWithFullName(moduleFullName bufparse.FullName) LocalModuleOption
}
}

// LocalModuleWithFullName returns a new LocalModuleOption that adds the given FullName and CommitID
// LocalModuleWithFullNameAndCommitID returns a new LocalModuleOption that adds the given FullName and CommitID
// to the result Module.
func LocalModuleWithFullNameAndCommitID(moduleFullName bufparse.FullName, commitID uuid.UUID) LocalModuleOption {
return func(localModuleOptions *localModuleOptions) {
Expand Down
Loading

0 comments on commit 62416f0

Please sign in to comment.