Where are chflags system call flags constants are defined?
import "syscall"
...
flags := ???
err := syscall.Chflags("filename", flags)
In C language these constants are defined in sys/stat.h or unistd.h:
- UF_NODUMP
- UF_IMMUTABLE
- UF_APPEND
- UF_OPAQUE
- UF_HIDDEN
- SF_ARCHIVED
- SF_IMMUTABLE
- SF_APPEND
- SF_DATALESS
Where these constants in Go?
golang.org/x/sys/unix
, and you can look there to see if they have been generated as part of the package. If not, you must assign the values yourself (or shell out tochflags
on the cli, which is what most implementations do)syscall
, which defines a minimal subset of syscall wrappers and constants—like those you're after,—but this subset is defined by the needs of the other standard library packages and the runtime. (Also, this package is highly GOOS/GOARCH-dependent.) Many other syscalls and related symbols found on Unix-like systems are indeed defined in golang.org/x/sys/unix, but not all possible. In case you need something not defined, just see how they are defined in the C code native to your platform and define your own symbols.