{"repo":"ggwhite/go-masker","free":true,"listed":false,"github":"https://github.com/ggwhite/go-masker","clone":"git clone https://github.com/ggwhite/go-masker.git","description":"Go library for masking sensitive data via struct tags — passwords, emails, IDs, credit cards, and more","language":"Go","stars":127,"topics":["go","golang","data-protection","go-library","masking","pii","privacy","security","sensitive-data","struct-tags"],"license":"MIT","category":"security-tools","readme_excerpt":"Go Masker Go Masker is a simple and extensible library for masking sensitive data in Go structs. Use struct tags to control how fields are masked — passwords, emails, IDs, credit cards, and more. Looking for v2? See the release/v2 branch. Install Requires Go 1.22+. Quick Start You can also use the package-level default instance: Sensitive[T] — Type-Safe Masking Sensitive[T] wraps a value so that all automatic output (fmt, JSON, slog) is masked. You must call .Reveal() to get the original value — leaking data requires an explicit opt-in. Built-in constructors: NewPhone , NewEmail , NewPassword , NewID , NewCredit , NewName , NewAddress , NewTel , NewURL . Redact Mode For compliance scenarios where partial masking is not enough: Database Integration Sensitive[T] implements sql.Scanner and driver.Valuer , so it works directly with GORM and other ORMs: - Value() returns the original value (DB stores plaintext) - Scan(nil) sets to zero value without panic Format — Log-Friendly Output Format() returns a deterministic masked string without allocating a new struct — ideal for logging and debugging: - Pointer-to-struct fields are expanded as &{...} (no memory address) - nil pointers display as - Output is deterministic — same input always produces the same string Masker Types Tag Description Example Input Example Output ----------- -------------------------------- -------------------------------- ------------------------------- none No masking, return as-is foo foo password Always ret","default_branch":null,"files":null,"tree":[],"storefront":"/r/ggwhite","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/ggwhite/go-masker/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}