gopherz

Collection of packages and tools to make writing Go code easier.

List Packages View Repository

Introduction

As I work on various Go projects, I often find myself creating utility functions, extending existing packages, or developing packages to solve specific problems. Moving from one project to another, I usually have to copy or rewrite these solutions. So I created this repository to have all these utilities and packages in one place. Hopefully, you'll find them useful as well.

These packages aim to enhance the functionality of the standard library and other popular packages. They are intended to be used together with other packages rather than replacing them. The APIs are designed based on my experience working with Go, focusing on simplicity and ease of use. I will try to follow best practices in Go, but not always. I also tend to choose a more performance implementation if possible.

Read More

ezpkg.io/iterz

godoc   source

ezpkg.io/iterz

Package iterz extends the standard library iter with additional functions.

Features

Currently, it provides the following functions:

  • Nil[V]() iter.Seq[V]: returns an iterator that yields nothing.
  • Nil2[K, V]() iter.Seq2[K, V]: returns an iterator that yields nothing.
// Nil return an iter.Seq that yields nothing.
func Nil[V any]() iter.Seq[V] {
	return func(yield func(V) bool) {}
}

// Nil2 return an iter.Seq2 that yields nothing.
func Nil2[K, V any]() iter.Seq2[K, V] {
	return func(yield func(K, V) bool) {}
}