blob: d9673cfe9f8eb2b948397a3b4dbbeb1d7b196eeb [file] [log] [blame]
Russ Coxd2cc9882012-02-16 23:50:37 -05001// errorcheck
Russ Cox33f3afa2012-01-31 17:29:59 -05002
3// Copyright 2009 The Go Authors. All rights reserved.
4// Use of this source code is governed by a BSD-style
5// license that can be found in the LICENSE file.
6
Anthony Martindc387562012-02-24 14:48:36 -05007// Verify that invalid imports are rejected by the compiler.
Rob Pike501f0b52012-02-23 18:47:26 +11008// Does not compile.
Russ Cox33f3afa2012-01-31 17:29:59 -05009
10package main
11
Anthony Martindc387562012-02-24 14:48:36 -050012// Correct import paths.
13import _ "fmt"
14import _ `time`
15import _ "m\x61th"
16import _ "go/parser"
17
18// Correct import paths, but the packages don't exist.
19// Don't test.
20//import "a.b"
21//import "greek/αβ"
22
23// Import paths must be strings.
Robert Griesemer3fd31712017-02-09 16:00:23 -080024import 42 // ERROR "missing import path; require quoted string"
25import 'a' // ERROR "missing import path; require quoted string"
26import 3.14 // ERROR "missing import path; require quoted string"
27import 0.25i // ERROR "missing import path; require quoted string"