From 880dba286ee80dc5e3ac5b0ade6d1c74e64e7bc9 Mon Sep 17 00:00:00 2001 From: John Howard Date: Wed, 21 Sep 2022 10:49:21 -0700 Subject: [PATCH] Always add `testing` package usage in native_go_fuzzer (#8546) This fixes an issue where the `testing.F` is replaced with a new package; if this was the only usage of `testing` in the file then we end up with `testing` being an unused import. A workaround for this is to just always use `testing` via some placeholder variable. --- infra/base-images/base-builder/compile_native_go_fuzzer | 1 + 1 file changed, 1 insertion(+) diff --git a/infra/base-images/base-builder/compile_native_go_fuzzer b/infra/base-images/base-builder/compile_native_go_fuzzer index 369a71579..a7c58a619 100755 --- a/infra/base-images/base-builder/compile_native_go_fuzzer +++ b/infra/base-images/base-builder/compile_native_go_fuzzer @@ -33,6 +33,7 @@ function rewrite_go_fuzz_harness() { # Import https://github.com/AdamKorcz/go-118-fuzz-build. # This changes the line numbers from the original fuzzer. addimport -path "${fuzzer_fn}" + echo -e "\nvar _ = testing.Verbose // Ensure testing import remains\n" >> "${fuzzer_fn}" } function build_native_go_fuzzer() {