writable

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package writable checks, before any work is done, that a file can be saved.

Index

Constants

This section is empty.

Variables

View Source
var ErrReadOnly = errors.New("read-only")

ErrReadOnly is wrapped by the error Check returns when the file, or the folder it is saved through, can't be written.

Functions

func Check

func Check(file string) error

Check reports whether file can be saved: opened for writing, and replaced through a temporary file in its folder, as mdsh saves. It tries both rather than reading mode bits, so ownership, ACLs, a read-only folder and a read-only file system all count. If file doesn't exist, only its folder counts. The error wraps ErrReadOnly when permission is what stops it.

Types

type Error

type Error struct {
	File string
	Err  error
}

Error says file can't be saved, and why.

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() []error

Jump to

Keyboard shortcuts

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