gommon

module
v0.0.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 18, 2020 License: MIT

README

Gommon - Go common libraries


gommon


GoDoc Build Status codecov Go Report Card loc FOSSA Status

Gommon is a collection of common util libraries written in Go.

  • errors error wrapping, inspection, multi error (error list), common error types
  • log per package logger with reasonable performance
  • noodle embed static assets for web application with .noodleignore support
  • generator render go template, generate methods for logger interface based on gommon.yml
  • util wrappers for standard libraries

It has little third party dependencies, only go-yaml/yaml in util/cast, go-shellquote in generator, other dependencies like cobra are only for cli, see go.mod.

Development

  • requires go1.12+. go1.11.x should work as well, the Makefile set GO111MODULE=on so you can use in GOPATH
  • make help
  • Directory layout

License

MIT

FOSSA Status

Contribution

Currently, gommon is in a very volatile state, please open issues after it becomes stable.

About

Gommon is inspired by many existing libraries, attribution and comparision can be found in doc/attribution.

Gommon was part of Ayi and split out for wider use. The name Gommon is suggested by @arrowrowe. The original blog post can be found in dongyue web's blog. Thanks all the folks in @dyweb especially @gaocegege for their support in early development.

Directories

Path Synopsis
cmd
gommon command
gommon is the commandline util for generator
gommon is the commandline util for generator
Package errors provides multi error, wrapping and inspection.
Package errors provides multi error, wrapping and inspection.
errortype
Package errortype defines helper for inspect common error types generated in standard library, so you don't need to import tons of packages in your file for sentinel error and custom error type.
Package errortype defines helper for inspect common error types generated in standard library, so you don't need to import tons of packages in your file for sentinel error and custom error type.
Package generator render go template, call external commands, generate gommon specific methods based on gommon.yml
Package generator render go template, call external commands, generate gommon specific methods based on gommon.yml
Package httpclient is a high level wrapper around net/http with more types and easier to use interface TODO: ref https://github.com/bradfitz/exp-httpclient
Package httpclient is a high level wrapper around net/http with more types and easier to use interface TODO: ref https://github.com/bradfitz/exp-httpclient
log
Package log provides structured logging with fine grained control over packages using logger registry TODO: add convention and usage
Package log provides structured logging with fine grained control over packages using logger registry TODO: add convention and usage
handlers/cli
Package cli generates human readable text with color and display time in delta.
Package cli generates human readable text with color and display time in delta.
handlers/json
Package json writes log in JSON format, it escapes string in json based encoding/json, It does not use encoding/json directly because all the fields have known type
Package json writes log in JSON format, it escapes string in json based encoding/json, It does not use encoding/json directly because all the fields have known type
logx
Package logx is extension for log package
Package logx is extension for log package
Package noodle helps embedding static assets into go binary, it supports using ignore file
Package noodle helps embedding static assets into go binary, it supports using ignore file
_examples/embed command
_examples/local command
Package playground is used for testing out issues and language features
Package playground is used for testing out issues and language features
issue_noodle_50 command
for i, ele := range slice is reusing same struct https://github.com/dyweb/gommon/issues/50
for i, ele := range slice is reusing same struct https://github.com/dyweb/gommon/issues/50
util
cast
Package cast convert types safely and drop incompatible types during conversion it is inspired by https://github.com/spf13/cast
Package cast convert types safely and drop incompatible types during conversion it is inspired by https://github.com/spf13/cast
color
Package color defines color code for pretty print in linux shell, windows is not supported
Package color defines color code for pretty print in linux shell, windows is not supported
envutil
Package envutil wraps environment variable related operations
Package envutil wraps environment variable related operations
fsutil
Package fsutil adds ignore support for walk
Package fsutil adds ignore support for walk
genutil
Package genutil contains helper when generating files, it is used to break dependency cycle between generator package and packages that contain generator logic like log, noodle
Package genutil contains helper when generating files, it is used to break dependency cycle between generator package and packages that contain generator logic like log, noodle
hashutil
Package hashutil provides alloc free alternatives for pkg/hash
Package hashutil provides alloc free alternatives for pkg/hash
httputil
Package httputil provides helper for net/http, i.e.
Package httputil provides helper for net/http, i.e.
maputil
Package maputil provides wrapper for common map operations like merge, get keys, Only map[string]string is supported
Package maputil provides wrapper for common map operations like merge, get keys, Only map[string]string is supported
runtimeutil
Package runtimeutil provides wrapper to get caller, stack etc.
Package runtimeutil provides wrapper to get caller, stack etc.
testutil
Package testutil defines helper functions that fails test instead of return error
Package testutil defines helper functions that fails test instead of return error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL