1
0
mirror of https://github.com/mgechev/revive.git synced 2025-02-07 13:31:42 +02:00

add tests on common methods handling (#548)

This commit is contained in:
SalvadorC 2021-07-28 16:59:55 +02:00 committed by GitHub
parent 7dde483bac
commit 98c374dcad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,8 @@
// Package golint comment
package golint
import "net/http"
type (
// O is a shortcut (alias) for map[string]interface{}, e.g. a JSON object.
O = map[string]interface{}
@ -33,3 +35,21 @@ func Toto2() {}
/*SecondLetter something */
const SecondLetter = "B"
// Tests for common method names
//// Should NOT fail for methods
func (_) Error() string { return "" }
func (_) String() string { return "" }
func (_) ServeHTTP(w http.ResponseWriter, r *http.Request) {}
func (_) Read(p []byte) (n int, err error) { return 0, nil }
func (_) Write(p []byte) (n int, err error) { return 0, nil }
func (_) Unwrap(err error) error { return nil }
//// Should fail for functions
func Error() string { return "" } // MATCH /exported function Error should have comment or be unexported/
func String() string { return "" } // MATCH /exported function String should have comment or be unexported/
func ServeHTTP(w http.ResponseWriter, r *http.Request) {} // MATCH /exported function ServeHTTP should have comment or be unexported/
func Read(p []byte) (n int, err error) { return 0, nil } // MATCH /exported function Read should have comment or be unexported/
func Write(p []byte) (n int, err error) { return 0, nil } // MATCH /exported function Write should have comment or be unexported/
func Unwrap(err error) error { return nil } // MATCH /exported function Unwrap should have comment or be unexported/