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