util

package
v0.0.0-...-19ddb5a Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeepHashObject

func DeepHashObject(obj interface{}) (string, error)

DeepHashObject writes specified object to hash using the spew library which follows pointers and prints actual values of the nested objects ensuring the hash does not change when a pointer changes.

func FSToTarGZ

func FSToTarGZ(w io.Writer, fsys fs.FS) error

FSToTarGZ writes the filesystem represented by fsys to w as a gzipped tar archive. This function unsets user and group information in the tar archive so that readers of archives produced by this function do not need to account for differences in permissions between source and destination filesystems.

func MergeMaps

func MergeMaps(maps ...map[string]string) map[string]string

Types

type FilesOnlyFilesystem

type FilesOnlyFilesystem struct {
	FS fs.FS
}

FilesOnlyFilesystem is an fs.FS implementation that treats non-regular files (e.g. directories, symlinks, devices, etc.) as non-existent. The reason for this is so that we only serve bundle files.

This treats directories as not found so that the http server does not serve HTML directory index responses.

This treats other symlink files as not found so that we prevent HTTP requests from escaping the filesystem root.

Lastly, this treats other non-regular files as not found because they are out of scope for serving bundle contents.

func (*FilesOnlyFilesystem) Open

func (f *FilesOnlyFilesystem) Open(name string) (fs.File, error)

Jump to

Keyboard shortcuts

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