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

Function ImageFileWithIsImport

private/bufpkg/bufimage/bufimage.go:211–226  ·  view source on GitHub ↗

ImageFileWithIsImport returns a copy of the ImageFile with the new ImageFile now marked as an import. If the original ImageFile was already an import, this returns the original ImageFile.

(imageFile ImageFile, isImport bool)

Source from the content-addressed store, hash-verified

209// If the original ImageFile was already an import, this returns
210// the original ImageFile.
211func ImageFileWithIsImport(imageFile ImageFile, isImport bool) ImageFile {
212 if imageFile.IsImport() == isImport {
213 return imageFile
214 }
215 // No need to validate as ImageFile is already validated.
216 return newImageFileNoValidate(
217 imageFile.FileDescriptorProto(),
218 imageFile.FullName(),
219 imageFile.CommitID(),
220 imageFile.ExternalPath(),
221 imageFile.LocalPath(),
222 isImport,
223 imageFile.IsSyntaxUnspecified(),
224 imageFile.UnusedDependencyIndexes(),
225 )
226}
227
228// Image is a buf image.
229type Image interface {

Callers 2

addFileWithImportsFunction · 0.85

Calls 9

newImageFileNoValidateFunction · 0.85
IsImportMethod · 0.65
FileDescriptorProtoMethod · 0.65
FullNameMethod · 0.65
CommitIDMethod · 0.65
ExternalPathMethod · 0.65
LocalPathMethod · 0.65
IsSyntaxUnspecifiedMethod · 0.65

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…