Add Travis script
ADD
.travis.yml
+sudo: false
+
+language: go
+
+# Versions of go that are explicitly supported by gonum.
+go:
+ - 1.6.3
+ - 1.7.3
+ - 1.8
+
+# Required for coverage.
+before_install:
+ - go get golang.org/x/tools/cmd/cover
+ - go get github.com/mattn/goveralls
+
+# Get deps, build, test, and ensure the code is gofmt'ed.
+# If we are building as gonum, then we have access to the coveralls api key, so we can run coverage as well.
+script:
+ - go get -d -t -v ./...
+ - go build -v ./...
+ - go test -v ./...
+ - test -z "$(gofmt -d .)"
+ - if [[ $TRAVIS_SECURE_ENV_VARS = "true" ]]; then bash ./.travis/test-coverage.sh; fi
+

ADD
.travis/test-coverage.sh
+#!/bin/bash
+
+PROFILE_OUT=$PWD/profile.out
+ACC_OUT=$PWD/acc.out
+
+testCover() {
+ # set the return value to 0 (succesful)
+ retval=0
+ # get the directory to check from the parameter. Default to '.'
+ d=${1:-.}
+ # skip if there are no Go files here
+ ls $d/*.go &> /dev/null || return $retval
+ # switch to the directory to check
+ pushd $d > /dev/null
+ # create the coverage profile
+ coverageresult=`go test -v -coverprofile=$PROFILE_OUT`
+ # output the result so we can check the shell output
+ echo ${coverageresult}
+ # append the results to acc.out if coverage didn't fail, else set the retval to 1 (failed)
+ ( [[ ${coverageresult} == *FAIL* ]] && retval=1 ) || ( [ -f $PROFILE_OUT ] && grep -v "mode: set" $PROFILE_OUT >> $ACC_OUT )
+ # return to our working dir
+ popd > /dev/null
+ # return our return value
+ return $retval
+}
+
+# Init acc.out
+echo "mode: set" > $ACC_OUT
+
+# Run test coverage on all directories containing go files
+find . -maxdepth 10 -type d | while read d; do testCover $d || exit; done
+
+# Upload the coverage profile to coveralls.io
+[ -n "$COVERALLS_TOKEN" ] && goveralls -coverprofile=$ACC_OUT -service=travis-ci -repotoken $COVERALLS_TOKEN
\ No newline at end of file

ADD
hello.go
+package gonum
+
+const theMatrix = -1

ADD
hello_test.go
+package gonum
+
+import "testing"
+
+func TestTheMatrix(t *testing.T) {
+ if theMatrix != -1 {
+ t.Errorf("Bad constant value")
+ }
+}

Add Travis script