Source file test/import5.go

     1  // errorcheck
     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  
     7  // Verify that invalid imports are rejected by the compiler.
     8  // Does not compile.
     9  
    10  package main
    11  
    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.
    24  import 42    // ERROR "import path must be a string"
    25  import 'a'   // ERROR "import path must be a string"
    26  import 3.14  // ERROR "import path must be a string"
    27  import 0.25i // ERROR "import path must be a string"
    28  

View as plain text