Standard library / io/fs

fs.FileMode.Perm()

Extracts the nine Unix permission bits, excluding all file type and special mode bits. Expected stdout: '0755\n'.

Formal Syntax & Structure

go syntaxgo
func (m FileMode) Perm() FileMode

Return Value

FileMode

Extracts the nine Unix permission bits, excluding all file type and special mode bits.

Working Example

Example Snippetgo
package main
import (  "fmt"  "io/fs")
func main() { fmt.Printf("%#o\n", (fs.ModeDir | 0755).Perm()) }
Go Reference