Skip to content

Commit

Permalink
dev: back to compatible to go1.18 functions
Browse files Browse the repository at this point in the history
  • Loading branch information
butuzov committed Jan 23, 2024
1 parent 0c2232f commit 397b1a1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions analyzer/analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,13 @@ func filterInterfaces(p *analysis.Pass, ft *ast.FuncType, di map[string]struct{}
if !isNamed {

typeParams := val.String()
typeParams, _ = strings.CutPrefix(typeParams, "interface{")
typeParams, _ = strings.CutSuffix(typeParams, "}")
prefix, suffix := "interface{", "}"
if strings.HasPrefix(typeParams, prefix) { // nolint: gosimple
typeParams = typeParams[len(prefix):]
}
if strings.HasSuffix(typeParams, suffix) {
typeParams = typeParams[:len(typeParams)-1]
}

results = append(results, types.IFace{
Name: name,
Expand Down

0 comments on commit 397b1a1

Please sign in to comment.