The SpotHero Tools Library is used internally at SpotHero across our Go programs. This library is a
collection of common utilities and functions that don't yet stand on their own as individual
libraries.
We welcome community usage and collaboration.
Running the Example Server
- Install Golang
brew install golang
- Set your
GOPATH
in your .zshrc
/.bashrc
/etc
- Add
GOPATH/bin
to your PATH
export PATH=$GOPATH/bin:$PATH
- Clone this repository
make
./example_server
- Open your browser to
http://localhost:8080
Overview
This library contains common modules for use in all GoLang projects across SpotHero. To use this
library simply add this as a dependency in your dep Gopkg.toml using the latest release.
Currently, this library supports the following features:
- CLI Utilities
- Kafka
- Support for consuming and producing metrics
- Support for goroutine-based callback functions where types are automatically deduced and
unpacked
- Schema Registry
- Avro Decoding
- HTTP Server with instrumentation
- Prometheus Metrics
- Kubernetes API Listeners
- High-Performance Logging
- Sentry Integration
- OpenTracing/Jaeger Tracing Support
In addition, all the above packages may automatically be integrated with Cobra/Viper CLIs for
12-factor application compatibility via the CLI module.
Usage
A simple example is provided under examples/example_server.go which shows usage of this
library to create a simple 12-factor Go Web application which has tracing, logging, metrics,
sentry, and local caching enabled.
For production applications, we recommend separating the Cobra/Viper command portion into its own
cmd/
directory, and your application logic into a pkg/
directory as is standard with most Go
applications.
Additionally, the Makefile for this project is an excellent example which you can (and should)
borrow for your own projects.
License
Apache 2.0