github.com/azazeal/revive@v1.0.9/testdata/golint/blank-import-lib.go (about)

     1  // Test that blank imports in library packages are flagged.
     2  
     3  // Package foo ...
     4  package foo
     5  
     6  // The instructions need to go before the imports below so they will not be
     7  // mistaken for documentation.
     8  
     9  import _ "encoding/json"
    10  
    11  /* MATCH:9 /a blank import should be only in a main or test package, or have a comment justifying it/ */
    12  
    13  import (
    14  	"fmt"
    15  
    16  	_ "os"
    17  	/* MATCH:16 /a blank import should be only in a main or test package, or have a comment justifying it/ */
    18  
    19  	_ "net/http"
    20  	/* MATCH:19 /a blank import should be only in a main or test package, or have a comment justifying it/ */
    21  	_ "path"
    22  )
    23  
    24  import _ "encoding/base64" // Don't gripe about this
    25  
    26  import (
    27  	// Don't gripe about these next two lines.
    28  	_ "compress/zlib"
    29  
    30  	_ "syscall"
    31  	/* MATCH:30 /a blank import should be only in a main or test package, or have a comment justifying it/ */
    32  	_ "path/filepath"
    33  )
    34  
    35  import (
    36  	"go/ast"
    37  	_ "go/scanner" // Don't gripe about this or the following line.
    38  	_ "go/token"
    39  )
    40  
    41  import (
    42  	_ "embed"
    43  	/* MATCH:42 /a blank import should be only in a main or test package, or have a comment justifying it/ */
    44  )
    45  
    46  var (
    47  	_ fmt.Stringer // for "fmt"
    48  	_ ast.Node     // for "go/ast"
    49  )