assets/entrypoint-go
#!/bin/bash
#
# entrypoint-go
#
# Copyright (c) 2016-2017 Junpei Kawamoto
#
# This software is released under the MIT License.
#
# http://opensource.org/licenses/mit-license.php
#
# Run before install steps, install steps, before script steps, and script
# steps in this order. This entry point script focuses on running tests for
# Go applications. If any parameters are given, execute the parameters
# instead. For example, to debug this script, run this with `bash` as the
# parameter and get a shell access.
{{define "env"}}
PATH="$GOPATH/bin:$PATH"
declare -x GIMME_GO_VERSION=$(gimme -l)
if [[ -n "$GIMME_GO_VERSION" ]]; then
eval "$(gimme)"
fi
readonly TRAVIS_GO_VERSION=$(go version | cut -f 3 -d " " | sed s/go//g)
{{end}}
{{define "install"}}
echo -e "\e[33mInstall Steps:\e[m"
git config --global http.https://gopkg.in.followRedirects true
{{if .Install}}
{{range .Install}}
echo "{{.}}"
({{.}})
{{end}}
{{else}}
echo "go get -t ./..."
go get -t ./...
{{end}}
{{end}}
{{define "script"}}
echo -e "\e[33mScript Steps:\e[m"
{{/* "if script isn't given, use make or the default golang test command." */}}
{{if .Script}}
{{range .Script}}
echo "{{.}}"
({{.}})
{{end}}
{{else}}
if [[ -e GNUMakefile ]] || [[ -e Makefile ]] || [[ -e BSDmakefile ]] || [[ -e makefile ]]; then
make
else
{{if .GoBuildArgs}}
go test {{.GoBuildArgs}}
{{else}}
go test -v ./...
{{end}}
fi
{{end}}
{{end}}