all: upgrade to golangci-lint v1.49.0 (#329)

Fixes #242
This commit is contained in:
Michael McLoughlin
2022-09-05 17:25:03 -07:00
committed by GitHub
parent d76a0f6dd6
commit e788b7675f
9 changed files with 433 additions and 436 deletions

View File

@@ -4,7 +4,9 @@ linters:
enable-all: true
disable:
- cyclop
- deadcode
- errname
- exhaustruct
- exhaustivestruct
- forbidigo
- forcetypeassert
@@ -22,12 +24,16 @@ linters:
- lll
- maligned
- nlreturn
- nonamedreturns
- nosnakecase
- paralleltest
- prealloc
- scopelint
- structcheck
- tagliatelle
- testpackage
- unparam
- varcheck
- varnamelen
- wrapcheck
- wsl

View File

@@ -11,7 +11,6 @@ import (
"fmt"
"go/format"
"io"
"io/ioutil"
"log"
"net/http"
"os"
@@ -107,7 +106,7 @@ func DownloadGoSourceFile(outpath, v, srcpath string) (err error) {
return err
}
if err := ioutil.WriteFile(outpath, buf.Bytes(), 0o644); err != nil {
if err := os.WriteFile(outpath, buf.Bytes(), 0o644); err != nil {
return err
}
@@ -169,7 +168,7 @@ func Parse(r io.Reader) ([]Flag, error) {
// ParseFile parses text flags header file.
func ParseFile(filename string) ([]Flag, error) {
b, err := ioutil.ReadFile(filename)
b, err := os.ReadFile(filename)
if err != nil {
return nil, err
}

View File

@@ -7,9 +7,9 @@
//
// Any terms provided in the filename can be thought of as an implicit extra
// constraint comment line. Collectively, these are referred to as
// ``constraints''. Each line is a ``constraint''. Within each constraint the
// space-separated terms are ``options'', and within that the comma-separated
// items are ``terms'' which may be negated with at most one exclaimation mark.
// constraints. Each line is a constraint. Within each constraint the
// space-separated terms are options, and within that the comma-separated
// items are terms which may be negated with at most one exclaimation mark.
//
// These represent a boolean formulae. The constraints are evaluated as the AND
// of constraint lines; a constraint is evaluated as the OR of its options and

View File

@@ -99,7 +99,6 @@ func (c *component) Dereference(r reg.Register) Component {
// Len int
// Cap int
// }
//
var slicehdroffsets = Sizes.Offsetsof([]*types.Var{
types.NewField(token.NoPos, nil, "Data", types.Typ[types.Uintptr], false),
types.NewField(token.NoPos, nil, "Len", types.Typ[types.Int], false),

View File

@@ -8,7 +8,6 @@ import (
"errors"
"flag"
"fmt"
"io/ioutil"
"log"
"math"
"net/url"
@@ -84,7 +83,7 @@ func mainerr() (err error) {
// Output.
if *output != "" {
err = ioutil.WriteFile(*output, body, 0o640)
err = os.WriteFile(*output, body, 0o640)
} else {
_, err = os.Stdout.Write(body)
}
@@ -103,7 +102,7 @@ var templates embed.FS
func load() (string, error) {
// Prefer explicit filename, if provided.
if *tmpl != "" {
b, err := ioutil.ReadFile(*tmpl)
b, err := os.ReadFile(*tmpl)
if err != nil {
return "", err
}
@@ -125,7 +124,7 @@ func load() (string, error) {
// include template function.
func include(filename string) (string, error) {
b, err := ioutil.ReadFile(filename)
b, err := os.ReadFile(filename)
if err != nil {
return "", err
}

View File

@@ -1,7 +1,7 @@
package inst_test
import (
"io/ioutil"
"os"
"reflect"
"sort"
"strings"
@@ -187,7 +187,7 @@ func TestInstructionArities(t *testing.T) {
}
func TestStdLibOpcodes(t *testing.T) {
b, err := ioutil.ReadFile("testdata/stdlibopcodes.txt")
b, err := os.ReadFile("testdata/stdlibopcodes.txt")
if err != nil {
t.Fatal(err)
}

File diff suppressed because it is too large Load Diff

View File

@@ -4,7 +4,6 @@ package test
import (
"flag"
"io"
"io/ioutil"
"log"
"os"
"os/exec"
@@ -32,7 +31,7 @@ func Assembles(t *testing.T, asm []byte) {
defer clean()
asmfilename := filepath.Join(dir, "asm.s")
if err := ioutil.WriteFile(asmfilename, asm, 0o600); err != nil {
if err := os.WriteFile(asmfilename, asm, 0o600); err != nil {
t.Fatal(err)
}
@@ -46,7 +45,7 @@ func Assembles(t *testing.T, asm []byte) {
func TempDir(t *testing.T) (string, func()) {
t.Helper()
dir, err := ioutil.TempDir("", "avo")
dir, err := os.MkdirTemp("", "avo")
if err != nil {
t.Fatal(err)
}

View File

@@ -4,7 +4,9 @@
go install ./internal/cmd/asmvet
# golangci-lint for linting
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.45.3-0.20220410144555-f36840520dec
golangci_lint_version='v1.49.0'
golangci_install_script="https://raw.githubusercontent.com/golangci/golangci-lint/${golangci_lint_version}/install.sh"
curl -sfL "${golangci_install_script}" | sh -s -- -b "$GOPATH/bin" "${golangci_lint_version}"
# embedmd required for documentation generation
go install github.com/campoy/embedmd@v1.0.0