[
  {
    "path": ".gitignore",
    "content": "# Binaries for programs and plugins\n*.exe\n*.exe~\n*.dll\n*.so\n*.dylib\n\n# Test binary, built with `go test -c`\n*.test\n\nbin\n.go\n.push-*\n.container-*\n.dockerfile-*\n\ngo.sum\n"
  },
  {
    "path": ".travis.yml",
    "content": "# Matrix build runs 4 parallel builds\nmatrix:\n  include:\n    - language: go  # Build and Test\n      sudo: required\n      services:\n        - docker\n      script:\n        - export GO111MODULE=on\n        - go mod vendor  # Download dependencies\n        - make build  # Build application\n        - test -f bin/linux_amd64/blueprint  # Test for presence of binary built in previous step\n        - make all-container  # Make all Docker containers\n        - docker images | grep \"^docker.pkg.github.com/martinheinz/go-project-blueprint/blueprint.*__linux_amd64\"  # Check presence of created images\n        - make test  # Runs tests inside test image\n\n    - language: go  # SonarCloud\n      addons:\n        sonarcloud:\n          organization: martinheinz-github\n          token:\n            secure: \"tYsUxue9kLZWb+Y8kwU28j2sa0pq20z2ZvZrbKCN7Sw0WGtODQLaK9tZ94u1Sy02qL5QcabukbENmbvfouzXf4EfaKjDmYH9+Ja22X26MfTLVpaCDTQEGmNyREOFCHpjNXPgDMv1C70By5U+aPWSYF/lehB5rFijwCf7rmTFRNUDeotCTCuWb2dIkrX2i6raVu34SvqqGxKQmmH+NPLe7uKO/wXqH+cWQH1P9oJYeVksNGruw4M0MznUeQHeJQYpTLooxhEEzYiBbkerWGDMwBdZdPQwVrO2b8FEDRw/GWTFoL+FkdVMl4n4lrbO/cQLbPMTGcfupNCuVHh1n8cGp8spMkrfQGtKqvDRuz2tBs0n1PWXCRS6pgZQw/ClLPgi/vVryVRwOabIHSQQLRVhcdp8pkYdyX3aH1EdlIHiJLT6sacS0vJPqZMF/HNsPEoHe4YdiYvx/tcYMU63KQVZzgF4HfQMWy69s1d0RZUqd+wrtHU1DHwnkq1TSe+8nMlbvbmMsm6FVqGistrnVjx4C9TjDWQcjprYU40zCvc1uvoSPimVcaD8ITalCDHlEfoV7wZuisV8+gJzOh9pDZ/joohW7/P3zklGgI2sH7qt62GE4o5UyRArzJC7eIj7Oxx6GdbeEqw09M4rCfR1g5tHWIqVHz5CajvkXkPqrRGu2oI=\"\n      before_script:\n        - ./reports.sh  # Creates directories and files for reports\n        - export GO111MODULE=on\n        - go mod vendor  # Download dependencies\n        - make ci  # Run tests and generate reports (See `ci` step in Makefile)\n      script:\n        - sonar-scanner  # Run analysis using SonarCloud scanner plugin\n\n    - language: go  # CodeClimate\n      before_script:\n        - ./reports.sh  # Create directories and files for reports\n        - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter  # Download CodeClimate test reporter\n        - chmod +x ./cc-test-reporter  # Make it executable\n        - ./cc-test-reporter before-build  # Notify CodeClimate of pending report\n      script:\n        - export GO111MODULE=on\n        - go mod vendor  # Download dependencies\n        - make ci  # Run tests and generate reports (See `ci` step in Makefile)\n      after_script:\n        - ./cc-test-reporter after-build -t gocov --exit-code $TRAVIS_TEST_RESULT  # Send report to CodeClimate or notify it of failing build based on exit code\n\n    - language: go  # Push if on master\n      services:\n        - docker\n      if: branch = master\n      script:\n        - export GO111MODULE=on\n        - go mod vendor  # Download dependencies\n        - echo \"$DOCKER_PASSWORD\" | docker login docker.pkg.github.com -u \"$DOCKER_USERNAME\" --password-stdin  # Login to GitHub Registry using Travis environment variables\n        - make container  # Create dirty and latest images\n        - make push  # Push image to registry\n\nnotifications:\n  email: false\n"
  },
  {
    "path": "LICENSE",
    "content": "MIT License\n\nCopyright (c) 2019 MartinHeinz\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "Makefile",
    "content": "# This is adapted from https://github.com/thockin/go-build-template\n\n# The binary to build (just the basename).\nBIN := blueprint\n\n# Where to push the docker image.\nREGISTRY ?= docker.pkg.github.com/martinheinz/go-project-blueprint\n\n# This version-strategy uses git tags to set the version string\nVERSION := $(shell git describe --tags --always --dirty)\n\n# This version-strategy uses a manual value to set the version string\n#VERSION := 1.2.3\n\n###\n### These variables should not need tweaking.\n###\n\nSRC_DIRS := cmd pkg # directories which hold app source (not vendored)\n\nALL_PLATFORMS := linux/amd64\n\n# Used internally.  Users should pass GOOS and/or GOARCH.\nOS := $(if $(GOOS),$(GOOS),$(shell go env GOOS))\nARCH := $(if $(GOARCH),$(GOARCH),$(shell go env GOARCH))\n\nBASEIMAGE ?= gcr.io/distroless/static\n\nIMAGE := $(REGISTRY)/$(BIN)\nTAG := $(VERSION)__$(OS)_$(ARCH)\n\nBUILD_IMAGE ?= golang:1.12-alpine\n# Tweaked image used for test runs (see `test.Dockerfile`)\nTEST_IMAGE ?= martinheinz/golang:1.12-alpine-test\n\n# If you want to build all binaries, see the 'all-build' rule.\n# If you want to build all containers, see the 'all-container' rule.\nall: build\n\n# For the following OS/ARCH expansions, we transform OS/ARCH into OS_ARCH\n# because make pattern rules don't match with embedded '/' characters.\n\nbuild-%:\n\t@$(MAKE) build                        \\\n\t    --no-print-directory              \\\n\t    GOOS=$(firstword $(subst _, ,$*)) \\\n\t    GOARCH=$(lastword $(subst _, ,$*))\n\ncontainer-%:\n\t@$(MAKE) container                    \\\n\t    --no-print-directory              \\\n\t    GOOS=$(firstword $(subst _, ,$*)) \\\n\t    GOARCH=$(lastword $(subst _, ,$*))\n\npush-%:\n\t@$(MAKE) push                         \\\n\t    --no-print-directory              \\\n\t    GOOS=$(firstword $(subst _, ,$*)) \\\n\t    GOARCH=$(lastword $(subst _, ,$*))\n\nall-build: $(addprefix build-, $(subst /,_, $(ALL_PLATFORMS)))\n\nall-container: $(addprefix container-, $(subst /,_, $(ALL_PLATFORMS)))\n\nbuild: bin/$(OS)_$(ARCH)/$(BIN)\n\n# Directories that we need created to build/test.\nBUILD_DIRS := bin/$(OS)_$(ARCH)     \\\n              .go/bin/$(OS)_$(ARCH) \\\n              .go/cache\n\n# The following structure defeats Go's (intentional) behavior to always touch\n# result files, even if they have not changed.  This will still run `go` but\n# will not trigger further work if nothing has actually changed.\nOUTBIN = bin/$(OS)_$(ARCH)/$(BIN)\n$(OUTBIN): .go/$(OUTBIN).stamp\n\t@true\n\n# This will build the binary under ./.go and update the real binary if needed.\n.PHONY: .go/$(OUTBIN).stamp\n.go/$(OUTBIN).stamp: $(BUILD_DIRS)\n\t@echo \"making $(OUTBIN)\"\n\t@docker run                                                 \\\n\t    -i                                                      \\\n\t    --rm                                                    \\\n\t    -u $$(id -u):$$(id -g)                                  \\\n\t    -v $$(pwd):/src                                         \\\n\t    -w /src                                                 \\\n\t    -v $$(pwd)/.go/bin/$(OS)_$(ARCH):/go/bin                \\\n\t    -v $$(pwd)/.go/bin/$(OS)_$(ARCH):/go/bin/$(OS)_$(ARCH)  \\\n\t    -v $$(pwd)/.go/cache:/.cache                            \\\n\t    --env HTTP_PROXY=$(HTTP_PROXY)                          \\\n\t    --env HTTPS_PROXY=$(HTTPS_PROXY)                        \\\n\t    $(BUILD_IMAGE)                                          \\\n\t    /bin/sh -c \"                                            \\\n\t        ARCH=$(ARCH)                                        \\\n\t        OS=$(OS)                                            \\\n\t        VERSION=$(VERSION)                                  \\\n\t        ./build/build.sh                                    \\\n\t    \"\n\t@if ! cmp -s .go/$(OUTBIN) $(OUTBIN); then \\\n\t    mv .go/$(OUTBIN) $(OUTBIN);            \\\n\t    date >$@;                              \\\n\tfi\n\n# Example: make shell CMD=\"-c 'date > datefile'\"\nshell: $(BUILD_DIRS)\n\t@echo \"launching a shell in the containerized build environment\"\n\t@docker run                                                 \\\n\t    -ti                                                     \\\n\t    --rm                                                    \\\n\t    -u $$(id -u):$$(id -g)                                  \\\n\t    -v $$(pwd):/src                                         \\\n\t    -w /src                                                 \\\n\t    -v $$(pwd)/.go/bin/$(OS)_$(ARCH):/go/bin                \\\n\t    -v $$(pwd)/.go/bin/$(OS)_$(ARCH):/go/bin/$(OS)_$(ARCH)  \\\n\t    -v $$(pwd)/.go/cache:/.cache                            \\\n\t    --env HTTP_PROXY=$(HTTP_PROXY)                          \\\n\t    --env HTTPS_PROXY=$(HTTPS_PROXY)                        \\\n\t    $(BUILD_IMAGE)                                          \\\n\t    /bin/sh $(CMD)\n\n# Used to track state in hidden files.\nDOTFILE_IMAGE = $(subst /,_,$(IMAGE))-$(TAG)\n\ncontainer: .container-$(DOTFILE_IMAGE) say_container_name\n.container-$(DOTFILE_IMAGE): bin/$(OS)_$(ARCH)/$(BIN) in.Dockerfile\n\t@sed                                 \\\n\t    -e 's|{ARG_BIN}|$(BIN)|g'        \\\n\t    -e 's|{ARG_ARCH}|$(ARCH)|g'      \\\n\t    -e 's|{ARG_OS}|$(OS)|g'          \\\n\t    -e 's|{ARG_FROM}|$(BASEIMAGE)|g' \\\n\t    in.Dockerfile > .dockerfile-$(OS)_$(ARCH)\n\t@docker build -t $(IMAGE):$(TAG) -t $(IMAGE):latest -f .dockerfile-$(OS)_$(ARCH) .\n\t@docker images -q $(IMAGE):$(TAG) > $@\n\nsay_container_name:\n\t@echo \"container: $(IMAGE):$(TAG)\"\n\npush: .push-$(DOTFILE_IMAGE) say_push_name\n.push-$(DOTFILE_IMAGE): .container-$(DOTFILE_IMAGE)\n\t@docker push $(IMAGE):$(TAG)\n\npush-latest: .push-$(DOTFILE_IMAGE) say_push_name_latest\n\t@docker push $(IMAGE):latest\n\nsay_push_name:\n\t@echo \"pushed: $(IMAGE):$(TAG)\"\n\nsay_push_name_latest:\n\t@echo \"pushed: $(IMAGE):$(TAG)\"\n\nversion:\n\t@echo $(VERSION)\n\ntest: $(BUILD_DIRS)\n\t@docker run                                                 \\\n\t    -i                                                      \\\n\t    --rm                                                    \\\n\t    -u $$(id -u):$$(id -g)                                  \\\n\t    -v $$(pwd):/src                                         \\\n\t    -w /src                                                 \\\n\t    -v $$(pwd)/.go/bin/$(OS)_$(ARCH):/go/bin                \\\n\t    -v $$(pwd)/.go/bin/$(OS)_$(ARCH):/go/bin/$(OS)_$(ARCH)  \\\n\t    -v $$(pwd)/.go/cache:/.cache                            \\\n\t    -v $$(pwd)/config:/config                               \\\n\t    --env HTTP_PROXY=$(HTTP_PROXY)                          \\\n\t    --env HTTPS_PROXY=$(HTTPS_PROXY)                        \\\n\t    $(TEST_IMAGE)                                           \\\n\t    /bin/sh -c \"                                            \\\n\t        ARCH=$(ARCH)                                        \\\n\t        OS=$(OS)                                            \\\n\t        VERSION=$(VERSION)                                  \\\n\t        ./build/test.sh $(SRC_DIRS)                         \\\n\t    \"\n\nci: $(BUILD_DIRS)\n\t@docker run                                                 \\\n\t    -i                                                      \\\n\t    --rm                                                    \\\n\t    -u $$(id -u):$$(id -g)                                  \\\n\t    -v $$(pwd):/src                                         \\\n\t    -w /src                                                 \\\n\t    -v $$(pwd)/.go/bin/$(OS)_$(ARCH):/go/bin                \\\n\t    -v $$(pwd)/.go/bin/$(OS)_$(ARCH):/go/bin/$(OS)_$(ARCH)  \\\n\t    -v $$(pwd)/.go/cache:/.cache                            \\\n\t    -v $$(pwd)/reports:/reports                             \\\n\t    -v $$(pwd)/config:/config                               \\\n\t    -v $$(pwd)/:/coverage                                   \\\n\t    --env HTTP_PROXY=$(HTTP_PROXY)                          \\\n\t    --env HTTPS_PROXY=$(HTTPS_PROXY)                        \\\n\t    $(TEST_IMAGE)                                           \\\n\t    /bin/sh -c \"                                            \\\n\t        ARCH=$(ARCH)                                        \\\n\t        OS=$(OS)                                            \\\n\t        VERSION=$(VERSION)                                  \\\n\t        ./build/test_ci.sh $(SRC_DIRS)                      \\\n\t    \"\n\n$(BUILD_DIRS):\n\t@mkdir -p $@\n\nclean: container-clean bin-clean\n\ncontainer-clean:\n\trm -rf .container-* .dockerfile-* .push-*\n\nbin-clean:\n\trm -rf .go bin\n"
  },
  {
    "path": "README.md",
    "content": "# Blueprint/Boilerplate For Golang Projects\n\n[![Build Status](https://travis-ci.com/MartinHeinz/go-project-blueprint.svg?branch=master)](https://travis-ci.com/MartinHeinz/go-project-blueprint)\n[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=MartinHeinz_go-project-blueprint&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=MartinHeinz_go-project-blueprint)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/ec7ebefe63609984cb5c/test_coverage)](https://codeclimate.com/github/MartinHeinz/go-project-blueprint/test_coverage)\n[![Go Report Card](https://goreportcard.com/badge/github.com/MartinHeinz/go-project-blueprint)](https://goreportcard.com/report/github.com/MartinHeinz/go-project-blueprint)\n\n-----\n\nIf you find this useful, you can support me on Ko-Fi (Donations are always appreciated, but never required):\n\n[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/K3K6F4XN6)\n\n## Blog Posts - More Information About This Repo\n\nYou can find more information about this project/repository and how to use it in following blog posts:\n\n- [Ultimate Setup for Your Next Golang Project](https://towardsdatascience.com/ultimate-setup-for-your-next-golang-project-1cc989ad2a96)\n- [Setting up GitHub Package Registry with Docker and Golang](https://towardsdatascience.com/setting-up-github-package-registry-with-docker-and-golang-7a75a2533139)\n- [Building RESTful APIs in Golang](https://towardsdatascience.com/building-restful-apis-in-golang-e3fe6e3f8f95)\n- [Setting Up Swagger Docs for Golang API](https://towardsdatascience.com/setting-up-swagger-docs-for-golang-api-8d0442263641)\n\n### Setting Up\n- Replace All Occurrences of `martinheinz/go-project-blueprint` with your username repository name\n- Replace All Occurrences of `blueprint` with your desired image name\n\n\n### Adding New Libraries/Dependencies\n```bash\ngo mod vendor\n```\n\n### Using GitHub Registry\n\nCreate and Push:\n\n```bash\ndocker login docker.pkg.github.com -u <USERNAME> -p <GITHUB_TOKEN>\ndocker build -t  docker.pkg.github.com/martinheinz/go-project-blueprint/blueprint:latest .\n# make container\ndocker push docker.pkg.github.com/martinheinz/go-project-blueprint/blueprint:latest\n# make push\n```\n\nPull and Run:\n\n```bash\ndocker pull docker.pkg.github.com/martinheinz/go-project-blueprint/blueprint:latest\ndocker run docker.pkg.github.com/martinheinz/go-project-blueprint/blueprint:latest\n```\n\n\n### Setup new SonarCloud Project\n\n- On _SonarCloud_:\n    - Click _Plus_ Sign in Upper Right Corner\n    - _Analyze New Project_\n    - Click _GitHub app configuration_ link\n    - Configure SonarCloud\n    - Select Repository and Save\n    - Go Back to Analyze Project\n    - Tick Newly Added Repository\n    - Click Set Up\n    - Click Configure with Travis\n    - Copy the Command to Encrypt the Travis Token\n    - Run `travis encrypt --com <TOKEN_YOU_COPPIED>`\n    - Populate the `secure` Field in `.travis.yml` with outputted string\n    - Follow steps to populate your `sonar-project.properties`\n    - Push\n- On Travis CI:\n    - Set `DOCKER_USERNAME`\n    - Set `DOCKER_PASSWORD` to Your GitHub Registry Token\n\n### Setup CodeClimate\n- Go to <https://codeclimate.com/github/repos/new>\n- Add Repository\n- Go to Test Coverage Tab\n- Copy Test Reporter ID\n- Go to Travis and Open Settings for Your Repository\n- Add Environment Variable: name: `CC_TEST_REPORTER_ID`, value: _Copied from CodeClimate_\n"
  },
  {
    "path": "build/build.sh",
    "content": "#!/bin/sh\n\nset -o errexit\nset -o nounset\nset -o pipefail\n\n# Check if OS, architecture and application version variables are set in Makefile\nif [ -z \"${OS:-}\" ]; then\n    echo \"OS must be set\"\n    exit 1\nfi\nif [ -z \"${ARCH:-}\" ]; then\n    echo \"ARCH must be set\"\n    exit 1\nfi\nif [ -z \"${VERSION:-}\" ]; then\n    echo \"VERSION must be set\"\n    exit 1\nfi\n\n# Disable C code, enable Go modules\nexport CGO_ENABLED=0\nexport GOARCH=\"${ARCH}\"\nexport GOOS=\"${OS}\"\nexport GO111MODULE=on\nexport GOFLAGS=\"-mod=vendor\"\n\n# Build the application. `-ldflags -X` sets version variable in importpath for each `go tool link` invocation\ngo install                                                      \\\n    -installsuffix \"static\"                                     \\\n    -ldflags \"-X $(go list -m)/pkg/version.VERSION=${VERSION}\"  \\\n    ./...\n"
  },
  {
    "path": "build/test.sh",
    "content": "#!/bin/sh\n\nset -o errexit\nset -o nounset\nset -o pipefail\n\n# Enable C code, as it is needed for SQLite3 database binary\n# Enable go modules\nexport CGO_ENABLED=1\nexport GO111MODULE=on\nexport GOFLAGS=\"-mod=vendor\"\n\n# Collect test targets\nTARGETS=$(for d in \"$@\"; do echo ./$d/...; done)\n\n# Run tests\necho \"Running tests:\"\ngo test -installsuffix \"static\" ${TARGETS} 2>&1\necho\n\n# Collect all `.go` files and `gofmt` against them. If some need formatting - print them.\necho -n \"Checking gofmt: \"\nERRS=$(find \"$@\" -type f -name \\*.go | xargs gofmt -l 2>&1 || true)\nif [ -n \"${ERRS}\" ]; then\n    echo \"FAIL - the following files need to be gofmt'ed:\"\n    for e in ${ERRS}; do\n        echo \"    $e\"\n    done\n    echo\n    exit 1\nfi\necho \"PASS\"\necho\n\n# Run `go vet` against all targets. If problems are found - print them.\necho -n \"Checking go vet: \"\nERRS=$(go vet ${TARGETS} 2>&1 || true)\nif [ -n \"${ERRS}\" ]; then\n    echo \"FAIL\"\n    echo \"${ERRS}\"\n    echo\n    exit 1\nfi\necho \"PASS\"\necho\n"
  },
  {
    "path": "build/test_ci.sh",
    "content": "#!/bin/sh\n\nset -o errexit\nset -o nounset\nset -o pipefail\n\n# Enable C code, as it is needed for SQLite3 database binary\n# Enable go modules\nexport CGO_ENABLED=1\nexport GO111MODULE=on\nexport GOFLAGS=\"-mod=vendor\"\n\n# Collect test targets\nTARGETS=$(for d in \"$@\"; do echo ./$d/...; done)\n\n# Run tests and generate reports in JSON format, then copy them to path/file expected CodeClimate and SonarCloud\necho \"Running tests and Generating reports...\"\ngo test -coverprofile=/reports/coverage.out -installsuffix \"static\" ${TARGETS} -json > /reports/test-report.out\ncp /reports/coverage.out /coverage/c.out\necho\n\n# Check coverage using test report from previous step\necho \"Coverage:\"\ngo tool cover -func=/coverage/c.out\necho\n\n# Collect all `.go` files and `gofmt` against them. If some need formatting - print them.\necho -n \"Checking gofmt: \"\nERRS=$(find \"$@\" -type f -name \\*.go | xargs gofmt -l 2>&1 || true)\nif [ -n \"${ERRS}\" ]; then\n    echo \"FAIL - the following files need to be gofmt'ed:\"\n    for e in ${ERRS}; do\n        echo \"    $e\"\n    done\n    echo\n    exit 1\nfi\necho \"PASS\"\necho\n\n# Run `go vet` against all targets. If problems are found - print them.\necho -n \"Checking go vet: \"\nERRS=$(go vet ${TARGETS} 2>&1 | tee \"/reports/vet.out\" || true)\nif [ -n \"${ERRS}\" ]; then\n    echo \"FAIL\"\n    echo \"${ERRS}\"\n    echo\n    exit 1\nfi\necho \"PASS\"\necho\n"
  },
  {
    "path": "cmd/blueprint/config/config.go",
    "content": "package config\n\nimport (\n\t\"fmt\"\n\t\"github.com/spf13/viper\"\n)\n\n// Config is global object that holds all application level variables.\nvar Config appConfig\n\ntype appConfig struct {\n\t// Example Variable\n\tConfigVar string\n}\n\n// LoadConfig loads config from files\nfunc LoadConfig(configPaths ...string) error {\n\tv := viper.New()\n\tv.SetConfigName(\"example\")\n\tv.SetConfigType(\"yaml\")\n\tv.SetEnvPrefix(\"blueprint\")\n\tv.AutomaticEnv()\n\tfor _, path := range configPaths {\n\t\tv.AddConfigPath(path)\n\t}\n\tif err := v.ReadInConfig(); err != nil {\n\t\treturn fmt.Errorf(\"failed to read the configuration file: %s\", err)\n\t}\n\treturn v.Unmarshal(&Config)\n}\n"
  },
  {
    "path": "cmd/blueprint/main.go",
    "content": "package main\n\nimport (\n\t\"fmt\"\n\t\"github.com/MartinHeinz/go-project-blueprint/cmd/blueprint/config\"\n)\n\nfunc main() {\n\t// load application configurations\n\tif err := config.LoadConfig(\"./config\"); err != nil {\n\t\tpanic(fmt.Errorf(\"invalid application configuration: %s\", err))\n\t}\n\n\tfmt.Println(config.Config.ConfigVar)\n}\n"
  },
  {
    "path": "cmd/blueprint/main_test.go",
    "content": "package main\n\nimport (\n\t\"github.com/MartinHeinz/go-project-blueprint/cmd/blueprint/config\"\n\t\"github.com/stretchr/testify/assert\"\n\t\"testing\"\n)\n\n// Example test to show usage of `make test`\nfunc TestDummy(t *testing.T) {\n\tassert.Equal(t, 1, 1)\n}\n\nfunc TestLoadConfig(t *testing.T) {\n\tif err := config.LoadConfig(\"/config\"); err != nil {\n\t\tassert.Error(t, err)\n\t}\n\tassert.Equal(t, \"Dummy Value\", config.Config.ConfigVar)\n}\n"
  },
  {
    "path": "config/example.yaml",
    "content": "ConfigVar: \"Dummy Value\"\n"
  },
  {
    "path": "go.mod",
    "content": "module github.com/MartinHeinz/go-project-blueprint\n\ngo 1.12\n\nrequire (\n\tgithub.com/spf13/viper v1.4.0\n\tgithub.com/stretchr/testify v1.4.0\n)\n"
  },
  {
    "path": "in.Dockerfile",
    "content": "FROM {ARG_FROM}\n\nADD bin/{ARG_OS}_{ARG_ARCH}/{ARG_BIN} /{ARG_BIN}\nCOPY ./config /config\n\nEXPOSE 1234\n\nENTRYPOINT [\"/{ARG_BIN}\"]\n\n# Used in Makefile - `make container` step\n"
  },
  {
    "path": "pkg/version.go",
    "content": "package pkg\n\n// VERSION is the app-global version string, which should be substituted with a\n// real value during build.\nvar VERSION = \"UNKNOWN\"\n"
  },
  {
    "path": "reports.sh",
    "content": "#!/usr/bin/env bash\n# Prepares files and directories needed when generating reports (mainly used in CI/CD build)\n\nmkdir -p reports\ntouch reports/coverage.out reports/test-report.out reports/vet.out\ntouch c.out\n"
  },
  {
    "path": "sonar-project.properties",
    "content": "sonar.projectKey=MartinHeinz_go-project-blueprint\nsonar.organization=martinheinz-github\nsonar.projectName=go-project-blueprint\nsonar.projectVersion=0.0.1\n\nsonar.login=b806fa3a541f3d3cf15922c6cb13d67429423a00\nsonar.password=\n\nsonar.links.homepage=\nsonar.links.ci=\nsonar.links.scm=\n\nsonar.sources=cmd\nsonar.tests=cmd\nsonar.binaries=cmd/bin/linux_amd64\nsonar.exclusions=**/vendor/**\nsonar.test.exclusions=**/*.go\nsonar.test.inclusions=**/*_test.go\n\nsonar.go.coverage.reportPath=reports/coverage.out\nsonar.go.tests.reportPaths=reports/test-report.out\nsonar.go.govet.reportPaths=reports/vet.out\n"
  },
  {
    "path": "test.Dockerfile",
    "content": "FROM golang:1.12-alpine\n\nRUN apk add gcc g++\n\n# Docker image for running tests. This image is needed because tests use SQLite3 as in-memory database\n# and that requires CGO to be enabled, which in turn requires GCC and G++ to be installed.\n"
  }
]