Skip to content

Add "untypedconst" linter #3478

Open
@leonklingele

Description

@leonklingele

Your feature request related to a problem? Please describe.

The untypedconst linter ensures that untyped constant expressions are not used as values of defined type (a.k.a. named type).

// The first call is valid as it is passing a typed-constant to "takesExString" which expects a typed-constant as its first parameter.
// The second call is invalid as it passes an untyped-constant which has the same underlying type as the one expected (string)
func Call() {
	takesExString(external.ExStr)
	takesExString("hoge")         // want `passing untyped constant to parameter of defined type "github.com/jiftechnify/untypedconst/pkg/external.ExString"`
[..]

https://github.com/jiftechnify/untypedconst

Describe the solution you'd like.

Describe alternatives you've considered.

Additional context.

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or improvementlinter: newSupport new linterno decisionNo decision to fix or not

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions