Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a
- uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
- uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
with:
version: v1.62.2
version: v2.8.0
test:
strategy:
matrix:
Expand All @@ -25,8 +25,8 @@ jobs:
- oldstable
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
with:
go-version: ${{ matrix.go-version }}
- name: build
Expand Down
317 changes: 167 additions & 150 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,156 +1,173 @@
version: "2"
run:
go: '1.23'

go: "1.24"
linters:
enable:
- asasalint
- asciicheck
- bidichk
- bodyclose
- canonicalheader
- containedctx
- contextcheck
- copyloopvar
- decorder
- dogsled
- dupl
- dupword
- durationcheck
- err113
- errcheck
- errchkjson
- errname
- errorlint
- fatcontext
- forbidigo
- forcetypeassert
- gci
- ginkgolinter
- gocheckcompilerdirectives
- gochecknoinits
- gochecksumtype
- goconst
- gocritic
- godot
- gofmt
- gofumpt
- goheader
- goimports
- gomoddirectives
- gomodguard
- goprintffuncname
- gosec
- gosimple
- gosmopolitan
- govet
- grouper
- iface
- importas
- inamedparam
- ineffassign
- interfacebloat
- intrange
- ireturn
- lll
- loggercheck
- makezero
- mirror
- misspell
- musttag
- nilerr
- noctx
- nolintlint
- nosprintfhostport
- perfsprint
- prealloc
- predeclared
- promlinter
- protogetter
- reassign
- recvcheck
- revive
- rowserrcheck
- sloglint
- spancheck
- sqlclosecheck
- staticcheck
- stylecheck
- tagalign
- tagliatelle
- tenv
- testableexamples
- testifylint
- thelper
- typecheck
- unconvert
- unparam
- unused
- usestdlibvars
- wastedassign
- whitespace
- zerologlint
disable:
- cyclop
- depguard
- exhaustive
- exhaustruct
- funlen
- gochecknoglobals
- gocognit
- gocyclo
- godox
- maintidx
- nakedret
- nestif
- nilnil
- nlreturn
- nonamedreturns
- paralleltest
- testpackage
- tparallel
- varnamelen
- wrapcheck
- wsl

linters-settings:
forbidigo:
forbid:
- ^fmt\.Print.*$
- ^ioutil\..*$
- ^os\.(DirEntry|FileInfo|FileMode|Is.*|Mode.*)$
gci:
sections:
- standard
- default
- prefix(github.com/twpayne/go-shapefile)
gofumpt:
extra-rules: true
module-path: github.com/twpayne/go-shapefile
goimports:
local-prefixes: github.com/twpayne/go-shapefile
gosec:
excludes:
- G115
ireturn:
allow:
- empty
- error
- github\.com/twpayne/go-geom\.T
- stdlib
misspell:
locale: US
stylecheck:
checks:
- all

issues:
include:
- EXC0011 # include issues about comments from `stylecheck`
exclude-rules:
- linters:
- arangolint
- asasalint
- asciicheck
- bidichk
- bodyclose
- canonicalheader
- containedctx
- contextcheck
- copyloopvar
- decorder
- dogsled
- dupl
- dupword
- durationcheck
- embeddedstructfieldcheck
- err113
text: do not define dynamic errors, use wrapped static errors instead
- linters:
- errchkjson
- errname
- errorlint
- exptostd
- fatcontext
- forbidigo
- forcetypeassert
- funcorder
- ginkgolinter
- gocheckcompilerdirectives
- gochecknoinits
- gochecksumtype
- goconst
- gocritic
- godot
- goheader
- gomoddirectives
- gomodguard
- goprintffuncname
- gosec
- gosmopolitan
- grouper
- iface
- importas
- inamedparam
- interfacebloat
- intrange
- iotamixing
- ireturn
- lll
path: _test\.go$
- loggercheck
- makezero
- mirror
- misspell
- modernize
- musttag
- nilerr
- nilnesserr
- nilnil
- noctx
- nolintlint
- nosprintfhostport
- perfsprint
- prealloc
- predeclared
- promlinter
- protogetter
- reassign
- recvcheck
- rowserrcheck
- sloglint
- spancheck
- sqlclosecheck
- staticcheck
- tagalign
- tagliatelle
- testableexamples
- testifylint
- thelper
- unconvert
- unparam
- unqueryvet
- usestdlibvars
- usetesting
- wastedassign
- whitespace
- zerologlint
disable:
- cyclop
- depguard
- exhaustive
- exhaustruct
- funlen
- gochecknoglobals
- gocognit
- gocyclo
- godox
- maintidx
- nakedret
- nestif
- nilnil
- nlreturn
- nonamedreturns
- paralleltest
- revive
- testpackage
- tparallel
- varnamelen
- wrapcheck
- wsl
settings:
forbidigo:
forbid:
- pattern: ^fmt\.Print.*$
- pattern: ^ioutil\..*$
- pattern: ^os\.(DirEntry|FileInfo|FileMode|Is.*|Mode.*)$
gosec:
excludes:
- G115
ireturn:
allow:
- empty
- error
- github\.com/twpayne/go-geom\.T
- stdlib
misspell:
locale: US
staticcheck:
checks:
- all
exclusions:
generated: lax
presets:
- common-false-positives
- legacy
- std-error-handling
rules:
- linters:
- err113
text: do not define dynamic errors, use wrapped static errors instead
- linters:
- gosec
- lll
path: _test\.go$
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gci
- gofmt
- gofumpt
- goimports
settings:
gci:
sections:
- standard
- default
- prefix(github.com/twpayne/go-shapefile)
gofumpt:
module-path: github.com/twpayne/go-shapefile
extra-rules: true
goimports:
local-prefixes:
- github.com/twpayne/go-shapefile
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
3 changes: 2 additions & 1 deletion dbf.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ type DBFFieldDescriptor struct {
// See https://www.clicketyclick.dk/databases/xbase/format/dbf.html.
type DBF struct {
DBFHeader

FieldDescriptors []*DBFFieldDescriptor
Records [][]any
}
Expand Down Expand Up @@ -190,7 +191,7 @@ func ReadDBF(r io.Reader, _ int64, options *ReadDBFOptions) (*DBF, error) {
// Ignore missing end of file marker.
case err != nil:
return nil, err
case data[0] != '\x1a':
case len(data) == 0 || data[0] != '\x1a':
return nil, fmt.Errorf("%d: invalid end of file marker", data[0])
}

Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module github.com/twpayne/go-shapefile

go 1.23
go 1.24.0

require (
github.com/alecthomas/assert/v2 v2.10.0
github.com/twpayne/go-geom v1.5.7
golang.org/x/net v0.33.0
golang.org/x/text v0.21.0
github.com/twpayne/go-geom v1.6.1
golang.org/x/net v0.49.0
golang.org/x/text v0.33.0
)

require (
Expand Down
Loading