Skip to content

Commit

Permalink
force goimport
Browse files Browse the repository at this point in the history
  • Loading branch information
nunnatsa committed Nov 7, 2024
1 parent bbcb9bf commit 4a87464
Show file tree
Hide file tree
Showing 26 changed files with 50 additions and 18 deletions.
2 changes: 2 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Please delete options that are not relevant.
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update
- [ ] Refactoring

# How Has This Been Tested?

Expand All @@ -28,6 +29,7 @@ Please describe the tests that you ran to verify your changes. Provide instructi
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules
- [ ] I ran `make goimports`
- [ ] I ran [golangci-lint](https://github.com/golangci/golangci-lint)

@nunnatsa
4 changes: 3 additions & 1 deletion .github/workflows/sanity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,6 @@ jobs:

# make sure we can build the cli
- name: Build
run: make
run: |
make build
git diff --exit-code
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ HASH_FLAG := -X github.com/nunnatsa/ginkgolinter/version.gitHash=$(COMMIT_HASH)

BUILD_ARGS := -ldflags "$(VERSION_FLAG) $(HASH_FLAG)"

build:
build: goimports
go build $(BUILD_ARGS) -o ginkgolinter ./cmd/ginkgolinter

unit-test:
Expand All @@ -27,3 +27,7 @@ test-cli:
cd tests; go test -v ./

test: unit-test test-cli

goimports:
go install golang.org/x/tools/cmd/goimports@latest
goimports -w -local="github.com/nunnatsa/ginkgolinter" $(shell find . -type f -name '*.go' ! -path "*/vendor/*")
8 changes: 5 additions & 3 deletions cmd/ginkgolinter/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ package cli

import (
"fmt"
"github.com/nunnatsa/ginkgolinter"
"github.com/nunnatsa/ginkgolinter/version"
"golang.org/x/tools/go/analysis/singlechecker"
"os"
"runtime"

"golang.org/x/tools/go/analysis/singlechecker"

"github.com/nunnatsa/ginkgolinter"
"github.com/nunnatsa/ginkgolinter/version"
)

func Main() int {
Expand Down
1 change: 1 addition & 0 deletions internal/expression/actual/actualarg.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"go/ast"
"go/token"
gotypes "go/types"

"golang.org/x/tools/go/analysis"

"github.com/nunnatsa/ginkgolinter/internal/expression/value"
Expand Down
3 changes: 2 additions & 1 deletion internal/expression/expression.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package expression

import (
"fmt"
"github.com/nunnatsa/ginkgolinter/internal/formatter"
"go/ast"
"go/token"
gotypes "go/types"

"github.com/nunnatsa/ginkgolinter/internal/formatter"

"github.com/go-toolsmith/astcopy"
"golang.org/x/tools/go/analysis"

Expand Down
1 change: 1 addition & 0 deletions internal/gomegahandler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package gomegahandler

import (
"go/ast"

"golang.org/x/tools/go/analysis"
)

Expand Down
3 changes: 2 additions & 1 deletion internal/gomegahandler/namedhandler.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package gomegahandler

import (
"github.com/nunnatsa/ginkgolinter/internal/gomegainfo"
"go/ast"

"github.com/nunnatsa/ginkgolinter/internal/gomegainfo"

"golang.org/x/tools/go/analysis"
)

Expand Down
3 changes: 2 additions & 1 deletion internal/gomegainfo/gomegainfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package gomegainfo
import (
"go/ast"
gotypes "go/types"
"golang.org/x/tools/go/analysis"
"regexp"

"golang.org/x/tools/go/analysis"
)

const ( // gomega actual method names
Expand Down
3 changes: 2 additions & 1 deletion internal/reports/report-builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package reports

import (
"fmt"
"github.com/nunnatsa/ginkgolinter/internal/formatter"
"go/ast"
"go/token"
"strings"

"github.com/nunnatsa/ginkgolinter/internal/formatter"

"golang.org/x/tools/go/analysis"
)

Expand Down
3 changes: 2 additions & 1 deletion internal/rules/equaldifferenttypesrule.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package rules

import (
gotypes "go/types"

"github.com/nunnatsa/ginkgolinter/internal/expression"
"github.com/nunnatsa/ginkgolinter/internal/expression/matcher"
"github.com/nunnatsa/ginkgolinter/internal/reports"
"github.com/nunnatsa/ginkgolinter/types"
gotypes "go/types"
)

const compareDifferentTypes = "use %[1]s with different types: Comparing %[2]s with %[3]s; either change the expected value type if possible, or use the BeEquivalentTo() matcher, instead of %[1]s()"
Expand Down
3 changes: 2 additions & 1 deletion internal/rules/nilcomparerule.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package rules

import (
"go/token"

"github.com/nunnatsa/ginkgolinter/internal/expression"
"github.com/nunnatsa/ginkgolinter/internal/expression/actual"
"github.com/nunnatsa/ginkgolinter/internal/expression/matcher"
"github.com/nunnatsa/ginkgolinter/internal/reports"
"github.com/nunnatsa/ginkgolinter/types"
"go/token"
)

const (
Expand Down
1 change: 1 addition & 0 deletions linter/ginkgo_linter.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package linter

import (
"go/ast"

"golang.org/x/tools/go/analysis"

"github.com/nunnatsa/ginkgolinter/internal/expression"
Expand Down
1 change: 1 addition & 0 deletions testdata/src/a/comparetypes/comparetypes.gomega_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package comparetypes_test

import (
"fmt"

. "github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"
)
Expand Down
1 change: 1 addition & 0 deletions testdata/src/a/comparetypes/comparetypes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package comparetypes_test

import (
"fmt"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package comparetypes_test

import (
"fmt"

. "github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"
)
Expand Down
3 changes: 2 additions & 1 deletion testdata/src/a/comparison/comparison.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package comparison

import (
"time"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"time"
)

var exampleInt = 1
Expand Down
3 changes: 2 additions & 1 deletion testdata/src/a/comparison/comparison.gomega.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package comparison

import (
"time"

. "github.com/onsi/ginkgo/v2"
g "github.com/onsi/gomega"
"time"
)

var _ = Describe("remove comparison", func() {
Expand Down
1 change: 1 addition & 0 deletions testdata/src/a/confighaveoccurred/haveoccurred.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package haveoccurred

import (
"fmt"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
Expand Down
1 change: 1 addition & 0 deletions testdata/src/a/confighaveoccurred/haveoccurred.gomega.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package haveoccurred

import (
"fmt"

. "github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"
)
Expand Down
7 changes: 4 additions & 3 deletions testdata/src/a/eventually/issue88.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package eventually

import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gexec"
"os"
"os/exec"
"testing"
"time"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gexec"
)

func Test(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions testdata/src/a/haveoccurred/haveoccurred.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package haveoccurred

import (
"fmt"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
Expand Down
1 change: 1 addition & 0 deletions testdata/src/a/haveoccurred/haveoccurred.gomega.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package haveoccurred

import (
"fmt"

. "github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"
)
Expand Down
3 changes: 2 additions & 1 deletion testdata/src/a/noassersion/ginkgo.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package noassersion

import (
"time"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"time"
)

var _ = Describe("", func() {
Expand Down
1 change: 1 addition & 0 deletions testdata/src/a/pointerval/pointerval.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package pointerval

import (
"fmt"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
Expand Down
3 changes: 2 additions & 1 deletion utils/setwanted/setWanted.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package main
import (
"bufio"
"fmt"
"golang.org/x/sync/errgroup"
"log"
"os"
"strconv"
"strings"

"golang.org/x/sync/errgroup"
)

func main() {
Expand Down

0 comments on commit 4a87464

Please sign in to comment.