3 //go:build !js && !wasip1 && gc
5 // Copyright 2017 The Go Authors. All rights reserved.
6 // Use of this source code is governed by a BSD-style
7 // license that can be found in the LICENSE file.
9 // As of "Mon 6 Nov 2017", run.go doesn't yet have proper
10 // column matching so instead match the output manually
25 f, err := ioutil.TempFile("", "issue21317.go")
35 n, err := fmt.Println(1)
39 defer os.RemoveAll(f.Name())
41 // compile and test output
42 cmd := exec.Command("go", "tool", "compile", "-p=main", "-importcfg="+os.Getenv("STDLIB_IMPORTCFG"), f.Name())
43 out, err := cmd.CombinedOutput()
45 log.Fatalf("expected cmd/compile to fail")
48 "7:9: n declared and not used",
49 "7:12: err declared and not used",
52 for _, want := range wantErrs {
53 if !strings.Contains(outStr, want) {
54 log.Fatalf("failed to match %q\noutput: %q", want, outStr)