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.
This commit is contained in:
Martin Vogel
2026-03-06 18:09:41 +01:00
parent da2d969aa3
commit 68fbfa4bee
2 changed files with 4 additions and 3 deletions
+1 -1
View File
@@ -7,6 +7,7 @@ require (
github.com/modelcontextprotocol/go-sdk v1.4.0
github.com/zeebo/xxh3 v1.1.0
golang.org/x/sync v0.19.0
golang.org/x/sys v0.40.0
gopkg.in/yaml.v3 v3.0.1
)
@@ -17,5 +18,4 @@ require (
github.com/segmentio/encoding v0.5.3 // indirect
github.com/yosida95/uritemplate/v3 v3.0.2 // indirect
golang.org/x/oauth2 v0.34.0 // indirect
golang.org/x/sys v0.40.0 // indirect
)
+3 -2
View File
@@ -4,7 +4,8 @@ package pipeline
import (
"os"
"syscall"
"golang.org/x/sys/unix"
)
func advisePrefetch(f *os.File) {
@@ -13,5 +14,5 @@ func advisePrefetch(f *os.File) {
return
}
// POSIX_FADV_WILLNEED = 3: advise kernel to read file into page cache
_ = syscall.Fadvise(int(f.Fd()), 0, fi.Size(), 3)
_ = unix.Fadvise(int(f.Fd()), 0, fi.Size(), unix.FADV_WILLNEED)
}