osutil

package
v0.0.0-...-9d39026 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 8, 2024 License: Unlicense Imports: 2 Imported by: 0

Documentation

Overview

Package osutil contains utilities for functions requiring system calls and other OS-specific APIs. OS-specific network handling should go to github.com/AdguardTeam/golibs/netutil instead.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func RootDirFS

func RootDirFS() (fsys fs.FS)

RootDirFS returns a filesystem rooted at the system's root directory.

Example
package main

import (
	"fmt"

	"github.com/Potterli20/golibs-fork/osutil"
)

func main() {
	fsys := osutil.RootDirFS()

	d, err := fsys.Open(".")
	if err != nil {
		fmt.Printf("opening: %v\n", err)

		return
	}

	fi, err := d.Stat()
	if err != nil {
		fmt.Printf("getting info: %v\n", err)

		return
	}

	fmt.Printf("is dir: %t\n", fi.IsDir())

	err = d.Close()
	if err != nil {
		fmt.Printf("closing: %v\n", err)

		return
	}

}
Output:

is dir: true

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL