package cmd

import (
	"path/filepath"
	"testing"
)

func TestFindExistingPackage(t *testing.T) {
	path := findPackage("github.com/spf13/cobra")
	if path == "" {
		t.Fatal("findPackage didn't find the existing package")
	}
	if !hasGoPathPrefix(path) {
		t.Fatalf("%q is not in GOPATH, but must be", path)
	}
}

func hasGoPathPrefix(path string) bool {
	for _, srcPath := range srcPaths {
		if filepath.HasPrefix(path, srcPath) {
			return true
		}
	}
	return false
}

package cmd

import (
	"path/filepath"
	"testing"
)

func TestFindExistingPackage(t *testing.T) {
	path := findPackage("github.com/spf13/cobra")
	if path == "" {
		t.Fatal("findPackage didn't find the existing package")
	}
	if !hasGoPathPrefix(path) {
		t.Fatal("%q is not in GOPATH, but must be", path)
	}
}

func hasGoPathPrefix(path string) bool {
	for _, srcPath := range srcPaths {
		if filepath.HasPrefix(path, srcPath) {
			return true
		}
	}
	return false
}

--- 
+++ 
@@ -11,7 +11,7 @@
 		t.Fatal("findPackage didn't find the existing package")
 	}
 	if !hasGoPathPrefix(path) {
-		t.Fatal("%q is not in GOPATH, but must be", path)
+		t.Fatalf("%q is not in GOPATH, but must be", path)
 	}
 }
 
cmd: Use Fatalf instead of Fatal
