Skip to content

Commit 621b393

Browse files
committed
review: breaking changes in a BUGFIX version are BAD
1 parent 9d851dd commit 621b393

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

pkg/golinters/nonamedreturns.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func NewNoNamedReturns(settings *config.NoNamedReturnsSettings) *goanalysis.Lint
1515
if settings != nil {
1616
cfg = map[string]map[string]interface{}{
1717
a.Name: {
18-
analyzer.FlagReportErrorInDefer: settings.ReportErrorInDefer || !settings.AllowErrorInDefer,
18+
analyzer.FlagReportErrorInDefer: settings.ReportErrorInDefer && !settings.AllowErrorInDefer,
1919
},
2020
}
2121
}

test/testdata/nonamedreturns_custom.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ var e2 = func() (_ error) {
2929
return
3030
}
3131

32-
func deferWithError() (err error) { // ERROR `named return "err" with type "error" found`
32+
func deferWithError() (err error) {
3333
defer func() {
3434
err = nil // use flag to allow this
3535
}()
@@ -62,7 +62,7 @@ func funcDefintionImpl(arg1, arg2 interface{}) (int, error) {
6262
return 0, nil
6363
}
6464

65-
func funcDefintionImpl2(arg1, arg2 interface{}) (num int, err error) { // ERROR `named return "num" with type "int" found` `named return "err" with type "error" found`
65+
func funcDefintionImpl2(arg1, arg2 interface{}) (num int, err error) { // ERROR `named return "num" with type "int" found`
6666
return 0, nil
6767
}
6868

@@ -103,12 +103,12 @@ func good(i string) string {
103103
return i
104104
}
105105

106-
func bad(i string, a, b int) (ret1 string, ret2 interface{}, ret3, ret4 int, ret5 asdf) { // ERROR `named return "ret1" with type "string" found` `named return "ret2" with type "interface{}" found` `named return "ret3" with type "int" found` `named return "ret4" with type "int" found` `named return "ret5" with type "asdf" found`
106+
func bad(i string, a, b int) (ret1 string, ret2 interface{}, ret3, ret4 int, ret5 asdf) { // ERROR `named return "ret1" with type "string" found`
107107
x := "dummy"
108108
return fmt.Sprintf("%s", x), nil, 1, 2, asdf{}
109109
}
110110

111-
func bad2() (msg string, err error) { // ERROR `named return "msg" with type "string" found` `named return "err" with type "error" found`
111+
func bad2() (msg string, err error) { // ERROR `named return "msg" with type "string" found`
112112
msg = ""
113113
err = nil
114114
return

0 commit comments

Comments
 (0)