I am trying to get file permission bits in Octal representation. The below code prints it as string. Is there an API to print in Octal or int?
import "os"
import "fmt"
func main() {
m, _ := os.Stat("test.go")
perm := m.Mode().Perm()
fmt.Println(perm)
}
$:~/gocode/ws/gocode$ go run perm.go
-rw-rw-r--
@:~/gocode/ws/gocode$