Skip to content

jonasbn/go-test-demo

Repository files navigation

go-test-demo

This is a basic repository I use for testing gotest, which provides colorful output, compared to the standard test tool.

Standard go toolchain:

go test -v

standard go test example screenshot

Using gotest

gotest -v

colorful gotest example screenshot

I use this repository for testing my contributions to gotest

gotest -v github.com/jonasbn/go-test-demo

Do note that the above example expects for you to be in a directory containing a Go module project or else you will observe the following error:

no required module provides package github.com/jonasbn/go-test-demo: go.mod file not found in current directory or any parent directory; see 'go help modules'

You can do the following to get the demo to work, if you are not in the context of a Go module - it could be any, you could even fork and clone this here repository.

  1. Create a directory
  2. Initialize as a Go module
  3. Install this demo
  4. Run the gotest command
mkdir gonow && \
go mod init example.com/gonow && \
go get github.com/jonasbn/go-test-demo

And then you should be good to go

gotest -v github.com/jonasbn/go-test-demo

Resources and References