Skip to content

Commit

Permalink
Merge pull request #361 from TileDB-Inc/smr/update-go-1.22
Browse files Browse the repository at this point in the history
Update to Go 1.22.
  • Loading branch information
shaunrd0 authored Dec 18, 2024
2 parents f20011a + 1ede41e commit 8004151
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 17 deletions.
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

0 comments on commit 8004151

Please sign in to comment.