AIX 7.2 TL3, Go version 1.14.2:
# oslevel -s
7200-03-02-1846
# rpm -qa | grep golang
golang-1.14.2-1.ppc
golang-src-1.14.2-1.noarch
golang-bin-1.14.2-1.ppc
Very simple example with os.OpenFile() and Sync():
package main
import (
"fmt"
"os"
)
func main() {
f, err := os.OpenFile("/tmp/1", os.O_RDONLY, 0644)
if err != nil {
fmt.Printf("os.OpenFile: %s\n", err)
return
}
defer f.Close()
err = f.Sync()
if err != nil {
fmt.Printf("os.Sync(): %s\n", err)
pe, ok := err.(*os.PathError)
if ok {
fmt.Printf("Op: %s, Path: %s, Err: %v\n", pe.Op, pe.Path, pe.Err)
} else {
fmt.Printf("not ok to PathError\n")
}
}
}
No Problems on Linux and Mac OS X, but on AIX:
os.Sync(): sync /tmp/1: bad file number
Op: sync, Path: /tmp/1, Err: bad file number
I think, sync() is quite usual function and should work ;-)
------------------------------
Andrey Klyachkin
------------------------------