1
0
mirror of https://github.com/mgechev/revive.git synced 2025-01-10 03:17:11 +02:00
revive/fixtures/import-shadowing.go
SalvadorC 2ce440cf96 new rule: import shadowing (#114)
* Adds rule superfluous-else (an extension of indent-error-flow)

* Fix superfluous-else rule struct namming.

* Adds superfuous-else rule to the rules table

* Adds confusing-naming rule

* adds multifile test

* clean-up

* fix config.go

* clean master

* new ADS rule: newerr

* ADS-print working version

* ads-print final version

* ads-lost-err working version

* fix ads-print

* removes ads rules from master

* new rule: import-shadowing

* removes ads rules from master

* new rule: import-shadowing

* fix defaults

* adds explanations on the rule implementation
2019-03-27 11:46:20 -07:00

37 lines
681 B
Go

package fixtures
import (
ast "go/ast"
"bytes"
"crypto/md5"
"fmt"
_ "net/http"
"strings"
str "strings"
)
const str = "" // MATCH /The name 'str' shadows an import name/
type myAst struct {
ast *ast.GenDecl
}
type bytes struct {} // MATCH /The name 'bytes' shadows an import name/
type fmt interface {} // MATCH /The name 'fmt' shadows an import name/
func (ast myAst) foo() {} // MATCH /The name 'ast' 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() {
v := md5+bytes
return ast
}