Skip to content

Commit

Permalink
move analyzer to pkg (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
aziule authored Nov 17, 2024
1 parent a1b08cf commit ad697e1
Show file tree
Hide file tree
Showing 15 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions cmd/filebuildtag/main.go
Original file line number Diff line number Diff line change
@@ -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)
}
4 changes: 2 additions & 2 deletions filebuildtag.go → pkg/analyzer/analyzer.go
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
11 changes: 5 additions & 6 deletions filebuildtag_test.go → pkg/analyzer/analyzer_test.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package filebuildtag
package analyzer

import (
"errors"
"flag"
"testing"

"github.com/stretchr/testify/assert"

"github.com/stretchr/testify/require"
"golang.org/x/tools/go/analysis/analysistest"
)
Expand All @@ -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",
},
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit ad697e1

Please sign in to comment.