all: upgrade golangci-lint and formatters (#240)

This commit is contained in:
Michael McLoughlin
2022-03-27 15:31:26 -07:00
committed by GitHub
parent 553930530f
commit 72b8db9c80
24 changed files with 179 additions and 118 deletions

View File

@@ -1,6 +1,7 @@
package build
import (
"errors"
"fmt"
"log"
@@ -45,7 +46,8 @@ func (e *ErrorList) AddAt(p src.Position, err error) {
e.Add(Error{p, err})
}
// addext appends an error to the list, tagged with the
// addext appends an error to the list, tagged with the first external position
// outside this package.
func (e *ErrorList) addext(err error) {
e.Add(exterr(err))
}
@@ -59,7 +61,7 @@ func (e ErrorList) Err() error {
return e
}
// An ErrorList implements the error interface.
// Error implements the error interface.
func (e ErrorList) Error() string {
switch len(e) {
case 0:
@@ -74,7 +76,8 @@ func (e ErrorList) Error() string {
// an ErrorList. Otherwise it just logs the err string. Reports at most max
// errors, or unlimited if max is 0.
func LogError(l *log.Logger, err error, max int) {
if list, ok := err.(ErrorList); ok {
var list ErrorList
if errors.As(err, &list) {
for i, e := range list {
if max > 0 && i == max {
l.Print("too many errors")

View File

@@ -63,7 +63,7 @@ func TestLogErrorList(t *testing.T) {
for i := 1; i <= m; i++ {
expect += fmt.Sprintf("prefix: %s:%d: some kind of error\n", filename, i)
}
expect += fmt.Sprintf("prefix: too many errors\n")
expect += "prefix: too many errors\n"
got := buf.String()
if got != expect {

View File

@@ -9,7 +9,6 @@ import (
"github.com/mmcloughlin/avo/gotypes"
"github.com/mmcloughlin/avo/ir"
"github.com/mmcloughlin/avo/operand"
"github.com/mmcloughlin/avo/reg"
)

View File

@@ -2,10 +2,9 @@ package build
import (
"github.com/mmcloughlin/avo/attr"
"github.com/mmcloughlin/avo/gotypes"
"github.com/mmcloughlin/avo/operand"
"github.com/mmcloughlin/avo/reg"
"github.com/mmcloughlin/avo/gotypes"
)
//go:generate avogen -output zmov.go mov