docs: fix typos in testdata (#4116)

This commit is contained in:
Oleksandr Redko 2023-10-06 17:14:23 +03:00 committed by GitHub
parent be034aa9af
commit fe268f4ee9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 10 deletions

View File

@ -10,6 +10,6 @@ import (
func Forbidigo() {
fmt.Printf("too noisy!!!") // want "use of `fmt\\.Printf` forbidden by pattern `fmt\\\\.Print\\.\\*`"
fmt2.Printf("too noisy!!!") // Not detected because analyze-types is false by default for backward compatbility.
fmt2.Printf("too noisy!!!") // Not detected because analyze-types is false by default for backward compatibility.
time.Sleep(time.Nanosecond) // want "no sleeping!"
}

View File

@ -8,7 +8,7 @@ import (
)
var noGlobalsVar int // want "noGlobalsVar is a global variable"
var ErrSomeType = errors.New("test that global erorrs aren't warned")
var ErrSomeType = errors.New("test that global errors aren't warned")
var (
OnlyDigites = regexp.MustCompile(`^\d+$`)

View File

@ -56,21 +56,21 @@ var (
)
// this should not match as the implementation does not need named parameters (see below)
type funcDefintion func(arg1, arg2 interface{}) (num int, err error)
type funcDefinition func(arg1, arg2 interface{}) (num int, err error)
func funcDefintionImpl(arg1, arg2 interface{}) (int, error) {
func funcDefinitionImpl(arg1, arg2 interface{}) (int, error) {
return 0, nil
}
func funcDefintionImpl2(arg1, arg2 interface{}) (num int, err error) { // want `named return "num" with type "int" found`
func funcDefinitionImpl2(arg1, arg2 interface{}) (num int, err error) { // want `named return "num" with type "int" found`
return 0, nil
}
func funcDefintionImpl3(arg1, arg2 interface{}) (num int, _ error) { // want `named return "num" with type "int" found`
func funcDefinitionImpl3(arg1, arg2 interface{}) (num int, _ error) { // want `named return "num" with type "int" found`
return 0, nil
}
func funcDefintionImpl4(arg1, arg2 interface{}) (_ int, _ error) {
func funcDefinitionImpl4(arg1, arg2 interface{}) (_ int, _ error) {
return 0, nil
}
@ -88,12 +88,12 @@ func test() {
a := funcVar()
_ = a
var function funcDefintion
function = funcDefintionImpl
var function funcDefinition
function = funcDefinitionImpl
i, err := function("", "")
_ = i
_ = err
function = funcDefintionImpl2
function = funcDefinitionImpl2
i, err = function("", "")
_ = i
_ = err