Skip to content

Commit 2cefa07

Browse files
committed
Fix linux build: replace removed syscall.Fadvise with unix.Fadvise
syscall.Fadvise was removed in Go 1.26. Use golang.org/x/sys/unix instead.
1 parent b09669f commit 2cefa07

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ require (
77
github.com/modelcontextprotocol/go-sdk v1.4.0
88
github.com/zeebo/xxh3 v1.1.0
99
golang.org/x/sync v0.19.0
10+
golang.org/x/sys v0.40.0
1011
gopkg.in/yaml.v3 v3.0.1
1112
)
1213

@@ -17,5 +18,4 @@ require (
1718
github.com/segmentio/encoding v0.5.3 // indirect
1819
github.com/yosida95/uritemplate/v3 v3.0.2 // indirect
1920
golang.org/x/oauth2 v0.34.0 // indirect
20-
golang.org/x/sys v0.40.0 // indirect
2121
)

internal/pipeline/prefetch_linux.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ package pipeline
44

55
import (
66
"os"
7-
"syscall"
7+
8+
"golang.org/x/sys/unix"
89
)
910

1011
func advisePrefetch(f *os.File) {
@@ -13,5 +14,5 @@ func advisePrefetch(f *os.File) {
1314
return
1415
}
1516
// POSIX_FADV_WILLNEED = 3: advise kernel to read file into page cache
16-
_ = syscall.Fadvise(int(f.Fd()), 0, fi.Size(), 3)
17+
_ = unix.Fadvise(int(f.Fd()), 0, fi.Size(), unix.FADV_WILLNEED)
1718
}

0 commit comments

Comments
 (0)