Skip to content

Add "innertypealias" linter #3490

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
leonklingele opened this issue Jan 18, 2023 · 0 comments · May be fixed by #3525
Open

Add "innertypealias" linter #3490

leonklingele opened this issue Jan 18, 2023 · 0 comments · May be fixed by #3525
Labels
enhancement New feature or improvement linter: new Support new linter no decision No decision to fix or not

Comments

@leonklingele
Copy link
Contributor

Your feature request related to a problem? Please describe.

The innertypealias linter 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

https://github.com/gostaticanalysis/innertypealias

Describe the solution you'd like.

Describe alternatives you've considered.

Additional context.

No response

@leonklingele leonklingele added the enhancement New feature or improvement label Jan 18, 2023
@ldez ldez added linter: new Support new linter no decision No decision to fix or not labels Jan 18, 2023
leonklingele added a commit to leonklingele/golangci-lint that referenced this issue Jan 31, 2023
@leonklingele leonklingele linked a pull request Jan 31, 2023 that will close this issue
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or improvement linter: new Support new linter no decision No decision to fix or not
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants