A lightweight Go utility package providing enhanced primitive types and common helpers, inspired by Python’s typing and standard library behavior.
typing focuses on small, composable, well-defined types that make everyday Go code safer and more expressive, without becoming a full framework.
- Size – Byte size type (KB / MB / GB) with parsing and formatting
- Str – Extended string helpers (length, conversion, comparison)
- Zero dependencies
- Idiomatic Go API design
go get github.com/wrongfuldev/typingSize represents a byte size with human-friendly parsing and formatting.
- B
- KB
- MB
- GB
- TB
- PB
import "github.com/wrongfuldev/typing"
var s typing.Size
_ = s.UnmarshalText([]byte("10MB"))
fmt.Println(s) // 10MB
fmt.Println(int64(s)) // 10485760_ = json.Unmarshal([]byte(`"512KB"`), &s)
fmt.Println(s.String()) // 512KBStr is a thin wrapper around string providing convenient helpers.
var s typing.Str = "HelloWorld"
fmt.Println(s.Len()) // 10
fmt.Println(s.Equals("x")) // false
fmt.Println(s.ToBytes())
fmt.Println(s.ToRunes())- Minimalism – Small surface area, no magic
- Predictability – No hidden behavior
- Composability – Works well with standard library
- Stability – API changes are conservative
This project follows Semantic Versioning:
- v0.x – API may change
- v1.0.0+ – Backward compatible guarantees
MIT License
Issues and pull requests are welcome. Please keep changes small, focused, and well-tested.
Happy hacking ✨