github.com/gagliardetto/golang-go@v0.0.0-20201020153340-53909ea70814/cmd/gofmt/testdata/import.golden (about)

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