|
|
@ -12,12 +12,20 @@ import (
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
func TestUsedConsistently(t *testing.T) {
|
|
|
|
func TestUsedConsistently(t *testing.T) {
|
|
|
|
cmd := exec.Command("git", "grep", "-l", "-F", "http.Method")
|
|
|
|
|
|
|
|
dir, err := os.Getwd()
|
|
|
|
dir, err := os.Getwd()
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
cmd.Dir = filepath.Join(dir, "../..")
|
|
|
|
rootDir := filepath.Join(dir, "../..")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// If we don't have a .git directory, we're not in a git checkout (e.g.
|
|
|
|
|
|
|
|
// a downstream package); skip this test.
|
|
|
|
|
|
|
|
if _, err := os.Stat(filepath.Join(rootDir, ".git")); err != nil {
|
|
|
|
|
|
|
|
t.Skipf("skipping test since .git doesn't exist: %v", err)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cmd := exec.Command("git", "grep", "-l", "-F", "http.Method")
|
|
|
|
|
|
|
|
cmd.Dir = rootDir
|
|
|
|
matches, _ := cmd.Output()
|
|
|
|
matches, _ := cmd.Output()
|
|
|
|
for _, fn := range strings.Split(strings.TrimSpace(string(matches)), "\n") {
|
|
|
|
for _, fn := range strings.Split(strings.TrimSpace(string(matches)), "\n") {
|
|
|
|
switch fn {
|
|
|
|
switch fn {
|
|
|
|