Standard library / io/fs

fs.FileMode.IsDir()

Reports whether the directory bit is set. Expected stdout: 'true false\n'.

Formal Syntax & Structure

go syntaxgo
func (m FileMode) IsDir() bool

Return Value

bool

Reports whether the directory bit is set.

Working Example

Example Snippetgo
package main
import (  "fmt"  "io/fs")
func main() { fmt.Println((fs.ModeDir | 0755).IsDir(), fs.FileMode(0644).IsDir()) }
Go Reference