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

Function orderImageFilesRec

private/bufpkg/bufimage/image.go:135–158  ·  view source on GitHub ↗
(
	inputImageFile ImageFile,
	outputImageFiles []ImageFile,
	pathToImageFile map[string]ImageFile,
	alreadySeen map[string]struct{},
)

Source from the content-addressed store, hash-verified

133}
134
135func orderImageFilesRec(
136 inputImageFile ImageFile,
137 outputImageFiles []ImageFile,
138 pathToImageFile map[string]ImageFile,
139 alreadySeen map[string]struct{},
140) []ImageFile {
141 path := inputImageFile.Path()
142 if _, ok := alreadySeen[path]; ok {
143 return outputImageFiles
144 }
145 alreadySeen[path] = struct{}{}
146 for _, dependency := range inputImageFile.FileDescriptorProto().GetDependency() {
147 dependencyImageFile, ok := pathToImageFile[dependency]
148 if ok {
149 outputImageFiles = orderImageFilesRec(
150 dependencyImageFile,
151 outputImageFiles,
152 pathToImageFile,
153 alreadySeen,
154 )
155 }
156 }
157 return append(outputImageFiles, inputImageFile)
158}

Callers 1

orderImageFilesFunction · 0.85

Calls 3

PathMethod · 0.65
GetDependencyMethod · 0.65
FileDescriptorProtoMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…