Skip to content

jatgam/goutils

Repository files navigation

goutils

A collection of useful go utilities and functions.

Build Status

Version

Works with semantically versioned modules, according to semver. The version is pulled from the git tags of the repository. Example: v0.1.0

The first step is to make sure the version is passed into the build:

GIT_VERSION=$(shell git describe --always --dirty)
GIT_BRANCH=$(shell git rev-parse --abbrev-ref HEAD)
LDFLAGS=-ldflags "-X github.com/jatgam/goutils/version.gitVersion=${GIT_VERSION} -X github.com/jatgam/goutils/version.gitBranch=${GIT_BRANCH}"
go build ${LDFLAGS} ...

main usage:

package main
import (
    "fmt"
    "os"
    "github.com/jatgam/goutils/version"
)
var (
    appVersion = &version.Info{}
)
func init() {
    appVersion.ParseVersion()
}
func main() {
    fmt.Println(os.Args[0], "version:", appVersion.GetVersionString())
}

Queue and Double Linked List

Meant to be thread safe and support go concurrency.

Log

A common log setup so all your projects/modules are consistent.

Strings

Various random useful string functions.

Regex

Capture named regex groups into a map

Files

Various functions around files and directories.

About

A collection of useful go utilities and functions.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages