Standard library / io/fs

fs.FileMode.IsRegular()

Reports whether none of the file type bits are set; permission bits do not affect this test. Expected stdout: 'true false\n'.

Formal Syntax & Structure

go syntaxgo
func (m FileMode) IsRegular() bool

Return Value

bool

Reports whether none of the file type bits are set; permission bits do not affect this test.

Working Example

Example Snippetgo
package main
import (  "fmt"  "io/fs")
func main() { fmt.Println(fs.FileMode(0644).IsRegular(), fs.ModeSymlink.IsRegular()) }
Go Reference