Skip to content
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

Update to Go 1.22. #361

Merged
merged 2 commits into from
Dec 18, 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
6 changes: 3 additions & 3 deletions .github/workflows/tiledb-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
strategy:
matrix:
# Will be checking following versions
go: ["1.20", "1.21", "1.22", "1.23"]
go: ["1.22", "1.23"]
steps:

# Checks out repository
Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:
strategy:
matrix:
# Will be checking following versions
go: ["1.20", "1.21", "1.22", "1.23"]
go: ["1.22", "1.23"]
steps:
# Checks out repository
- uses: actions/checkout@v4
Expand Down Expand Up @@ -111,7 +111,7 @@ jobs:
strategy:
matrix:
# Will be checking following versions
go: ["1.20", "1.21", "1.22", "1.23"]
go: ["1.22", "1.23"]
steps:
# Checks out repository
- uses: actions/checkout@v4
Expand Down
15 changes: 2 additions & 13 deletions buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,7 @@ func (b *Buffer) ReadAt(p []byte, off int64) (int, error) {
}

availableBytes := uint64(csize) - uint64(off)
var sizeToRead int
if availableBytes > math.MaxInt {
sizeToRead = math.MaxInt
} else {
sizeToRead = int(availableBytes)
}
sizeToRead := min(math.MaxInt, int(availableBytes))

readSize := copy(p, unsafe.Slice((*byte)(unsafe.Pointer(uintptr(cbuffer)+uintptr(off))), sizeToRead))

Expand Down Expand Up @@ -171,13 +166,7 @@ func (b *Buffer) WriteTo(w io.Writer) (int64, error) {
// Because io.Writer supports writing up to 2GB of data at a time, we have to use a loop
// for the bigger buffers.
for remaining > 0 {
// TODO: Use min on Go 1.21+
var writeSize int
if remaining > math.MaxInt {
writeSize = math.MaxInt
} else {
writeSize = int(remaining)
}
writeSize := min(math.MaxInt, int(remaining))

// Construct a slice from the buffer's data without copying it.
n, err := w.Write(unsafe.Slice((*byte)(unsafe.Pointer(uintptr(cbuffer)+uintptr(csize)-uintptr(remaining))), writeSize))
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ require (
// Local triggered panic when referencing enums
retract v0.30.1

go 1.20
go 1.22
Loading