util

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2025 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Deref

func Deref[T any](v *T, or T) T

func PatchKeepWhitespace added in v0.6.0

func PatchKeepWhitespace(original, modified []byte) ([]byte, error)

patchKeepWhitespace applies changes while ignoring whitespace changes. Used as the YAML libraries trims away the whitespace, so this function translates the changes from patches while ignoring whitespace trimming.

Based on: [https://github.com/mikefarah/yq/issues/515#issuecomment-1574420861]

Effectively doing:

cat "$modified_file" | diff -Bw "$original" - | patch "$original" -

Note that this approach is not 100% and does not work when the edits are surrounded by whitespace. Instead, this only preserves the whitespace unaffected by the edits.

func Ref

func Ref[T any](v T) *T

func ToCamelCase

func ToCamelCase(s string) string

ToCamelCase is a very stupid implementation for converting PascalCase to camelCase.

NOTE: If we need to convert user-provided strings to camelCase, then we should replace this with the community strcase package.

Types

This section is empty.

Jump to

Keyboard shortcuts

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