Repository: mgechev/revive

Issue:
Exclusions broken
**Describe the bug**
With v1.6.1 which includes https://github.com/mgechev/revive/pull/1060 the exclusions are no longer working as before. I have previously been using

```
revive -exclude dir1/... -exclude dir2/... ./...
```

I see the globbing patterns have replaced the dots, however I have been unable to make anything work. I've tried:

- `'dir1/*'`
- `'dir1/**'`
- `'./dir1/**'`
- - `'dir1/**.go'`


**To Reproduce**
See above

**Expected behavior**
Should be able to exclude entire directories

**Logs**
no

**Desktop (please complete the following information):**
 - Ubuntu 24.04.1 LTS 
 - Go 1.23.6

**Additional context**
If this does work, some better samples in the CLI help would be good.
Also, this was clearly a breaking change and not just a patch version.


Discussion:
@denisvmedia: @mfederowicz  can you check it please?@mfederowicz: yes @denisvmedia ill check, i notice problem with excludes with ```./...``` i will try fix it in near future :)@mcandre: Why isn't vendor excluded by default?@mfederowicz: hey @mcandre vendor is excluded by default, but only if you not set any --exclude flag, or set exclude = [] config :)@mcandre: I see.

When will a fix version be released for #1230?@mfederowicz: @mcandre i dont know when release window is open/closed in special cases we can create tag to bump version but more info about that have @denisvmedia or @chavacava 

of course you can also install revive from master: go install -x github.com/mgechev/revive@master

as i rememeber go install -x github.com/mgechev/revive@latest - install latest released version :)@xxxserxxx: File exclusions don't work for me unless they're specific:

Works:

```
revive -exclude file_test.go
revive -exclude *_test.go
```

The second one works only because it's the shell doing the globbing, not revive.

None of the following work:

```
revive -exclude TEST
revive -exclude '*_test.go'
```

or in a config:

```
exclude=["TEST", "*_test.go", `**/*_test.go"]
```

or

```
Exclude=["TEST", "*_test.go", "**/*_test.go"]
```

or any variation thereof. The only thing I can get to exclude test files is by specifying them explicitly by name on the command line. Note that this is an issue for any sort of automation, because if there are no test files, trying to glob on the command line will return an error:

```
$ mkdir test ; cd test
$ revive -exclude *_test.go
zsh: no matches found: *_test.go
```

```sh
$ revive -version
version 1.9.0
```

Solution patch:
diff --git a/go.mod b/go.mod
index b8eadfd..a5f9a9c 100644
--- a/go.mod
+++ b/go.mod
@@ -4,7 +4,6 @@ go 1.22.1
 
 require (
 	github.com/BurntSushi/toml v1.4.0
-	github.com/bmatcuk/doublestar/v4 v4.8.1
 	github.com/chavacava/garif v0.1.0
 	github.com/fatih/color v1.18.0
 	github.com/fatih/structtag v1.2.0
diff --git a/go.sum b/go.sum
index a964c22..540a130 100644
--- a/go.sum
+++ b/go.sum
@@ -1,7 +1,5 @@
 github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0=
 github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
-github.com/bmatcuk/doublestar/v4 v4.8.1 h1:54Bopc5c2cAvhLRAzqOGCYHYyhcDHsFF4wWIR5wKP38=
-github.com/bmatcuk/doublestar/v4 v4.8.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc=
 github.com/chavacava/garif v0.1.0 h1:2JHa3hbYf5D9dsgseMKAmc/MZ109otzgNFk5s87H9Pc=
 github.com/chavacava/garif v0.1.0/go.mod h1:XMyYCkEL58DF0oyW4qDjjnPWONs2HBqYKI+UIPD+Gww=
 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
diff --git a/revivelib/core.go b/revivelib/core.go
index c327d90..31463fe 100755
--- a/revivelib/core.go
+++ b/revivelib/core.go
@@ -5,10 +5,8 @@ import (
 	"fmt"
 	"log"
 	"os"
-	"path/filepath"
 	"strings"
 
-	"github.com/bmatcuk/doublestar/v4"
 	"github.com/mgechev/dots"
 	"github.com/mgechev/revive/config"
 	"github.com/mgechev/revive/lint"
@@ -175,12 +173,7 @@ func getPackages(includePatterns []string, excludePatterns ArrayFlags) ([][]stri
 		globs = append(globs, ".")
 	}
 
-	globs, skips, err := prepareSkips(globs, normalizeSplit(excludePatterns))
-	if err != nil {
-		return nil, fmt.Errorf("prepare skips - resolving excludes before dots: %w", err)
-	}
-
-	packages, err := dots.ResolvePackages(globs, skips)
+	packages, err := dots.ResolvePackages(globs, normalizeSplit(excludePatterns))
 	if err != nil {
 		return nil, fmt.Errorf("getting packages - resolving packages in dots: %w", err)
 	}
@@ -188,29 +181,6 @@ func getPackages(includePatterns []string, excludePatterns ArrayFlags) ([][]stri
 	return packages, nil
 }
 
-func prepareSkips(globs, excludes []string) ([]string, []string, error) {
-	var skips []string
-	for _, path := range globs {
-		var basepath string
-		basepath, _ = doublestar.SplitPattern(path)
-		fsys := os.DirFS(basepath)
-		for _, skip := range excludes {
-			matches, err := doublestar.Glob(fsys, skip)
-			if err != nil {
-				return nil, nil, fmt.Errorf("Skips Error: %w", err)
-			}
-			for _, match := range matches {
-				path = basepath + "/" + match
-				// create skip only for .go files
-				if filepath.Ext(path) == ".go" {
-					skips = append(skips, path)
-				}
-			}
-		}
-	}
-	return globs, skips, nil
-}
-
 func normalizeSplit(strs []string) []string {
 	res := []string{}
 



Test patch:
diff --git a/cli/main_test.go b/cli/main_test.go
index 76441b4..e3dca7a 100644
--- a/cli/main_test.go
+++ b/cli/main_test.go
@@ -104,14 +104,17 @@ func TestGetVersion(t *testing.T) {
 		builtBy string
 		want    string
 	}{
-		{
-			name:    "Development version",
-			version: defaultVersion,
-			commit:  defaultCommit,
-			date:    defaultDate,
-			builtBy: defaultBuilder,
-			want:    "version \n",
-		},
+		// TODO re-activate the testcase
+		/*
+			{
+				name:    "Development version",
+				version: defaultVersion,
+				commit:  defaultCommit,
+				date:    defaultDate,
+				builtBy: defaultBuilder,
+				want:    "version \n",
+			},
+		*/
 		{
 			name:    "Release version",
 			version: "v1.5.0-12-g7ee4500-dev",
diff --git a/revivelib/core_test.go b/revivelib/core_test.go
index 144758a..d434660 100644
--- a/revivelib/core_test.go
+++ b/revivelib/core_test.go
@@ -36,43 +36,6 @@ func TestReviveLint(t *testing.T) {
 	}
 }
 
-func TestReviveLintExcludeWithRegexp(t *testing.T) {
-	// ARRANGE
-	revive := getMockRevive(t)
-
-	// ACT
-	files := []string{"../testdata/if_return.go"}
-	excludePatterns := []string{"*return*"}
-	packages := []*revivelib.LintPattern{}
-	for _, file := range files {
-		packages = append(packages, revivelib.Include(file))
-	}
-
-	for _, file := range excludePatterns {
-		packages = append(packages, revivelib.Exclude(file))
-	}
-
-	failures, err := revive.Lint(packages...)
-
-	if err != nil {
-		t.Fatal(err)
-	}
-
-	// ASSERT
-	failureList := []lint.Failure{}
-
-	for failure := range failures {
-		failureList = append(failureList, failure)
-	}
-
-	const expected = 0
-
-	got := len(failureList)
-	if got != expected {
-		t.Fatalf("Expected failures to have %d failures, but it has %d.", expected, got)
-	}
-}
-
 func TestReviveFormat(t *testing.T) {
 	// ARRANGE
 	revive := getMockRevive(t)