From 990c14cec8c92ee644516d5a7c8a94900549253b Mon Sep 17 00:00:00 2001 From: Shengyu Zhang Date: Fri, 17 Dec 2021 11:41:36 +0800 Subject: [PATCH] cmd/go: add tests for loading invalid import path --- .../testdata/script/load_invalid_import_path.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/cmd/go/testdata/script/load_invalid_import_path.txt diff --git a/src/cmd/go/testdata/script/load_invalid_import_path.txt b/src/cmd/go/testdata/script/load_invalid_import_path.txt new file mode 100644 index 00000000000..6143134dae1 --- /dev/null +++ b/src/cmd/go/testdata/script/load_invalid_import_path.txt @@ -0,0 +1,14 @@ +# Tests issue 49137. The following commands should not panic any way. + +! go list '"a"' +stderr 'malformed import path "\\"a\\"": invalid char ''"''' + +! go build '' -ldflags='-X "main.Tags="' +stderr 'malformed import path "-ldflags=-X \\"main.Tags=\\"": leading dash' + +-- go.mod -- +module m + +go 1.16 +-- main.go -- +package main