From 6a85a6c4f36e11335d3e0c9f957c21578cf1ca3e Mon Sep 17 00:00:00 2001 From: Doria Keung Date: Wed, 4 Dec 2024 17:27:50 -0500 Subject: [PATCH] Fix shared module read bucket for proto file refs and include_package_files --- private/bufpkg/bufmodule/module_read_bucket.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/private/bufpkg/bufmodule/module_read_bucket.go b/private/bufpkg/bufmodule/module_read_bucket.go index 1001dad78c..2e933884f8 100644 --- a/private/bufpkg/bufmodule/module_read_bucket.go +++ b/private/bufpkg/bufmodule/module_read_bucket.go @@ -543,6 +543,12 @@ func (b *moduleReadBucket) getIsTargetFileForPathUncached(ctx context.Context, p // We've now deferred having to get fastscan.Results as much as we can. protoFileTargetFastscanResult, err := b.getFastscanResultForPath(ctx, b.protoFileTargetPath) if err != nil { + // In the case where multiple modules may have shared module roots through the includes key + // in the module configs, the protoFileTargetPath may not exist in the target module. + // In that case, we just return false. + if errors.Is(err, fs.ErrNotExist) { + return false, nil + } return false, err } if protoFileTargetFastscanResult.PackageName == "" {