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

redact

package
v0.51.0 Latest Latest
Warning

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

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

Documentation

Overview

Package redact masks well-known credential-shaped field names before a value is handed to a logger. It is deliberately conservative: only keys whose name indicates a credential are masked, and the original value is never mutated. Callers that log user data should route it through Map first; callers that log their own internal state do not need to.

Index

Constants

View Source
const Placeholder = "[REDACTED]"

Placeholder is the value every masked field becomes. It is exported so tests and downstream sinks can recognize a redacted field without guessing the format.

Variables

This section is empty.

Functions

func Map

func Map(m map[string]any) map[string]any

Map returns a shallow copy of m with credential-shaped values masked. Nested maps and slices are redacted recursively. The input is not mutated; callers can log the result and keep using the original.

Types

This section is empty.

Jump to

Keyboard shortcuts

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