https://github.com/koddr/go-errorify
💎 The understandable zero-dependencies multilingual error wrapper for your Go (Golang) apps or CLI.
https://github.com/koddr/go-errorify
anci-color cli error-handling go golang golang-library golang-package
Last synced: 7 months ago
JSON representation
💎 The understandable zero-dependencies multilingual error wrapper for your Go (Golang) apps or CLI.
- Host: GitHub
- URL: https://github.com/koddr/go-errorify
- Owner: koddr
- License: mit
- Created: 2019-12-06T22:57:09.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-12-13T21:41:29.000Z (about 6 years ago)
- Last Synced: 2025-04-29T19:58:58.750Z (9 months ago)
- Topics: anci-color, cli, error-handling, go, golang, golang-library, golang-package
- Language: Go
- Homepage:
- Size: 37.1 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 💎 go-errorify
[](https://godoc.org/github.com/koddr/go-errorify)
The understandable zero-dependencies multilingual error wrapper for your Go (Golang) apps or CLI.
## Requirements
- Go `1.11+`
- Go Modules
## Install
```console
go get -u github.com/koddr/go-errorify
```
### Tests & Coverage
```console
go test -cover github.com/koddr/go-errorify
# OR
make
```
## How to use go-errorify?
```go
package main
import (
"github.com/koddr/go-errorify"
"os"
)
func main() {
// Start creating file
file, err := os.Create("./folder/file_1.txt")
// Checking error
errorify.Simple(err)
// Close file after finish
defer file.Close()
// ...
}
```
If something went wrong (no such file or directory), output is:
```console
✘ Error: open ./folder/file_1.txt: no such file or directory
```

## How to switch language?
```go
package main
import (
"github.com/koddr/go-errorify"
// ...
)
func init() {
// Init your app with errors on Russian language
errorify.Language = "ru_RU"
}
func main() {
// ...
// If you want to print other errors on another lang,
// just switch it:
errorify.Language = "es_ES"
// ...
}
```
### Language support
🇺🇸 English (`en_EN`, by default), 🇷🇺 Russian (`ru_RU`), 🇪🇸 Español (`es_ES`), ...
## Developers
- Idea and active development by [Vic Shóstak](https://github.com/koddr) (aka Koddr).
## Project assistance
If you want to say «thank you» or/and support active development `go-errorify`:
1. Add a GitHub Star to project.
2. Twit about project [on your Twitter](https://twitter.com/intent/tweet?text=A%20dead%20simple%20zero-dependencies%20%23multilingual%20error%20wrapper%20for%20your%20Go%20%28%40Golang%29%20apps%20or%20%23CLI%20%F0%9F%91%8D%20https%3A%2F%2Fgithub.com%2Fkoddr%2Fgo-errorify).
3. Donate some money to project author via PayPal: [@paypal.me/koddr](https://paypal.me/koddr?locale.x=en_EN).
4. Join DigitalOcean at our [referral link](https://m.do.co/c/b41859fa9b6e) (your profit is **$100** and we get $25).
Thanks for your support! 😘 Together, we make this project better every day.
## License
MIT