travis,internal/imports: check imports with a command, not a test
MODIFY
.travis.yml
.travis.yml
@@ -40,6 +40,7 @@ script:
- go build -v ./...
- go test -a $TAGS -v ./...
- if [[ $TRAVIS_SECURE_ENV_VARS = "true" ]]; then bash ./.travis/test-coverage.sh; fi
+ - ${TRAVIS_BUILD_DIR}/.travis/check-imports.sh
# This is run last since it alters the tree.
- ${TRAVIS_BUILD_DIR}/.travis/check-generate.sh

ADD
.travis/check-imports.sh
+#!/bin/bash
+
+set -e
+go run ./internal/imports/check-imports.go

RENAME
internal/imports/import.go
internal/imports/imports.go
MODIFY
internal/imports/imports_test.go
internal/imports/imports_test.go
@@ -7,8 +7,6 @@ package imports
import (
"fmt"
"go/token"
- "os"
- "path/filepath"
"reflect"
"testing"
)
@@ -84,15 +82,3 @@ func TestCheck(t *testing.T) {
})
}
}
-
-func TestBlacklistedImports(t *testing.T) {
- pwd, err := os.Getwd()
- if err != nil {
- t.Fatalf("could not retrieve current working directory: %v", err)
- }
- dir := filepath.Join(pwd, "../..") // Gonum top directory
- err = CheckBlacklisted(dir, blacklist)
- if err != nil {
- t.Fatal(err)
- }
-}

travis,internal/imports: check imports with a command, not a test