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)
}

View File

@@ -46,7 +46,6 @@ type InstructionSet struct {
// :ivar summary: a summary description of the instruction name.
// :ivar forms: a list of :class:`InstructionForm` objects representing the instruction forms.
// """
//
type Instruction struct {
Name string `xml:"name,attr"`
Summary string `xml:"summary,attr"`
@@ -114,7 +113,6 @@ type Instruction struct {
// the instruction.
// :ivar encodings: a list of :class:`Encoding` objects representing the possible encodings for this instruction.
// """
//
type Form struct {
GASName string `xml:"gas-name,attr"`
GoName string `xml:"go-name,attr"`
@@ -356,7 +354,6 @@ type Form struct {
// encode values in the [-128, 127] range. But if it is extended to 4 bytes, it can also encode values in \
// [2**32 - 128, 2**32 - 1] range.
// """
//
type Operand struct {
Type string `xml:"type,attr"`
Input bool `xml:"input,attr"`
@@ -432,7 +429,6 @@ type ImplicitOperand struct {
// - "AES" := `AES` instruction set.
// - "SHA" := `SHA` instruction set.
// """
//
type ISA struct {
ID string `xml:"id,attr"`
}
@@ -482,7 +478,6 @@ type Encoding struct {
// If X is a reference to an instruction operand, the operand is of memory type and the REX.X bit specifies the \
// high bit (bit 3) of the index register number, and the B instance variable refers to the same operand.
// """
//
type REX struct {
Mandatory bool `xml:"mandatory,attr"`
W uint `xml:"W,attr"`
@@ -581,7 +576,6 @@ type REX struct {
// If vvvv is a reference to an instruction operand, the operand is of register type and VEX.vvvv field specifies \
// its number.
// """
//
type VEX struct {
Type string `xml:"type,attr"`
W *uint `xml:"W,attr"`
@@ -713,7 +707,6 @@ type VEX struct {
//
// None indicates that this instruction form does not use displacement (the form has no memory operands).
// """
//
type EVEX struct {
M2 string `xml:"mm,attr"`
PP string `xml:"pp,attr"`

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