diff --git a/cmd/filebuildtag/main.go b/cmd/filebuildtag/main.go index bdd262a..f7d8153 100644 --- a/cmd/filebuildtag/main.go +++ b/cmd/filebuildtag/main.go @@ -1,10 +1,10 @@ package main import ( - "github.com/aziule/filebuildtag" + "github.com/aziule/filebuildtag/pkg/analyzer" "golang.org/x/tools/go/analysis/singlechecker" ) func main() { - singlechecker.Main(filebuildtag.Analyzer) + singlechecker.Main(analyzer.Analyzer) } diff --git a/filebuildtag.go b/pkg/analyzer/analyzer.go similarity index 96% rename from filebuildtag.go rename to pkg/analyzer/analyzer.go index fba1e78..b5ecc27 100644 --- a/filebuildtag.go +++ b/pkg/analyzer/analyzer.go @@ -1,5 +1,5 @@ -// Package filebuildtag exposes the necessary code to use the filebuildtag linter. -package filebuildtag +// Package analyzer exposes the analyzer.Analyzer object and code to use the filebuildtag linter. +package analyzer import ( "flag" diff --git a/filebuildtag_test.go b/pkg/analyzer/analyzer_test.go similarity index 90% rename from filebuildtag_test.go rename to pkg/analyzer/analyzer_test.go index 9ba9338..ca1dd74 100644 --- a/filebuildtag_test.go +++ b/pkg/analyzer/analyzer_test.go @@ -1,4 +1,4 @@ -package filebuildtag +package analyzer import ( "errors" @@ -6,7 +6,6 @@ import ( "testing" "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" "golang.org/x/tools/go/analysis/analysistest" ) @@ -17,19 +16,19 @@ func Test_Lint(t *testing.T) { pattern string flags string }{ - "match files with a wildcard": { + "successfully match files with a wildcard": { pattern: "filebuildtag_wildcard", flags: "*tag1_suff.go:tag1,*tag2_suff.go:tag2", }, - "match exact file names": { + "successfully match exact file names": { pattern: "filebuildtag_exact", flags: "pref_tag1_suff.go:tag1,pref_tag2_suff.go:tag2", }, - "match exact file name without tags": { + "successfully match exact file name without tags": { pattern: "filebuildtag_exact", flags: "", }, - "the std lib linter's original test file must have the foo tag": { + "successfully assess that the std lib linter's original test file must have the foo tag": { pattern: "buildtag", flags: "*:foo", }, diff --git a/testdata/src/buildtag/buildtag.go b/pkg/analyzer/testdata/src/buildtag/buildtag.go similarity index 100% rename from testdata/src/buildtag/buildtag.go rename to pkg/analyzer/testdata/src/buildtag/buildtag.go diff --git a/testdata/src/filebuildtag_exact/pref_tag1_suff.go b/pkg/analyzer/testdata/src/filebuildtag_exact/pref_tag1_suff.go similarity index 100% rename from testdata/src/filebuildtag_exact/pref_tag1_suff.go rename to pkg/analyzer/testdata/src/filebuildtag_exact/pref_tag1_suff.go diff --git a/testdata/src/filebuildtag_exact/pref_tag2_suff.go b/pkg/analyzer/testdata/src/filebuildtag_exact/pref_tag2_suff.go similarity index 100% rename from testdata/src/filebuildtag_exact/pref_tag2_suff.go rename to pkg/analyzer/testdata/src/filebuildtag_exact/pref_tag2_suff.go diff --git a/testdata/src/filebuildtag_wildcard/file.go b/pkg/analyzer/testdata/src/filebuildtag_wildcard/file.go similarity index 100% rename from testdata/src/filebuildtag_wildcard/file.go rename to pkg/analyzer/testdata/src/filebuildtag_wildcard/file.go diff --git a/testdata/src/filebuildtag_wildcard/pref1_tag1_suff.go b/pkg/analyzer/testdata/src/filebuildtag_wildcard/pref1_tag1_suff.go similarity index 100% rename from testdata/src/filebuildtag_wildcard/pref1_tag1_suff.go rename to pkg/analyzer/testdata/src/filebuildtag_wildcard/pref1_tag1_suff.go diff --git a/testdata/src/filebuildtag_wildcard/pref2_tag2_suff.go b/pkg/analyzer/testdata/src/filebuildtag_wildcard/pref2_tag2_suff.go similarity index 100% rename from testdata/src/filebuildtag_wildcard/pref2_tag2_suff.go rename to pkg/analyzer/testdata/src/filebuildtag_wildcard/pref2_tag2_suff.go diff --git a/testdata/src/filebuildtag_wildcard/pref3_tag1_suff.go b/pkg/analyzer/testdata/src/filebuildtag_wildcard/pref3_tag1_suff.go similarity index 100% rename from testdata/src/filebuildtag_wildcard/pref3_tag1_suff.go rename to pkg/analyzer/testdata/src/filebuildtag_wildcard/pref3_tag1_suff.go diff --git a/testdata/src/filebuildtag_wildcard/pref4_tag1_suff.go b/pkg/analyzer/testdata/src/filebuildtag_wildcard/pref4_tag1_suff.go similarity index 100% rename from testdata/src/filebuildtag_wildcard/pref4_tag1_suff.go rename to pkg/analyzer/testdata/src/filebuildtag_wildcard/pref4_tag1_suff.go diff --git a/testdata/src/filebuildtag_wildcard/pref5_tag1_suff.go b/pkg/analyzer/testdata/src/filebuildtag_wildcard/pref5_tag1_suff.go similarity index 100% rename from testdata/src/filebuildtag_wildcard/pref5_tag1_suff.go rename to pkg/analyzer/testdata/src/filebuildtag_wildcard/pref5_tag1_suff.go diff --git a/testdata/src/filebuildtag_wildcard/pref6_tag1_suff.go b/pkg/analyzer/testdata/src/filebuildtag_wildcard/pref6_tag1_suff.go similarity index 100% rename from testdata/src/filebuildtag_wildcard/pref6_tag1_suff.go rename to pkg/analyzer/testdata/src/filebuildtag_wildcard/pref6_tag1_suff.go diff --git a/testdata/src/filebuildtag_wildcard/tag1_suff.go b/pkg/analyzer/testdata/src/filebuildtag_wildcard/tag1_suff.go similarity index 100% rename from testdata/src/filebuildtag_wildcard/tag1_suff.go rename to pkg/analyzer/testdata/src/filebuildtag_wildcard/tag1_suff.go diff --git a/testdata/src/filebuildtag_wildcard/tag2_suff.go b/pkg/analyzer/testdata/src/filebuildtag_wildcard/tag2_suff.go similarity index 100% rename from testdata/src/filebuildtag_wildcard/tag2_suff.go rename to pkg/analyzer/testdata/src/filebuildtag_wildcard/tag2_suff.go