Public | Automated Build

Last pushed: a year ago
Short Description
Proof of concept implementation of messenger app in GO.
Full Description

Messenger example in GO

example-messenger-go is a proof of concept implementation of messenger app in GO.

Running tests

$ go test -v ./

test coverage:

go test -covermode=count -coverprofile=count.out ./ && go tool cover -html=count.out

Building

govend is used for vendoring.

govend -v 

go build

Configuration

12-factor principles are followed for app configuration. All config values are stored in environmental variables prefixed with "APP_".
envconfig package is used for configuration processing.

Configuration options

// HTTPHost is address on which HTTP server endpoint is listening.
HTTPHost string `envconfig:"default=0.0.0.0"`

// HTTPPort is a port number on which HTTP server endpoint is listening.
HTTPPort int `envconfig:"default=8080"`

// LogLevel is a minimal log severity required for the message to be logged.
// Valid levels: [debug, info, warn, error, fatal, panic].
LogLevel string `envconfig:"default=info"`

Endpoints

Swagger 2.0 is used for REST endpoint documentation. It's available at /v1/swagger.json.

swagger-go project is used for documentation through annotations.

To regenerate:


swagger generate spec -o ./swagger.json

Using docker

build locally

$ docker build -t szpakas/example-go-messenger .

or pull from docker hub

$ docker pull szpakas/example-go-messenger
docker run --rm -i \
    -p 8080:8080 \
    -e "APP_LOG_LEVEL=debug" \
    --name example-go-messenger szpakas/example-go-messenger

License

Apache 2.0, see LICENSE.

Docker Pull Command
Owner
szpakas
Source Repository