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

View File

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

View File

@@ -7,9 +7,9 @@
// //
// Any terms provided in the filename can be thought of as an implicit extra // Any terms provided in the filename can be thought of as an implicit extra
// constraint comment line. Collectively, these are referred to as // constraint comment line. Collectively, these are referred to as
// ``constraints''. Each line is a ``constraint''. Within each constraint the // constraints. Each line is a constraint. Within each constraint the
// space-separated terms are ``options'', and within that the comma-separated // space-separated terms are options, and within that the comma-separated
// items are ``terms'' which may be negated with at most one exclaimation mark. // 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 // 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 // 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 // Len int
// Cap int // Cap int
// } // }
//
var slicehdroffsets = Sizes.Offsetsof([]*types.Var{ var slicehdroffsets = Sizes.Offsetsof([]*types.Var{
types.NewField(token.NoPos, nil, "Data", types.Typ[types.Uintptr], false), types.NewField(token.NoPos, nil, "Data", types.Typ[types.Uintptr], false),
types.NewField(token.NoPos, nil, "Len", types.Typ[types.Int], false), types.NewField(token.NoPos, nil, "Len", types.Typ[types.Int], false),

View File

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

View File

@@ -1,7 +1,7 @@
package inst_test package inst_test
import ( import (
"io/ioutil" "os"
"reflect" "reflect"
"sort" "sort"
"strings" "strings"
@@ -187,7 +187,7 @@ func TestInstructionArities(t *testing.T) {
} }
func TestStdLibOpcodes(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 { if err != nil {
t.Fatal(err) t.Fatal(err)
} }

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -4,7 +4,9 @@
go install ./internal/cmd/asmvet go install ./internal/cmd/asmvet
# golangci-lint for linting # 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 # embedmd required for documentation generation
go install github.com/campoy/embedmd@v1.0.0 go install github.com/campoy/embedmd@v1.0.0