diff --git a/.golangci.yml b/.golangci.yml index 1d1fa98..0aca8f0 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -31,6 +31,7 @@ linters: - govet # reports suspicious constructs, such as Printf calls with wrong arguments - grouper # An analyzer to analyze expression groups - ineffassign # Detects when assignments to existing variables are not used + - intrange # is a linter to find places where for loops could make use of an integer range - maintidx # measures the maintainability index of each function - makezero # Finds slice declarations with non-zero initial length - mirror # reports wrong mirror patterns of bytes/strings usage diff --git a/Makefile b/Makefile index 8e91fa7..231a55c 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -GOLANGCI_VERSION = v1.55.2 +GOLANGCI_VERSION = v1.57.0 help: ## show help, shown by default if no target is specified @grep -E '^[0-9a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' diff --git a/internal/assembler/nesasm/bank.go b/internal/assembler/nesasm/bank.go index db5ddf3..6ebad49 100644 --- a/internal/assembler/nesasm/bank.go +++ b/internal/assembler/nesasm/bank.go @@ -91,7 +91,7 @@ func setPrgBankSelector(prg []program.Offset, index int, bankAddress, bankNumber offsetInfo.Comment, offsetInfo.Code) data := offsetInfo.OpcodeBytes - for i := 0; i < len(data); i++ { + for i := range len(data) { offsetInfo = &prg[instructionStartIndex+i] offsetInfo.OpcodeBytes = data[i : i+1] offsetInfo.ClearType(program.CodeOffset) diff --git a/internal/disasm.go b/internal/disasm.go index 8112bd6..18040f7 100644 --- a/internal/disasm.go +++ b/internal/disasm.go @@ -271,7 +271,7 @@ func (dis *Disasm) convertToProgram() (*program.Program, error) { for _, bnk := range dis.banks { prgBank := program.NewPRGBank(len(bnk.offsets)) - for i := 0; i < len(bnk.offsets); i++ { + for i := range len(bnk.offsets) { offsetInfo := bnk.offsets[i] programOffsetInfo, err := getProgramOffset(dis.codeBaseAddress+uint16(i), offsetInfo, dis.options) if err != nil { diff --git a/internal/parser.go b/internal/parser.go index 2ad4053..b0d51fb 100644 --- a/internal/parser.go +++ b/internal/parser.go @@ -253,7 +253,7 @@ func (dis *Disasm) handleInstructionIRQOverlap(address uint16, offsetInfo *offse keepLength := int(irqStartAddress - address) offsetInfo.OpcodeBytes = offsetInfo.OpcodeBytes[:keepLength] - for i := 0; i < keepLength; i++ { + for i := range keepLength { offsetInfo = dis.mapper.offsetInfo(address + uint16(i)) offsetInfo.ClearType(program.CodeOffset) offsetInfo.SetType(program.CodeAsData | program.DataOffset) diff --git a/internal/writer/writer.go b/internal/writer/writer.go index 03c0d13..ebdbf2e 100644 --- a/internal/writer/writer.go +++ b/internal/writer/writer.go @@ -91,7 +91,7 @@ func (w Writer) BundleDataWrites(data []byte, lineWriter lineWriterFunc) error { return fmt.Errorf("writing data prefix: %w", err) } - for j := 0; j < toWrite; j++ { + for j := range toWrite { if _, err := fmt.Fprintf(buf, "$%02x, ", data[i+j]); err != nil { return fmt.Errorf("writing data byte: %w", err) }