From a67df5ef3a7d9277fd8d3b46c6f8477731db63fd Mon Sep 17 00:00:00 2001 From: Tom Dyas Date: Fri, 5 Nov 2021 22:39:40 -0400 Subject: [PATCH] go: pass -complete flag to compiler [ci skip-rust] [ci skip-build-wheels] --- src/python/pants/backend/go/util_rules/build_pkg.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/python/pants/backend/go/util_rules/build_pkg.py b/src/python/pants/backend/go/util_rules/build_pkg.py index 9839ce5d904..dd0e4ba9b4a 100644 --- a/src/python/pants/backend/go/util_rules/build_pkg.py +++ b/src/python/pants/backend/go/util_rules/build_pkg.py @@ -234,6 +234,10 @@ async def build_go_package(request: BuildGoPackageRequest) -> FallibleBuiltGoPac if symabis_path: compile_args.extend(["-symabis", symabis_path]) + if not request.s_file_names: + # If there are no non-Go sources, then pass -complete flag which tells the compiler that the provided + # Go files are the entire package. + compile_args.append("-complete") relativized_sources = ( f"./{request.subpath}/{name}" if request.subpath else f"./{name}" for name in request.go_file_names