The travis build
The following command will build the golang binary and run the unit tests.
The result of this build step is the standalone binary in the ./build/
folder.
make build
Example Output:
go build -o build/ cmd/main.go
go test -v --cover ./...
? github.com/fr123k/golang-template/cmd [no test files]
=== RUN TestHelloWorld
Hello World
--- PASS: TestHelloWorld (0.00s)
=== RUN TestHello
--- PASS: TestHello (0.00s)
PASS
coverage: 100.0% of statements
ok github.com/fr123k/golang-template/pkg/utility (cached) coverage: 100.0% of statements
The following make target will first build and then execute the golang binary.
make run
Example Output:
go build -o build/main cmd/main.go
go test -v --cover ./...
? github.com/fr123k/golang-template/cmd [no test files]
=== RUN TestHelloWorld
Hello World
--- PASS: TestHelloWorld (0.00s)
=== RUN TestHello
--- PASS: TestHello (0.00s)
PASS
coverage: 100.0% of statements
ok github.com/fr123k/golang-template/pkg/utility (cached) coverage: 100.0% of statements
./build/main
Hello World
The following make target will remove the ./build/
folder.
No confirmation needed
make clean
Example Output:
rm -rfv ./build
./build/main
./build
- setup travis build
- setup travis build