import.golden 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. // package comment
  2. package main
  3. import (
  4. "errors"
  5. "fmt"
  6. "io"
  7. "log"
  8. "math"
  9. )
  10. import (
  11. "fmt"
  12. "math"
  13. "log"
  14. "errors"
  15. "io"
  16. )
  17. // We reset the line numbering to test that
  18. // the formatting works independent of line directives
  19. //line :19
  20. import (
  21. "errors"
  22. "fmt"
  23. "io"
  24. "log"
  25. "math"
  26. "fmt"
  27. "math"
  28. "log"
  29. "errors"
  30. "io"
  31. )
  32. import (
  33. // a block with comments
  34. "errors"
  35. "fmt" // for Printf
  36. "io" // for Reader
  37. "log" // for Fatal
  38. "math"
  39. )
  40. import (
  41. "fmt" // for Printf
  42. "math"
  43. "log" // for Fatal
  44. "errors"
  45. "io" // for Reader
  46. )
  47. import (
  48. // for Printf
  49. "fmt"
  50. "math"
  51. // for Fatal
  52. "log"
  53. "errors"
  54. // for Reader
  55. "io"
  56. )
  57. import (
  58. "errors"
  59. "fmt" // for Printf
  60. "io" // for Reader
  61. "log" // for Fatal
  62. "math"
  63. "fmt" // for Printf
  64. "math"
  65. "log" // for Fatal
  66. "errors"
  67. "io" // for Reader
  68. )
  69. import (
  70. "fmt" // for Printf
  71. "errors"
  72. "io" // for Reader
  73. "log" // for Fatal
  74. "math"
  75. "errors"
  76. "fmt" // for Printf
  77. "io" // for Reader
  78. "log" // for Fatal
  79. "math"
  80. )
  81. // Test deduping and extended sorting
  82. import (
  83. a "A" // aA
  84. b "A" // bA1
  85. b "A" // bA2
  86. "B" // B
  87. . "B" // .B
  88. _ "B" // _b
  89. "C"
  90. a "D" // aD
  91. )
  92. import (
  93. "dedup_by_group"
  94. "dedup_by_group"
  95. )
  96. import (
  97. "fmt" // for Printf
  98. /* comment */ io1 "io"
  99. /* comment */ io2 "io"
  100. /* comment */ "log"
  101. )
  102. import (
  103. "fmt"
  104. /* comment */ io1 "io"
  105. /* comment */ io2 "io" // hello
  106. "math" /* right side */
  107. // end
  108. )
  109. import (
  110. "errors" // for New
  111. "fmt"
  112. /* comment */ io1 "io" /* before */ // after
  113. io2 "io" // another
  114. // end
  115. )
  116. import (
  117. "errors" // for New
  118. /* left */ "fmt" /* right */
  119. "log" // for Fatal
  120. /* left */ "math" /* right */
  121. )
  122. import /* why */ /* comment here? */ (
  123. /* comment */ "fmt"
  124. "math"
  125. )
  126. // Reset it again
  127. //line :100
  128. // Dedup with different import styles
  129. import (
  130. "path"
  131. . "path"
  132. _ "path"
  133. pathpkg "path"
  134. )
  135. /* comment */
  136. import (
  137. "fmt"
  138. "math" // for Abs
  139. // This is a new run
  140. "errors"
  141. "fmt"
  142. )
  143. // End an import declaration in the same line
  144. // as the last import. See golang.org/issue/33538.
  145. // Note: Must be the last (or 2nd last) line of the file.
  146. import (
  147. "fmt"
  148. "math"
  149. )