Add a test to the stringutil package by creating the file $GOPATH/src/github.com/user/stringutil/reverse_test.go containing the following Go code.

package stringutil

import "testing"

func TestReverse(t *testing.T) {
	cases := []struct {
		in, want string
	}{
		{"Hello, world", "dlrow ,olleH"},
		{"Hello, 世界", "界世 ,olleH"},
		{"", ""},
	}
	for _, c := range cases {
		got := Reverse(c.in)
		if got != c.want {
			t.Errorf("Reverse(%q) == %q, want %q", c.in, got, c.want)
		}
	}
}
Then run the test with go test:

$ go test github.com/user/stringutil
ok  	github.com/user/stringutil 0.165s
As always, if you are running the go tool from the package directory, you can omit the package path:

$ go test
ok  	github.com/user/stringutil 0.165s
To give you an idea of how a workspace looks in practice, here's an example:

bin/
    hello                          # command executable
    outyet                         # command executable
src/
    golang.org/x/example/
        .git/                      # Git repository metadata
	hello/
	    hello.go               # command source
	outyet/
	    main.go                # command source
	    main_test.go           # test source
	stringutil/
	    reverse.go             # package source
	    reverse_test.go        # test source
    golang.org/x/image/
        .git/                      # Git repository metadata
	bmp/
	    reader.go              # package source
	    writer.go              # package source
    ... (many more repositories and packages omitted) ...
After issuing the above go get command, the workspace directory tree should now look like this:

bin/
    hello                           # command executable
src/
    golang.org/x/example/
	.git/                       # Git repository metadata
        hello/
            hello.go                # command source
        stringutil/
            reverse.go              # package source
            reverse_test.go         # test source
    github.com/user/
        hello/
            hello.go                # command source
        stringutil/
            reverse.go              # package source
            reverse_test.go         # test source
Now, test that the package compiles with go build:

$ go build github.com/user/stringutil

Recommend

How to Write Go Code (with GOPATH) Code organization Package names

How to Write Go Code (with GOPATH) Code organization Your first library

How to Write Go Code (with GOPATH) Code organization Your first program

How to Write Go Code (with GOPATH) Code organization Import paths

How to Write Go Code (with GOPATH) Code organization The GOPATH environment variable

How to Write Go Code (with GOPATH) Code organization Workspaces

Go 1.4 Release Notes Changes to the standard library Minor changes to the library

Go 1.4 Release Notes Changes to the implementations and tools Canonical import paths

Go 1.4 Release Notes Changes to the implementations and tools Assembly

Go 1.4 Release Notes Changes to the language Method calls on **T

Go 1.4 Release Notes Changes to the language For-range loops

Go 1.16 Release Notes Tools Vet New warning for invalid testing.T use in goroutines

Go 1.11 Release Notes Core library Minor changes to the library

Go 1.11 Release Notes Performance Compiler toolchain

Go 1.11 Release Notes Tools Vet

Go 1.11 Release Notes Tools Compiler toolchain

Go Frequently Asked Questions (FAQ) Changes from C Why are declarations backwards?

Go Frequently Asked Questions (FAQ) Implementation Can I stop these complaints about my unused variable/import?

Go Frequently Asked Questions (FAQ) Packages and Testing How do I write a unit test?

Go Frequently Asked Questions (FAQ) Type Parameters Why can't I use a more specific type for the receiver of a parameterized type?

Frequently Asked Questions (FAQ) Type Parameters Why does Go use square brackets for type parameter lists?

Frequently Asked Questions (FAQ) Control flow Why does Go not have the ?: operator?

Go Frequently Asked Questions (FAQ) Functions and Methods What happens with closures running as goroutines?

Go Frequently Asked Questions (FAQ) Functions and Methods Why do T and *T have different method sets?

Go Frequently Asked Questions (FAQ) Pointers and Allocation What is the size of an int on a 64 bit machine?

Go Frequently Asked Questions (FAQ) Pointers and Allocation Should I define methods on values or pointers?

Go Frequently Asked Questions (FAQ) Pointers and Allocation When should I use a pointer to an interface?

Go Frequently Asked Questions (FAQ) Writing Code How should I manage package versions using go get ?

Go Frequently Asked Questions (FAQ) Writing Code Why does go get use HTTPS when cloning a repository?

Frequently Asked Questions (FAQ) Values How do constants work in Go?

Frequently Asked Questions (FAQ) Types Why does Go not have covariant result types?

Go Frequently Asked Questions (FAQ) Types Why is my nil error value not equal to nil?

Go Frequently Asked Questions (FAQ) Types Can I convert []T1 to []T2 if T1 and T2 have the same underlying type?

Go Frequently Asked Questions (FAQ) Types Can I convert a []T to an []interface{}?

Go Frequently Asked Questions (FAQ) Types Why doesn't type T satisfy the Equal interface?

Go Frequently Asked Questions (FAQ) Types How can I guarantee my type satisfies an interface?

Go 1.9 Release Notes Changes to the language

Effective Go A web server

Effective Go Errors Recover

Effective Go Errors Panic

Effective Go Errors

Effective Go Concurrency A leaky buffer

Effective Go Concurrency Parallelization

Effective Go Concurrency Channels of channels

Effective Go Concurrency Channels

Effective Go Concurrency Goroutines