GithubHelp home page GithubHelp logo

gopherz

ezpkg.io

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

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 the introduction blog post.

If you have any questions or suggestions, feel free to create new issues, open pull requests, or post discussions.

Packages

Package Description
bytez Extends the standard library bytes with additional functions.
colorz Working with colors in terminal.
conveyz Extends the package convey and make it work with gomega.
diffz Comparing and displaying differences between two strings.
errorz Utilities for working with errors: Must, Validate, multi-errors, etc.
fmtz Extends the standard library fmt with additional functions.
mapz Extends the package golang.org/x/exp/maps.
slicez Extends the standard library slices with additional functions.
stacktracez Get stack trace for using in errors and logs.
stringz Extends the standard library strings with additional functions.
testingz Utilities for testing.
typez Generic functions for working with types.
unsafez Convert bytes to strings using unsafe pointer.

Installation

Download each package into your project using go get:

go get -u ezpkg.io/errorz
go get -u ezpkg.io/stringz
...

Versioning

All packages are released together with the same version number to simplify management, as they often call each other. When the API evolves, the version number is incremented for all packages.

  • Minor version v0.1.0v0.2.0: Add new features or functions. May introduce a couple of (breaking) API changes.
  • Patch version v0.1.0v0.1.1: Fix bugs or improve performance. May add new (small) functions.

Release Frequency: New versions are released periodically as new features are developed or bugs are fixed. All packages will have their versions updated at the same time.

NOTE: This project is in its early stages. While all packages are usable, the API may change over time.

Project Structure

ezpkg/ezpkg

The main repository that contains source code and tests of all packages.

ezpkg/PKGNAME

Each package code is copied from the main repository to its own repository. This setup allows for importing only the necessary packages into a project. To minimize dependencies, the tests are removed, ensuring that users only need to download the package code without including the testing packages.

Build and Test

Setup local environment

  • Create a root directory ezpkg_root.
  • Clone this repository to ezpkg_root/ezpkg.
  • Install direnv to load environment variables from .envrc.
mkdir ezpkg_root      # create a root directory
git clone https://github.com/ezpkg/ezpkg ezpkg_root/ezpkg
cd ezpkg_root/ezpkg
direnv allow

Test all packages

cd ezpkg_root/ezpkg
run testall

Generate all packages

The following commands will copy each package code to the ezpkg_root/ztarget directory.

cd ezpkg_root/ezpkg
run pkgall

FAQ

Why should I NOT use these packages?

  • More dependencies: These packages will add more dependencies to your project.
  • Early development: This project is in its early stages and will have API changes. There are other packages that are more mature and offer more features.
  • Customization: Sometimes, writing your own code allows for better customization. You can also copy code from these packages and modify it to fit your specific needs.

Why should I use these packages?

  • You find yourself copying the same code over and over.
  • You are starting a new project and want some simple and easy-to-use packages.
  • You are learning Go and want to see how some common tasks are implemented.

Where are the tests?

  • The tests are in the main repository ezpkg/ezpkg. You can run the tests for all packages using the run testall command.
  • In each package repository, the tests are removed to minimize dependencies.

Author

Oliver Nguyen  github

ezpkg.io's Projects

.github icon .github

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

bytez icon bytez

Extends the standard library bytes with additional functions.

colorz icon colorz

Utilities for working with colors in terminal.

conveyz icon conveyz

Package conveyz extends the package github.com/smartystreets/goconvey/convey and make it work with github.com/onsi/gomega.

diffz icon diffz

Comparing and displaying differences between two strings.

errorz icon errorz

Utilities for working with errors: Must, Validate, multi-errors, etc.

ezpkg icon ezpkg

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

fmtz icon fmtz

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

logz icon logz

Package logz provides common logging interfaces for package library, allows users provide their logging implementation..

mapz icon mapz

Extends the package golang.org/x/exp/maps for working with maps.

slicez icon slicez

Extends the standard library slices with additional functions.

stringz icon stringz

Extends the standard library strings with additional functions.

typez icon typez

Generic functions for working with types.

unsafez icon unsafez

Convert bytes to strings using unsafe pointer.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.