reject_unused_import.mx raw

   1  // expected: "math" imported and not used
   2  //
   3  // Go requires an imported package to be referred to in the file that imports
   4  // it: a package imported for its side effects only needs the blank identifier.
   5  // go/types rejects this on the legacy side; stage4 linked the import and said
   6  // nothing, so a file could import a package it never mentioned and only the
   7  // legacy compiler would object.
   8  //
   9  // The rule is per file, not per package - another file importing "math" and
  10  // using it does not excuse this one - and the message names the alias when the
  11  // import has one ("math" imported as m and not used).
  12  package main
  13  
  14  import "math"
  15  
  16  func main() {
  17  	println(int32(1))
  18  }
  19