• Testing files must be named like fileImTesting_test.go
package samepackage
 
import (
	"testing"
)
 
func TestSomeFunction(t *testing.T) {
	if failed {
		t.Errorf("SomeFunction(%v)=%v, want %v \n", input, result, expected)
	}
	if criticalFailure {
		t.Fatalf("SomeFunction(%v)=%v, want %v \n", input, result, expected)
	}
	t.Logf("this will print only if the test fails \n")
}
 
func TestSomeFunctionWithTestTable {
	table := []struct {
		input type
		expected type
	}{
		{input1, output1},
		{input2, output2},
		...
	}
	
	for _, data := range table {
		result := SomeFunction(data.input) 
		if failed {
			t.Errorf(
				"SomeFunction(%v)=%v, want %v \n", 
				data.input, 
				result, 
				data.expected
			)
		}
	}
}