Skip to content

Update infrastructure #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 27, 2024
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 @@ -15,8 +15,8 @@ jobs:
- stable
- oldstable
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a
with:
cache: true
go-version: ${{ matrix.go-version }}
Expand All @@ -30,11 +30,11 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a
with:
cache: true
go-version: stable
- uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc
- uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8
with:
version: v1.55.1
version: v1.62.2
23 changes: 15 additions & 8 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,58 @@
run:
go: '1.22'

linters:
enable:
- asasalint
- asciicheck
- bidichk
- bodyclose
- canonicalheader
- containedctx
- contextcheck
- copyloopvar
- decorder
- dogsled
- dupl
- dupword
- durationcheck
- err113
- errcheck
- errchkjson
- errname
- errorlint
- execinquery
- exhaustive
- exportloopref
- fatcontext
- forbidigo
- forcetypeassert
- gci
- ginkgolinter
- gocheckcompilerdirectives
- gochecknoinits
- gochecksumtype
- gocognit
- goconst
- gocritic
- gocyclo
- godot
- godox
- goerr113
- gofmt
- gofumpt
- goheader
- goimports
- gomoddirectives
- gomodguard
- goprintffuncname
- gosec
- gosimple
- gosmopolitan
- govet
- grouper
- iface
- importas
- inamedparam
- ineffassign
- interfacebloat
- intrange
- ireturn
- lll
- loggercheck
Expand All @@ -69,9 +75,11 @@ linters:
- promlinter
- protogetter
- reassign
- recvcheck
- revive
- rowserrcheck
- sloglint
- spancheck
- sqlclosecheck
- staticcheck
- stylecheck
Expand All @@ -92,11 +100,11 @@ linters:
disable:
- cyclop
- depguard
- exhaustivestruct
- exhaustruct
- funlen
- gochecknoglobals
- gomnd
- gosec
- mnd
- nlreturn
- paralleltest
- testableexamples
Expand All @@ -113,7 +121,6 @@ linters-settings:
- prefix(github.com/twpayne/go-polyline)
gofumpt:
extra-rules: true
go-version: '1.20'
module-path: github.com/twpayne/go-polyline
goimports:
local-prefixes: github.com/twpayne/go-polyline
Expand All @@ -123,5 +130,5 @@ linters-settings:
issues:
exclude-rules:
- linters:
- goerr113
- err113
text: "do not define dynamic errors, use wrapped static errors instead"
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/twpayne/go-polyline

go 1.18
go 1.22

require github.com/alecthomas/assert/v2 v2.2.1

Expand Down
8 changes: 4 additions & 4 deletions polyline.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func DecodeUint(buf []byte) (uint, []byte, error) {
n = len(buf)
}
var u, shift uint
for i := 0; i < n; i++ {
for i := range n {
switch b := buf[i]; {
case 95 <= b && b < 127:
u += (uint(b) - 95) << shift
Expand All @@ -70,9 +70,9 @@ func DecodeUint(buf []byte) (uint, []byte, error) {
if len(buf) <= strconv.IntSize/5 {
return 0, nil, ErrUnterminatedSequence
}
max := byte(1<<(strconv.IntSize-5*(strconv.IntSize/5)) - 1)
maxDigit := byte(1<<(strconv.IntSize-5*(strconv.IntSize/5)) - 1)
switch b := buf[n]; {
case 63 <= b && b <= 63+max:
case 63 <= b && b <= 63+maxDigit:
u += (uint(b) - 63) << shift
return u, buf[n+1:], nil
case b < 127:
Expand Down Expand Up @@ -171,7 +171,7 @@ func (c Codec) DecodeFlatCoords(flatCoords []float64, buf []byte) ([]float64, []
}
last := make([]int, c.Dim)
for len(buf) > 0 {
for j := 0; j < c.Dim; j++ {
for j := range c.Dim {
var err error
var k int
k, buf, err = DecodeInt(buf)
Expand Down
2 changes: 1 addition & 1 deletion polyline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ func TestFlatCoordsQuick(t *testing.T) {

func FuzzDecodeCoords(f *testing.F) {
f.Add([]byte("_p~iF~ps|U"))
f.Fuzz(func(t *testing.T, data []byte) {
f.Fuzz(func(_ *testing.T, data []byte) {
_, _, _ = polyline.DecodeCoords(data)
})
}
Loading