Skip to content

Commit 262be4a

Browse files
committed
Use Go 1.26 in CI
Also run go fix ./...
1 parent 91f52d1 commit 262be4a

File tree

6 files changed

+20
-22
lines changed

6 files changed

+20
-22
lines changed

.github/workflows/test.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
fail-fast: false
2929
matrix:
3030
pg: ['14', '15', '16', '17', '18']
31-
go: ['1.21', '1.25']
31+
go: ['1.21', '1.26']
3232
steps:
3333
- uses: 'actions/checkout@v6'
3434
- uses: 'actions/setup-go@v6'
@@ -54,7 +54,7 @@ jobs:
5454
steps:
5555
- uses: 'actions/checkout@v6'
5656
- uses: 'actions/setup-go@v6'
57-
with: {go-version: '1.25'}
57+
with: {go-version: '1.26'}
5858
- name: 'Start PostgreSQL'
5959
run: |
6060
docker compose up pg18 -d --wait || {
@@ -80,7 +80,7 @@ jobs:
8080
# steps:
8181
# - uses: 'actions/checkout@v6'
8282
# - uses: 'actions/setup-go@v6'
83-
# with: {go-version: '1.25'}
83+
# with: {go-version: '1.26'}
8484
# - name: 'Start PostgreSQL'
8585
# run: |
8686
# docker compose up pg18 -d --wait || {
@@ -107,7 +107,7 @@ jobs:
107107
# fail-fast: false
108108
# matrix:
109109
# pg: ['18']
110-
# go: ['1.18', '1.25']
110+
# go: ['1.18', '1.26']
111111
# steps:
112112
# - uses: 'actions/checkout@v6'
113113
# - uses: 'douglascamata/setup-docker-macos-action@v1'
@@ -138,9 +138,9 @@ jobs:
138138
# strategy:
139139
# fail-fast: false
140140
# matrix:
141-
# #go: ['1.18', '1.25']
141+
# #go: ['1.18', '1.26']
142142
# pg: ['18']
143-
# go: ['1.25']
143+
# go: ['1.26']
144144
# steps:
145145
# - uses: 'actions/checkout@v6'
146146
# - uses: 'Vampire/setup-wsl@v6'

array.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ FoundType:
388388
func (a GenericArray) Scan(src any) error {
389389
dpv := reflect.ValueOf(a.A)
390390
switch {
391-
case dpv.Kind() != reflect.Ptr:
391+
case dpv.Kind() != reflect.Pointer:
392392
return fmt.Errorf("pq: destination %T is not a pointer to array or slice", a.A)
393393
case dpv.IsNil():
394394
return fmt.Errorf("pq: destination %T is nil", a.A)

conn.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ func (cn *conn) CheckNamedValue(nv *driver.NamedValue) error {
831831
return driver.ErrSkip
832832
}
833833
t := v.Type()
834-
for t.Kind() == reflect.Ptr {
834+
for t.Kind() == reflect.Pointer {
835835
t, v = t.Elem(), v.Elem()
836836
}
837837

encode_test.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"database/sql"
66
"fmt"
77
"regexp"
8+
"strings"
89
"testing"
910
"time"
1011

@@ -641,7 +642,7 @@ func TestTextByteSliceToInt(t *testing.T) {
641642
db := pqtest.MustDB(t)
642643

643644
expected := 12345678
644-
b := []byte(fmt.Sprintf("%d", expected))
645+
b := fmt.Appendf(nil, "%d", expected)
645646
row := db.QueryRow("SELECT $1::int", b)
646647

647648
var result int
@@ -879,21 +880,21 @@ func TestFormatAndParseTimestamp(t *testing.T) {
879880
}
880881

881882
func BenchmarkAppendEscapedText(b *testing.B) {
882-
longString := ""
883+
var longString strings.Builder
883884
for i := 0; i < 100; i++ {
884-
longString += "123456789\n"
885+
longString.WriteString("123456789\n")
885886
}
886887
for i := 0; i < b.N; i++ {
887-
appendEscapedText(nil, longString)
888+
appendEscapedText(nil, longString.String())
888889
}
889890
}
890891

891892
func BenchmarkAppendEscapedTextNoEscape(b *testing.B) {
892-
longString := ""
893+
var longString strings.Builder
893894
for i := 0; i < 100; i++ {
894-
longString += "1234567890"
895+
longString.WriteString("1234567890")
895896
}
896897
for i := 0; i < b.N; i++ {
897-
appendEscapedText(nil, longString)
898+
appendEscapedText(nil, longString.String())
898899
}
899900
}

error.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -564,10 +564,7 @@ func posToLine(pos int, lines []string) (line, col int) {
564564
line++
565565
ll := utf8.RuneCountInString(lines[i]) + 1 // +1 for the removed newline
566566
if read+ll >= pos {
567-
col = pos - read
568-
if col < 1 { // Should never happen, but just in case.
569-
col = 1
570-
}
567+
col = max(pos-read, 1) // Should be lower than 1, but just in case.
571568
break
572569
}
573570
read += ll

internal/pqtest/ztest.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ func NormalizeIndent(in string) string {
8282
indent++
8383
}
8484

85-
r := ""
85+
var r strings.Builder
8686
for _, line := range strings.Split(in, "\n") {
87-
r += strings.Replace(line, "\t", "", indent) + "\n"
87+
r.WriteString(strings.Replace(line, "\t", "", indent) + "\n")
8888
}
8989

90-
return strings.TrimSpace(r)
90+
return strings.TrimSpace(r.String())
9191
}

0 commit comments

Comments
 (0)