Russ Cox | d2cc988 | 2012-02-16 23:50:37 -0500 | [diff] [blame] | 1 | // errorcheck |
Russ Cox | 33f3afa | 2012-01-31 17:29:59 -0500 | [diff] [blame] | 2 | |
| 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 Martin | dc38756 | 2012-02-24 14:48:36 -0500 | [diff] [blame] | 7 | // Verify that invalid imports are rejected by the compiler. |
Rob Pike | 501f0b5 | 2012-02-23 18:47:26 +1100 | [diff] [blame] | 8 | // Does not compile. |
Russ Cox | 33f3afa | 2012-01-31 17:29:59 -0500 | [diff] [blame] | 9 | |
| 10 | package main |
| 11 | |
Anthony Martin | dc38756 | 2012-02-24 14:48:36 -0500 | [diff] [blame] | 12 | // Correct import paths. |
| 13 | import _ "fmt" |
| 14 | import _ `time` |
| 15 | import _ "m\x61th" |
| 16 | import _ "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 Griesemer | 3fd3171 | 2017-02-09 16:00:23 -0800 | [diff] [blame] | 24 | import 42 // ERROR "missing import path; require quoted string" |
| 25 | import 'a' // ERROR "missing import path; require quoted string" |
| 26 | import 3.14 // ERROR "missing import path; require quoted string" |
| 27 | import 0.25i // ERROR "missing import path; require quoted string" |