🏃 10 Golang Libraries Useful In 2023
4 min readDec 1, 2023
Debug, command line, tools. You’re here for a treat of some really nice Go libraries!
The standard library of Go lamguage is pretty nice. Usually you don’t need any libraries to get by.
But for some cases there’s a need for a library. Today I’ll share with you 10 Go libraries I find useful:
1. cmp
This package is intended to be a more powerful and safer alternative to reflect.DeepEqual for comparing whether two values are semantically equal. It is intended to only be used in tests, as performance is not a goal and it may panic if it cannot compare the values.
Example:
// This Transformer sorts a []int.
trans := cmp.Transformer("Sort", func(in []int) []int {
out := append([]int(nil), in...) // Copy input to avoid mutating it
sort.Ints(out)
return out
})
x := struct{ Ints []int }{[]int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}}
y := struct{ Ints []int }{[]int{2, 8, 0, 9, 6, 1, 4, 7, 3, 5}}
z := struct{ Ints []int }{[]int{0, 0, 1, 2, 3, 4, 5, 6, 7, 8}}
fmt.Println(cmp.Equal(x, y, trans))
fmt.Println(cmp.Equal(y, z, trans))
fmt.Println(cmp.Equal(z, x, trans))
2. protobuf
This project hosts the Go…