1
0
mirror of https://github.com/mgechev/revive.git synced 2025-11-25 22:12:38 +02:00
Files
revive/testdata/import_shadowing.go

46 lines
1018 B
Go
Raw Normal View History

package fixtures
import (
"bytes"
2025-05-26 13:54:46 +03:00
"crypto/md5"
"fixtures" // Test case for issue #534
"fmt"
2025-05-26 13:54:46 +03:00
ast "go/ast"
_ "net/http"
"strings"
str "strings"
)
const str = "" // MATCH /The name 'str' shadows an import name/
type myAst struct {
ast *ast.GenDecl
}
2025-05-26 13:54:46 +03:00
type bytes struct{} // MATCH /The name 'bytes' shadows an import name/
2025-05-26 13:54:46 +03:00
type fmt interface{} // MATCH /The name 'fmt' shadows an import name/
func (ast myAst) foo() {} // MATCH /The name 'ast' shadows an import name/
func (a myAst) fmt() { // this should be skipped (method, not a pkg func)
var fmt string // MATCH /The name 'fmt' shadows an import name/
}
func (a myAst) md5() { // this should be skipped (method, not a pkg func)
strings := map[string]string{} // MATCH /The name 'strings' shadows an import name/
}
func md5() {} // MATCH /The name 'md5' shadows an import name/
func bar(_ string) {}
func toto() {
strings := map[string]string{} // MATCH /The name 'strings' shadows an import name/
}
func titi() {
2025-05-26 13:54:46 +03:00
v := md5 + bytes
return ast
}