Skip to content

Commit

Permalink
review: breaking changes in a BUGFIX version are BAD
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed Jun 26, 2022
1 parent 9d851dd commit 621b393
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/golinters/nonamedreturns.go
Expand Up @@ -15,7 +15,7 @@ func NewNoNamedReturns(settings *config.NoNamedReturnsSettings) *goanalysis.Lint
if settings != nil {
cfg = map[string]map[string]interface{}{
a.Name: {
analyzer.FlagReportErrorInDefer: settings.ReportErrorInDefer || !settings.AllowErrorInDefer,
analyzer.FlagReportErrorInDefer: settings.ReportErrorInDefer && !settings.AllowErrorInDefer,
},
}
}
Expand Down
8 changes: 4 additions & 4 deletions test/testdata/nonamedreturns_custom.go
Expand Up @@ -29,7 +29,7 @@ var e2 = func() (_ error) {
return
}

func deferWithError() (err error) { // ERROR `named return "err" with type "error" found`
func deferWithError() (err error) {
defer func() {
err = nil // use flag to allow this
}()
Expand Down Expand Up @@ -62,7 +62,7 @@ func funcDefintionImpl(arg1, arg2 interface{}) (int, error) {
return 0, nil
}

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

Expand Down Expand Up @@ -103,12 +103,12 @@ func good(i string) string {
return i
}

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`
func bad(i string, a, b int) (ret1 string, ret2 interface{}, ret3, ret4 int, ret5 asdf) { // ERROR `named return "ret1" with type "string" found`
x := "dummy"
return fmt.Sprintf("%s", x), nil, 1, 2, asdf{}
}

func bad2() (msg string, err error) { // ERROR `named return "msg" with type "string" found` `named return "err" with type "error" found`
func bad2() (msg string, err error) { // ERROR `named return "msg" with type "string" found`
msg = ""
err = nil
return
Expand Down

0 comments on commit 621b393

Please sign in to comment.