Skip to content

Commit

Permalink
ignore test package
Browse files Browse the repository at this point in the history
  • Loading branch information
seiyab committed Apr 19, 2024
1 parent b4b6276 commit 887eb45
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions urlstring/analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package urlstring
import (
"go/ast"
"go/token"
"strings"

"github.com/seiyab/gost/utils"
"golang.org/x/tools/go/analysis"
Expand All @@ -16,6 +17,9 @@ var Analyzer = &analysis.Analyzer{

func run(pass *analysis.Pass) (any, error) {
for _, f := range pass.Files {
if f.Name != nil && strings.HasSuffix(f.Name.Name, "_test") {
continue
}
ast.Inspect(f, func(n ast.Node) bool {
switch n := n.(type) {
case *ast.CallExpr:
Expand Down
11 changes: 11 additions & 0 deletions urlstring/testdata/a_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package testdata_test

import "fmt"

func _(host, userUUID, query string) {
_ = fmt.Sprintf("http://%s/api/v1/users/%s/comments?q=%s", host, userUUID, query)

_ = "https://" + host + "/api"

_ = "https://example.com"
}

0 comments on commit 887eb45

Please sign in to comment.