This repository contains utility functions that do not make sense in other packages.

Installation

go get github.com/IQ-tech/go-utils

Executing code before process exits

AtInterruption receives a function that will be called once before the process exits.
AtInterruption can be called many times with different functions and each function will be called once.

utils.AtInterruption(func() {
	log.Printf("Closing DB Connection.")
	db.Close()

	log.Printf("Shutting down New Relic application.")
	nrl.Shutdown(5 * time.Second)
})

Logging and terminating the process on error

EndAsErr will log the error message and terminate the process if err is not nil

func main() {
	di := setup.Start()
	err := server.Start(di)
	utils.EndAsErr(err, "Could not start the server.", di.Log.InfoWriter(), di.Log.ErrorWriter())
}
Similar Resources

Ghissue - This repo contains a github issue parser, that is useful for Enterprise Github accounts.

Ghissue - This repo contains a github issue parser, that is useful for Enterprise Github accounts. Sometimes is needed to parse the content of the issue for some data extraction or statistics purposes.

Feb 6, 2022

Command not found? Install it right there!

Command not found? Install it right there!

Tii On most GNU/Linux systems, when a command is not found, a message showing what can be run to install the command is printed.

Aug 10, 2022

A command-line tool that uses a fake AI neural network to tell whether or not Ben is sus

Is ben sus? Let's use an AI neural network, trained by his own tweets to figure out. A command-line tool that uses a fake AI neural network to tell wh

Jan 7, 2022

Gostall - Run go install ./cmd/server and not have the binary install in your GOBIN be called server?

GOSTALL Ever wanted to run go install ./cmd/server and not have the binary insta

Jan 7, 2022

go program that installs and customizes ohmyzsh tmux vim via various plugins and other nice to haves

go program that installs and customizes ohmyzsh tmux vim via various plugins and other nice to haves

Pimp-My-Shell Table of Contents Pimp-My-Shell Install Usage About Resources Tmux Hotkeys VIM Hotkeys Adjusting Custom Aliases Mac Fix Terminal bind ke

Dec 22, 2022

A Go package for converting RGB and other color formats/colorspaces into DMC thread colors (DMC color name and floss number)

go-c2dmc A Go package for converting RGB and other color formats/colorspaces into DMC thread colors (DMC color name and floss number). Implemented as

Jul 25, 2022

Command-line program to download videos from YouTube.com and other video sites

youtube-dl - download videos from youtube.com or other video platforms INSTALLATION DESCRIPTION OPTIONS CONFIGURATION OUTPUT TEMPLATE FORMAT SELECTION

Jan 9, 2023

An os/exec like interface for running a command in a container, and being able to easily interact with stdin, stdout, and other adjustments

dockerexec An "os/exec" like interface for running a command in a container, and being able to easily interact with stdin, stdout, and other adjustmen

Jul 14, 2022

JOB, make your short-term command as a long-term job. 将命令行规划成任务的工具

job make your short-term command as a long-term job Install Shell Install (Linux & MacOS) # binary will be $(go env GOPATH)/bin/job $: curl -sfL https

Nov 12, 2022
This repository contains gRPC server and client

link Данный репозиторий содержит gRPC сервер и клиент. Запуск Сервер Сервер офор

Dec 20, 2021
This repository contains example apps created using GoCondor framework

Examples This repository contains example apps created using GoCondor framework what are the examples? 1- Todo API A todo api with the below routes:

May 7, 2021
This GitHub repository contains code example for those who are new to go programming.
This GitHub repository contains code example for those who are new to go programming.

Go-examples This GitHub repository contains code example for those who are new to go programming. IMPLEMENTATIONS JWT - json-web-token-implementation/

Jan 15, 2022
Go package to make lightweight ASCII line graph ╭┈╯ in command line apps with no other dependencies.
Go package to make lightweight ASCII line graph ╭┈╯ in command line apps with no other dependencies.

asciigraph Go package to make lightweight ASCII line graphs ╭┈╯. Installation go get github.com/guptarohit/asciigraph Usage Basic graph package main

Jan 8, 2023
:mag: Search the Go packages via command-line

GoSearch Search the Go packages for pkg.go.dev via command-line. It supports all search options in Search Help. Installation go get github.com/mingram

Jun 23, 2022
It is an easy and fast tool to install your packages with just one command.

Trouxa It is an easy and fast tool to install your packages with just one command. What means "Trouxa"? In portuguese, Trouxa means something like a "

Sep 29, 2022
Get Brew Packages to update, just like you've experienced from Ubuntu
Get Brew Packages to update, just like you've experienced from Ubuntu

Get the number of Brew Packages to update, just like you've experienced from Ubuntu BrewUpdate is a simple utility written in Go, notify you how many

Nov 6, 2021
Code generator to produce CLI from R packages

cmd Create command line applications from R packages. How it works It's a code generator that outputs Go code which produces a Command Line Applicatio

Apr 30, 2022
Gopkg - Search go.dev packages by keyword

gopkg Search go.dev packages by keyword Usage Install go install github.com/luck

Apr 6, 2022
lls is lightweight ls. Using lls, you can get a list of files in a directory that contains a large number of files.

lls lls is lightweight ls. Using lls, you can get a list of files in a directory that contains a large number of files. How? You allocate a buffer for

Dec 29, 2022