A Go library for removing personally identifiable information (PII) from text data.
This project follows standard Go package conventions:
deidentify/
├── deidentify.go # Main package implementation
├── deidentify_test.go # Package tests
├── examples/ # Example usages
│ ├── basic/
│ │ └── main.go # Simple text deidentification example
│ └── table/
│ └── main.go # Table-based deidentification example
└── go.mod # Module definition
The package provides functions to detect and redact PII from text. It can be imported and used in your Go applications:
import "github.com/aliengiraffe/deidentify"See the examples directory for detailed usage patterns.
This package follows Go's design philosophy:
- Simplicity: The API is designed to be simple and intuitive
- Composability: Functions can be combined to create custom deidentification pipelines
- Efficiency: Optimized for performance with minimal allocations
- Error handling: Uses Go's standard error patterns for robust error reporting
The package exposes types and functions following Go's idiomatic practices:
Deidentifier: Interface for objects that can identify and redact PIIOption: Functional options for configuring deidentification behavior
New(options ...Option) *Deidentifier: Creates a new deidentifier with specified optionsDeidentify(text string) (string, error): Processes text, returning a deidentified versionDeidentifyBytes(data []byte) ([]byte, error): Processes byte data for binary-safe operations
When contributing to this project, follow these practices:
-
Use
gofmtto format all code -
Write tests for all new functionality
-
Follow Effective Go guidelines:
- Meaningful variable names
- Proper error handling with descriptive error messages
- Concise documentation with examples
- Implementation of standard interfaces where appropriate
-
Use idiomatic Go patterns:
- Return errors rather than using
panic - Use composition over inheritance
- Make zero values useful
- Return errors rather than using
Run the test suite with:
go test
For more verbose output:
go test -v
The library includes multiple examples to demonstrate different usage patterns:
Simple text deidentification of strings and specific PII types:
go run examples/basic/main.go
Comprehensive example for deidentifying structured data in tables:
go run examples/table/main.go
[License details here]