MCPcopy Create free account
hub / github.com/bufbuild/buf / trackFileInfo

Method trackFileInfo

private/bufpkg/bufmodule/proto_file_tracker.go:59–73  ·  view source on GitHub ↗

trackFileInfo says to track the FileInfo to mark its associated Module as having .proto files if the FileInfo represents a .proto file, and to mark its path as having the associated Module's opaqueID.

(fileInfo FileInfo)

Source from the content-addressed store, hash-verified

57// if the FileInfo represents a .proto file, and to mark its path as having the associated Module's
58// opaqueID.
59func (t *protoFileTracker) trackFileInfo(fileInfo FileInfo) {
60 if fileInfo.FileType() != FileTypeProto {
61 return
62 }
63 module := fileInfo.Module()
64 opaqueID := module.OpaqueID()
65 t.opaqueIDToProtoFileExists[opaqueID] = true
66 protoPathOpaqueIDMap, ok := t.protoPathToOpaqueIDMap[fileInfo.Path()]
67 if !ok {
68 protoPathOpaqueIDMap = make(map[string]struct{})
69 t.protoPathToOpaqueIDMap[fileInfo.Path()] = protoPathOpaqueIDMap
70 }
71 protoPathOpaqueIDMap[opaqueID] = struct{}{}
72 t.opaqueIDToDescription[opaqueID] = module.Description()
73}
74
75// validate validates. This should be called when all tracking is complete.
76func (t *protoFileTracker) validate() error {

Callers 4

WalkFileInfosMethod · 0.80
WalkFileInfosMethod · 0.80
getModuleDepsRecFunction · 0.80

Calls 5

FileTypeMethod · 0.65
ModuleMethod · 0.65
OpaqueIDMethod · 0.65
PathMethod · 0.65
DescriptionMethod · 0.65

Tested by

no test coverage detected