From 0145fe348669e85057d75a0a3d32e151ff35d1cb Mon Sep 17 00:00:00 2001 From: JessonChan Date: Tue, 22 Jan 2019 20:52:06 +0800 Subject: [PATCH] remove SA1024 staticchek --- .travis.yml | 2 +- parser.go | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8f44b5ea..3a3a6f66 100644 --- a/.travis.yml +++ b/.travis.yml @@ -55,7 +55,7 @@ after_script: - rm -rf ./res/var/* script: - go test -v ./... - - staticcheck -show-ignored -checks "-ST1017,-U1000,-ST1005,-S1034,-S1012,-SA4006,-SA6005,-SA1019" + - staticcheck -show-ignored -checks "-ST1017,-U1000,-ST1005,-S1034,-S1012,-SA4006,-SA6005,-SA1019,-SA1024" - unconvert $(go list ./... | grep -v /vendor/) - ineffassign . - find . ! \( -path './vendor' -prune \) -type f -name '*.go' -print0 | xargs -0 gofmt -l -s diff --git a/parser.go b/parser.go index 9c509075..a8690274 100644 --- a/parser.go +++ b/parser.go @@ -259,9 +259,9 @@ func parseComment(lines []*ast.Comment) (pcs []*parsedComment, err error) { imports := []parsedImport{} for _, c := range lines { - t := strings.TrimSpace(strings.TrimPrefix(c.Text, "//")) + t := strings.TrimSpace(strings.TrimLeft(c.Text, "//")) if strings.HasPrefix(t, "@Param") { - pv := getparams(strings.TrimSpace(strings.TrimPrefix(t, "@Param"))) + pv := getparams(strings.TrimSpace(strings.TrimLeft(t, "@Param"))) if len(pv) < 4 { logs.Error("Invalid @Param format. Needs at least 4 parameters") } @@ -286,7 +286,7 @@ func parseComment(lines []*ast.Comment) (pcs []*parsedComment, err error) { } for _, c := range lines { - t := strings.TrimSpace(strings.TrimPrefix(c.Text, "//")) + t := strings.TrimSpace(strings.TrimLeft(c.Text, "//")) if strings.HasPrefix(t, "@Import") { iv := getparams(strings.TrimSpace(strings.TrimLeft(t, "@Import"))) if len(iv) == 0 || len(iv) > 2 { @@ -307,9 +307,9 @@ func parseComment(lines []*ast.Comment) (pcs []*parsedComment, err error) { filterLoop: for _, c := range lines { - t := strings.TrimSpace(strings.TrimLeft(c.Text, "/")) + t := strings.TrimSpace(strings.TrimLeft(c.Text, "//")) if strings.HasPrefix(t, "@Filter") { - fv := getparams(strings.TrimSpace(strings.TrimPrefix(t, "@Filter"))) + fv := getparams(strings.TrimSpace(strings.TrimLeft(t, "@Filter"))) if len(fv) < 3 { logs.Error("Invalid @Filter format. Needs at least 3 parameters") continue filterLoop @@ -349,9 +349,9 @@ filterLoop: pc.filters = filters pc.imports = imports - t := strings.TrimSpace(strings.TrimLeft(c.Text, "/")) + t := strings.TrimSpace(strings.TrimLeft(c.Text, "//")) if strings.HasPrefix(t, "@router") { - t := strings.TrimSpace(strings.TrimLeft(c.Text, "/")) + t := strings.TrimSpace(strings.TrimLeft(c.Text, "//")) matches := routeRegex.FindStringSubmatch(t) if len(matches) == 3 { pc.routerPath = matches[1]