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/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
fail-fast: false
matrix:
pg: ['14', '15', '16', '17', '18']
go: ['1.21', '1.25']
go: ['1.21', '1.26']
steps:
- uses: 'actions/checkout@v6'
- uses: 'actions/setup-go@v6'
Expand All @@ -54,7 +54,7 @@ jobs:
steps:
- uses: 'actions/checkout@v6'
- uses: 'actions/setup-go@v6'
with: {go-version: '1.25'}
with: {go-version: '1.26'}
- name: 'Start PostgreSQL'
run: |
docker compose up pg18 -d --wait || {
Expand All @@ -80,7 +80,7 @@ jobs:
# steps:
# - uses: 'actions/checkout@v6'
# - uses: 'actions/setup-go@v6'
# with: {go-version: '1.25'}
# with: {go-version: '1.26'}
# - name: 'Start PostgreSQL'
# run: |
# docker compose up pg18 -d --wait || {
Expand All @@ -107,7 +107,7 @@ jobs:
# fail-fast: false
# matrix:
# pg: ['18']
# go: ['1.18', '1.25']
# go: ['1.18', '1.26']
# steps:
# - uses: 'actions/checkout@v6'
# - uses: 'douglascamata/setup-docker-macos-action@v1'
Expand Down Expand Up @@ -138,9 +138,9 @@ jobs:
# strategy:
# fail-fast: false
# matrix:
# #go: ['1.18', '1.25']
# #go: ['1.18', '1.26']
# pg: ['18']
# go: ['1.25']
# go: ['1.26']
# steps:
# - uses: 'actions/checkout@v6'
# - uses: 'Vampire/setup-wsl@v6'
Expand Down
2 changes: 1 addition & 1 deletion array.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ FoundType:
func (a GenericArray) Scan(src any) error {
dpv := reflect.ValueOf(a.A)
switch {
case dpv.Kind() != reflect.Ptr:
case dpv.Kind() != reflect.Pointer:
return fmt.Errorf("pq: destination %T is not a pointer to array or slice", a.A)
case dpv.IsNil():
return fmt.Errorf("pq: destination %T is nil", a.A)
Expand Down
2 changes: 1 addition & 1 deletion conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ func (cn *conn) CheckNamedValue(nv *driver.NamedValue) error {
return driver.ErrSkip
}
t := v.Type()
for t.Kind() == reflect.Ptr {
for t.Kind() == reflect.Pointer {
t, v = t.Elem(), v.Elem()
}

Expand Down
15 changes: 8 additions & 7 deletions encode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"database/sql"
"fmt"
"regexp"
"strings"
"testing"
"time"

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

expected := 12345678
b := []byte(fmt.Sprintf("%d", expected))
b := fmt.Appendf(nil, "%d", expected)
row := db.QueryRow("SELECT $1::int", b)

var result int
Expand Down Expand Up @@ -879,21 +880,21 @@ func TestFormatAndParseTimestamp(t *testing.T) {
}

func BenchmarkAppendEscapedText(b *testing.B) {
longString := ""
var longString strings.Builder
for i := 0; i < 100; i++ {
longString += "123456789\n"
longString.WriteString("123456789\n")
}
for i := 0; i < b.N; i++ {
appendEscapedText(nil, longString)
appendEscapedText(nil, longString.String())
}
}

func BenchmarkAppendEscapedTextNoEscape(b *testing.B) {
longString := ""
var longString strings.Builder
for i := 0; i < 100; i++ {
longString += "1234567890"
longString.WriteString("1234567890")
}
for i := 0; i < b.N; i++ {
appendEscapedText(nil, longString)
appendEscapedText(nil, longString.String())
}
}
5 changes: 1 addition & 4 deletions error.go
Original file line number Diff line number Diff line change
Expand Up @@ -564,10 +564,7 @@ func posToLine(pos int, lines []string) (line, col int) {
line++
ll := utf8.RuneCountInString(lines[i]) + 1 // +1 for the removed newline
if read+ll >= pos {
col = pos - read
if col < 1 { // Should never happen, but just in case.
col = 1
}
col = max(pos-read, 1) // Should be lower than 1, but just in case.
break
}
read += ll
Expand Down
6 changes: 3 additions & 3 deletions internal/pqtest/ztest.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ func NormalizeIndent(in string) string {
indent++
}

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

return strings.TrimSpace(r)
return strings.TrimSpace(r.String())
}
Loading