Skip to content

gostaticanalysis/innertypealias

Repository files navigation

pkg.go.dev

innertypealias finds find a type which is an alias for exported same package's type.

package a

import "io"

type T int
type t int

type A = T         // want "A is a alias for T but it is exported type"
type B = t         // OK
type C = io.Writer // OK

func _() {
	type D = T // OK
}

type E T   // OK
type F t   // OK
type g = t // OK

type H = T // OK - it is used as an embedded field
type _ struct{ H }

type I = T // OK - it is used as an embedded field
func _() {
	type _ struct{ I }
}

type _ = T // OK

fixinnertypealias command check and replace a type alias to a defined type.

$ go install github.com/gostaticanalysis/innertypealias/cmd/fixinnertypealias@latest
$ fixinnertypealias ./...

About

Analyzer: innertypealias finds find a type which is an alias for exported same package's type.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages