Repository: mgechev/revive
Pull request #620 (2022-01-12 09:08:59)

Update module github.com/BurntSushi/toml to v1
[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/BurntSushi/toml](https://togithub.com/BurntSushi/toml) | require | major | `v0.4.1` -> `v1.0.0` |

---

### Release Notes

<details>
<summary>BurntSushi/toml</summary>

### [`v1.0.0`](https://togithub.com/BurntSushi/toml/releases/v1.0.0)

[Compare Source](https://togithub.com/BurntSushi/toml/compare/v0.4.1...v1.0.0)

This release adds much more detailed errors, support for the `toml.Marshaler` interface, and several fixes.

There is no special meaning in the jump to v1.0; the 0.x releases were always treated as if they're 1.x with regards to compatibility; the versioning scheme for this library predates the release of modules.

## New features

-   Error reporting is much improved; the reported position of errors should now always be correct and the library can print more detailed errors ([#&#8203;299](https://togithub.com/BurntSushi/toml/issues/299), [#&#8203;332](https://togithub.com/BurntSushi/toml/issues/332))

    Decode always return a `toml.ParseError`, which has three methods:

    -   `Error()` behaves as before and shows a single concise line with the error.

    -   `ErrorWithPosition()` shows the same error, but also shows the line the error occurred at, similar to e.g. clang or the Rust compiler.

    -   `ErrorWithUsage()` is the same as `ErrorWithPosition()`, but may also show a longer usage guidance message. This isn't always present (in which case it behaves identical to `ErrorWithPosition()`), but it should be present for most common mistakes and sources of confusion.

    Which error the correct one to use is depends on your application and preferences; in general I would recommend using at least `ErrorWithPosition()` for user-facing errors, as it's much more helpful for users of any skill level. If your users are likely to be non-technical then `ErrorWithUsage()` is probably a good idea; I did my best to avoid technical jargon such as "newline" and phrase things in a way that's understandable by most people not intimately familiar with these sort of things.

    Additionally, the TOML key that fialed should now always be reported in all errors.

-   Add `toml.Marshaler` interface. This can be used if you want full control over how something is marshalled as TOML, similar to `json.Marshaler` etc. This takes precedence over `encoding.TextMarshaler`. ([#&#8203;327](https://togithub.com/BurntSushi/toml/issues/327))

-   Allow TOML integers to be decoded to a Go float ([#&#8203;325](https://togithub.com/BurntSushi/toml/issues/325))

    Previously `int = 42` could only be decoded to an `int*` type; now this can also be decoded in a `float` type as long as it can be represented without loss of data.

## Fixes

-   Key.String() is now quoted when needed ([#&#8203;333](https://togithub.com/BurntSushi/toml/issues/333))

-   Fix decoding of nested structs on 32bit platforms ([#&#8203;314](https://togithub.com/BurntSushi/toml/issues/314))

-   Empty slices are now always `[]T{}` rather than nil, which was the behaviour in v0.3.1 and before. While they are identical for most purposes, encoding/json encodes them different (`[]` vs. `null`), making it an (accidentally) incompatible change ([#&#8203;339](https://togithub.com/BurntSushi/toml/issues/339))

</details>

---

### Configuration

📅 **Schedule**: At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/mgechev/revive).


Patch:
diff --git a/go.mod b/go.mod
index fc475cf..775eb52 100644
--- a/go.mod
+++ b/go.mod
@@ -3,7 +3,7 @@ module github.com/mgechev/revive
 go 1.12
 
 require (
-	github.com/BurntSushi/toml v0.4.1
+	github.com/BurntSushi/toml v1.0.0
 	github.com/chavacava/garif v0.0.0-20210405164556-e8a0a408d6af
 	github.com/fatih/color v1.13.0
 	github.com/fatih/structtag v1.2.0
diff --git a/go.sum b/go.sum
index 5e77ea0..66f671a 100644
--- a/go.sum
+++ b/go.sum
@@ -1,5 +1,7 @@
 github.com/BurntSushi/toml v0.4.1 h1:GaI7EiDXDRfa8VshkTj7Fym7ha+y8/XxIgD2okUIjLw=
 github.com/BurntSushi/toml v0.4.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
+github.com/BurntSushi/toml v1.0.0 h1:dtDWrepsVPfW9H/4y7dDgFc2MBUSeJhlaDtK13CxFlU=
+github.com/BurntSushi/toml v1.0.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
 github.com/chavacava/garif v0.0.0-20210405164556-e8a0a408d6af h1:spmv8nSH9h5oCQf40jt/ufBCt9j0/58u4G+rkeMqXGI=
 github.com/chavacava/garif v0.0.0-20210405164556-e8a0a408d6af/go.mod h1:Qjyv4H3//PWVzTeCezG2b9IRn6myJxJSr4TD/xo6ojU=
 github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
diff --git a/rule/var-naming.go b/rule/var-naming.go
index 49db020..1de8608 100644
--- a/rule/var-naming.go
+++ b/rule/var-naming.go
@@ -145,7 +145,12 @@ func (w *lintNames) Visit(n ast.Node) ast.Visitor {
 			}
 		}
 	case *ast.FuncDecl:
-		if w.file.IsTest() && (strings.HasPrefix(v.Name.Name, "Example") || strings.HasPrefix(v.Name.Name, "Test") || strings.HasPrefix(v.Name.Name, "Benchmark")) {
+		funcName := v.Name.Name
+		if w.file.IsTest() &&
+			(strings.HasPrefix(funcName, "Example") ||
+				strings.HasPrefix(funcName, "Test") ||
+				strings.HasPrefix(funcName, "Benchmark") ||
+				strings.HasPrefix(funcName, "Fuzz")) {
 			return w
 		}
 


Test patch:
diff --git a/test/var-naming_test.go b/test/var-naming_test.go
index 2d0bf75..b6ccd41 100644
--- a/test/var-naming_test.go
+++ b/test/var-naming_test.go
@@ -11,4 +11,6 @@ func TestVarNaming(t *testing.T) {
 	testRule(t, "var-naming", &rule.VarNamingRule{}, &lint.RuleConfig{
 		Arguments: []interface{}{[]interface{}{"ID"}, []interface{}{"VM"}},
 	})
+
+	testRule(t, "var-naming_test", &rule.VarNamingRule{}, &lint.RuleConfig{})
 }
diff --git a/testdata/var-naming_test.go b/testdata/var-naming_test.go
new file mode 100644
index 0000000..dadf61d
--- /dev/null
+++ b/testdata/var-naming_test.go
@@ -0,0 +1,12 @@
+// Test for name linting.
+
+// Package pkg_with_underscores ...
+package varnaming_test
+
+var var_name int // MATCH /don't use underscores in Go names; var var_name should be varName/
+
+func Test_ATest()           {}
+func Example_AnExample()    {}
+func Benchmark_ABenchmark() {}
+
+func Fuzz_AFuzz() {}