github.com/songshiyun/revive@v1.1.5-0.20220323112655-f8433a19b3c5/testdata/golint/exported.go (about)

     1  // Package golint comment
     2  package golint
     3  
     4  import "net/http"
     5  
     6  //  GolintFoo is a dummy function
     7  func GolintFoo() {} // MATCH /func name will be used as golint.GolintFoo by other packages, and that stutters; consider calling this Foo/
     8  
     9  type (
    10  	// O is a shortcut (alias) for map[string]interface{}, e.g. a JSON object.
    11  	O = map[string]interface{}
    12  
    13  	// A is shortcut for []O.
    14  	A = []O
    15  
    16  	// This Person type is simple
    17  	Person = map[string]interface{}
    18  )
    19  
    20  type Foo struct{} // MATCH /exported type Foo should have comment or be unexported/
    21  
    22  // The following cases are no-regression tests for issue 229
    23  
    24  /* Bar something */
    25  type Bar struct{}
    26  
    27  /* Toto something */
    28  func Toto() {}
    29  
    30  /* FirstLetter something */
    31  const FirstLetter = "A"
    32  
    33  /*Bar2 something */
    34  type Bar2 struct{}
    35  
    36  /*Toto2 something */
    37  func Toto2() {}
    38  
    39  /*SecondLetter something */
    40  const SecondLetter = "B"
    41  
    42  // Tests for common method names
    43  //// Should NOT fail for methods
    44  func (_) Error() string                                    { return "" }
    45  func (_) String() string                                   { return "" }
    46  func (_) ServeHTTP(w http.ResponseWriter, r *http.Request) {}
    47  func (_) Read(p []byte) (n int, err error)                 { return 0, nil }
    48  func (_) Write(p []byte) (n int, err error)                { return 0, nil }
    49  func (_) Unwrap(err error) error                           { return nil }
    50  
    51  //// Should fail for functions
    52  
    53  func Error() string                                    { return "" }     // MATCH /exported function Error should have comment or be unexported/
    54  func String() string                                   { return "" }     // MATCH /exported function String should have comment or be unexported/
    55  func ServeHTTP(w http.ResponseWriter, r *http.Request) {}                // MATCH /exported function ServeHTTP should have comment or be unexported/
    56  func Read(p []byte) (n int, err error)                 { return 0, nil } // MATCH /exported function Read should have comment or be unexported/
    57  func Write(p []byte) (n int, err error)                { return 0, nil } // MATCH /exported function Write should have comment or be unexported/
    58  func Unwrap(err error) error                           { return nil }    // MATCH /exported function Unwrap should have comment or be unexported/
    59  
    60  // The following cases are tests for issue 555