Help us shape the future of Go! Take the 2026 Go Developer Survey

fsutil

package
v0.17.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package fsutil holds small filesystem helpers shared across the CLI.

Index

Constants

View Source
const SecretDirMode os.FileMode = 0o700

SecretDirMode is the permission used for parent directories created on demand by WriteSecret.

View Source
const SecretFileMode os.FileMode = 0o600

SecretFileMode is the permission every file holding key material, passwords or tokens ends up with.

Variables

This section is empty.

Functions

func WriteSecret

func WriteSecret(path string, data []byte) error

WriteSecret atomically writes data to path with mode 0600.

Unlike os.WriteFile, the resulting mode does not depend on whether the file already existed (os.WriteFile keeps an existing file's permissions) or on the process umask. The data is written to a temp file in the same directory, synced, chmod'ed to 0600 and renamed over the target, so readers never observe a partially written file. Missing parent directories are created with mode 0700; existing ones are left as-is.

Types

This section is empty.

Jump to

Keyboard shortcuts

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