diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cc07ef4..8542a59 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,13 +12,11 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + - uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 + - uses: golangci/golangci-lint-action@a4f60bb28d35aeee14e6880718e0c85ff1882e64 with: - go-version: '1.21' - - uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc - with: - version: v1.55.2 + version: v1.59.1 test: strategy: matrix: @@ -27,8 +25,8 @@ jobs: - oldstable runs-on: ubuntu-latest steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + - uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 with: go-version: ${{ matrix.go-version }} - name: build diff --git a/.golangci.yml b/.golangci.yml index 02bfee2..55ab925 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -13,11 +13,11 @@ linters: - dupl - dupword - durationcheck + - err113 - errcheck - errchkjson - errname - errorlint - - execinquery - exportloopref - forbidigo - forcetypeassert @@ -27,7 +27,6 @@ linters: - gochecksumtype - gocritic - godot - - goerr113 - gofmt - gofumpt - goimports @@ -42,7 +41,6 @@ linters: - inamedparam - ineffassign - interfacebloat - - ireturn - lll - loggercheck - makezero @@ -83,7 +81,6 @@ linters: - cyclop - depguard - exhaustive - - exhaustivestruct - exhaustruct - funlen - gochecknoglobals @@ -95,14 +92,13 @@ linters: - goheader - gomnd - gomoddirectives + - ireturn - maintidx - - maligned - nakedret - nestif - nilnil - nlreturn - nonamedreturns - - nosnakecase - paralleltest - testpackage - tparallel @@ -123,7 +119,6 @@ linters-settings: - prefix(github.com/twpayne/go-shapefile) gofumpt: extra-rules: true - lang-version: '1.18' module-path: github.com/twpayne/go-shapefile goimports: local-prefixes: github.com/twpayne/go-shapefile @@ -143,7 +138,7 @@ issues: - EXC0011 # include issues about comments from `stylecheck` exclude-rules: - linters: - - goerr113 + - err113 text: do not define dynamic errors, use wrapped static errors instead - linters: - gosec diff --git a/dbf.go b/dbf.go index 6191fa4..2609256 100644 --- a/dbf.go +++ b/dbf.go @@ -309,7 +309,7 @@ func TrimTrailingZeros(data []byte) []byte { func parseCharacter(data []byte, decoder *encoding.Decoder) (string, error) { if decoder == nil { - return "", fmt.Errorf("decoder is nil") + return "", errors.New("decoder is nil") } return decoder.String(string(bytes.TrimSpace(TrimTrailingZeros(data)))) } diff --git a/go.mod b/go.mod index ebeb602..219d3ee 100644 --- a/go.mod +++ b/go.mod @@ -3,13 +3,13 @@ module github.com/twpayne/go-shapefile go 1.21 require ( - github.com/alecthomas/assert/v2 v2.5.0 - github.com/twpayne/go-geom v1.5.3 - golang.org/x/net v0.20.0 - golang.org/x/text v0.14.0 + github.com/alecthomas/assert/v2 v2.6.0 + github.com/twpayne/go-geom v1.5.4 + golang.org/x/net v0.26.0 + golang.org/x/text v0.16.0 ) require ( - github.com/alecthomas/repr v0.3.0 // indirect + github.com/alecthomas/repr v0.4.0 // indirect github.com/hexops/gotextdiff v1.0.3 // indirect ) diff --git a/go.sum b/go.sum index 9e0ffab..902fb6f 100644 --- a/go.sum +++ b/go.sum @@ -1,12 +1,12 @@ -github.com/alecthomas/assert/v2 v2.5.0 h1:OJKYg53BQx06/bMRBSPDCO49CbCDNiUQXwdoNrt6x5w= -github.com/alecthomas/assert/v2 v2.5.0/go.mod h1:fw5suVxB+wfYJ3291t0hRTqtGzFYdSwstnRQdaQx2DM= -github.com/alecthomas/repr v0.3.0 h1:NeYzUPfjjlqHY4KtzgKJiWd6sVq2eNUPTi34PiFGjY8= -github.com/alecthomas/repr v0.3.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= +github.com/alecthomas/assert/v2 v2.6.0 h1:o3WJwILtexrEUk3cUVal3oiQY2tfgr/FHWiz/v2n4FU= +github.com/alecthomas/assert/v2 v2.6.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k= +github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc= +github.com/alecthomas/repr v0.4.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= -github.com/twpayne/go-geom v1.5.3 h1:UdH93XzTwpwPiAV38DJ74yg+9/YV9/WCGbKN+NmSvVA= -github.com/twpayne/go-geom v1.5.3/go.mod h1:scDv/u90MVD6K+/7cA44kQt9fD6M/n+VuLddERxWYR8= -golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= -golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +github.com/twpayne/go-geom v1.5.4 h1:b8fiZd0SsEmQEeUdz2atT6KggF1KHiaZIi3DGi5p+sI= +github.com/twpayne/go-geom v1.5.4/go.mod h1:Hw8RszQ2/d9Y/KfOm9CvUJo78BOoIA5g0e4P7JCVKvo= +golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= +golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= +golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= +golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= diff --git a/scanner.go b/scanner.go index 9db2c3d..3a8f3d9 100644 --- a/scanner.go +++ b/scanner.go @@ -500,7 +500,7 @@ func (s *Scanner) Discard(n int) (int, error) { s.scanSHP.scanRecords += n } } else if s.scanSHP != nil { - errSHP = fmt.Errorf("can't discard .shp file without .shx file") + errSHP = errors.New("can't discard .shp file without .shx file") return } }() @@ -717,7 +717,7 @@ func NewScannerDBF(reader io.ReadCloser, options *ReadDBFOptions) (*ScannerDBF, totalLength += fieldDescriptor.Length } if totalLength+1 != header.RecordSize { - return nil, fmt.Errorf("invalid total length of fields") + return nil, errors.New("invalid total length of fields") } var decoder *encoding.Decoder