package osutil

import "codeberg.org/anaseto/goal/internal/osutil"

Index

Functions

func ReadFile

func ReadFile(name string) (string, error)

ReadFile is like os.ReadFile but returns efficiently a string.

func ReadFileSize

func ReadFileSize(f *os.File, size int) (string, error)

ReadFileSize is similar to os.ReadFile, but we redefine it here to avoid an extra Stat call (just one to know both file size and whether it is a directory). NOTE: it will only matter for very small files in practice, so maybe not really worth it, but as it's mostly a simple copy-paste, it should be correct.

Source Files

read.go

Version
v1.2.0 (latest)
Published
Mar 23, 2025
Platform
linux/amd64
Imports
3 packages
Last checked
4 hours ago

Tools for package owners.