summaryrefslogtreecommitdiff
path: root/src/cmd
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2009-09-17 10:27:04 -0700
committerRuss Cox <rsc@golang.org>2009-09-17 10:27:04 -0700
commite79b89f07fbe2053c5ded679ada527e6a27b3b0a (patch)
tree96bb437a1d051ac0f6b76d09ac22aad882fa6d60 /src/cmd
parent3f4f89ac9bb7300c41b6c66e0d4fd0c9fabce9e8 (diff)
downloadgolang-e79b89f07fbe2053c5ded679ada527e6a27b3b0a.tar.gz
unused imports
R=r OCL=34731 CL=34731
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/ebnflint/ebnflint.go3
-rw-r--r--src/cmd/godoc/godoc.go2
-rw-r--r--src/cmd/gofmt/gofmt.go2
-rwxr-xr-xsrc/cmd/gotest/gotest32
4 files changed, 18 insertions, 21 deletions
diff --git a/src/cmd/ebnflint/ebnflint.go b/src/cmd/ebnflint/ebnflint.go
index 762815972..606961e7d 100644
--- a/src/cmd/ebnflint/ebnflint.go
+++ b/src/cmd/ebnflint/ebnflint.go
@@ -13,7 +13,6 @@ import (
"io";
"os";
"path";
- "sort";
"strings";
)
@@ -47,7 +46,7 @@ func extractEBNF(src []byte) []byte {
i += len(open);
// write as many newlines as found in the excluded text
- // to maintain correct line numbers in error messages
+ // to maintain correct line numbers in error messages
for _, ch := range src[0 : i] {
if ch == '\n' {
buf.WriteByte('\n');
diff --git a/src/cmd/godoc/godoc.go b/src/cmd/godoc/godoc.go
index 36e66a211..5164c39c2 100644
--- a/src/cmd/godoc/godoc.go
+++ b/src/cmd/godoc/godoc.go
@@ -40,13 +40,11 @@ import (
"http";
"io";
"log";
- "net";
"os";
pathutil "path";
"sort";
"strings";
"sync";
- "syscall";
"template";
"time";
)
diff --git a/src/cmd/gofmt/gofmt.go b/src/cmd/gofmt/gofmt.go
index 53fe46d24..9442957a9 100644
--- a/src/cmd/gofmt/gofmt.go
+++ b/src/cmd/gofmt/gofmt.go
@@ -11,10 +11,8 @@ import (
"go/parser";
"go/printer";
"go/scanner";
- "io";
"os";
pathutil "path";
- "sort";
"strings";
)
diff --git a/src/cmd/gotest/gotest b/src/cmd/gotest/gotest
index e07932b52..5ee3eb0a8 100755
--- a/src/cmd/gotest/gotest
+++ b/src/cmd/gotest/gotest
@@ -86,11 +86,23 @@ MAKELEVEL=
importpath=$(make -s importpath)
{
+ # test functions are named TestFoo
+ # the grep -v eliminates methods and other special names
+ # that have multiple dots.
+ pattern='Test([^a-z].*)?'
+ tests=$(6nm -s _test/$importpath.a $xofile | egrep ' T .*·'$pattern'$' | grep -v '·.*[.·]' | sed 's/.* //; s/·/./')
+ if [ "x$tests" = x ]; then
+ echo 'gotest: error: no tests matching '$pattern in _test/$importpath.a $xofile 1>&2
+ exit 2
+ fi
+
# package spec
echo 'package main'
echo
# imports
- echo 'import "'$importpath'"'
+ if echo "$tests" | egrep -v '_test\.' >/dev/null; then
+ echo 'import "'$importpath'"'
+ fi
if $havex; then
echo 'import "./_xtest_"'
fi
@@ -98,20 +110,10 @@ importpath=$(make -s importpath)
# test array
echo
echo 'var tests = []testing.Test {'
-
- # test functions are named TestFoo
- # the grep -v eliminates methods and other special names
- # that have multiple dots.
- pattern='Test([^a-z].*)?'
- tests=$(6nm -s _test/$importpath.a $xofile | egrep ' T .*·'$pattern'$' | grep -v '·.*[.·]' | sed 's/.* //; s/·/./')
- if [ "x$tests" = x ]; then
- echo 'gotest: warning: no tests matching '$pattern in _test/$importpath.a $xofile 1>&2
- else
- for i in $tests
- do
- echo ' testing.Test{ "'$i'", '$i' },'
- done
- fi
+ for i in $tests
+ do
+ echo ' testing.Test{ "'$i'", '$i' },'
+ done
echo '}'
# body
echo