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

Function BuildImage

private/bufpkg/bufimage/bufimage.go:272–289  ·  view source on GitHub ↗

BuildImage runs compilation. An error of type FileAnnotationSet may be returned. It is up to the caller to parse this if needed. FileAnnotations will use external file paths. The given ModuleReadBucket must be self-contained. A ModuleReadBucket is self-contained if it was constructed from ModuleS

(
	ctx context.Context,
	logger *slog.Logger,
	moduleReadBucket bufmodule.ModuleReadBucket,
	options ...BuildImageOption,
)

Source from the content-addressed store, hash-verified

270// The image will contain only files targeted by the input moduleReadBucket,
271// those returned by [bufmodule.GetTargetFileInfos].
272func BuildImage(
273 ctx context.Context,
274 logger *slog.Logger,
275 moduleReadBucket bufmodule.ModuleReadBucket,
276 options ...BuildImageOption,
277) (Image, error) {
278 buildImageOptions := newBuildImageOptions()
279 for _, option := range options {
280 option(buildImageOptions)
281 }
282 return buildImage(
283 ctx,
284 logger,
285 moduleReadBucket,
286 buildImageOptions.excludeSourceCodeInfo,
287 buildImageOptions.noParallelism,
288 )
289}
290
291// BuildImageOption is an option for BuildImage.
292type BuildImageOption func(*buildImageOptions)

Callers 15

wellKnownTypeImageFunction · 0.92
runFunction · 0.92
testBreakingFunction · 0.92
testLintWithOptionsFunction · 0.92
TestNewFilesFunction · 0.92
TestOptionPanicFunction · 0.92
TestModuleTargetFilesFunction · 0.92
testBuildFunction · 0.92
BenchmarkBuildImageFunction · 0.92
TestOptionImportsFunction · 0.92
TestTransitivePublicFunction · 0.92
TestTypesFromMainModuleFunction · 0.92

Calls 3

newBuildImageOptionsFunction · 0.85
optionStruct · 0.85
buildImageFunction · 0.70

Tested by 14

testBreakingFunction · 0.74
testLintWithOptionsFunction · 0.74
TestNewFilesFunction · 0.74
TestOptionPanicFunction · 0.74
TestModuleTargetFilesFunction · 0.74
testBuildFunction · 0.74
BenchmarkBuildImageFunction · 0.74
TestOptionImportsFunction · 0.74
TestTransitivePublicFunction · 0.74
TestTypesFromMainModuleFunction · 0.74
getImageFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…