Commit 20011bc8 authored by Russ Cox's avatar Russ Cox

unused imports

R=r
OCL=34731
CL=34731
parent 1401151a
...@@ -13,7 +13,6 @@ import ( ...@@ -13,7 +13,6 @@ import (
"io"; "io";
"os"; "os";
"path"; "path";
"sort";
"strings"; "strings";
) )
...@@ -47,7 +46,7 @@ func extractEBNF(src []byte) []byte { ...@@ -47,7 +46,7 @@ func extractEBNF(src []byte) []byte {
i += len(open); i += len(open);
// write as many newlines as found in the excluded text // 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] { for _, ch := range src[0 : i] {
if ch == '\n' { if ch == '\n' {
buf.WriteByte('\n'); buf.WriteByte('\n');
......
...@@ -40,13 +40,11 @@ import ( ...@@ -40,13 +40,11 @@ import (
"http"; "http";
"io"; "io";
"log"; "log";
"net";
"os"; "os";
pathutil "path"; pathutil "path";
"sort"; "sort";
"strings"; "strings";
"sync"; "sync";
"syscall";
"template"; "template";
"time"; "time";
) )
......
...@@ -11,10 +11,8 @@ import ( ...@@ -11,10 +11,8 @@ import (
"go/parser"; "go/parser";
"go/printer"; "go/printer";
"go/scanner"; "go/scanner";
"io";
"os"; "os";
pathutil "path"; pathutil "path";
"sort";
"strings"; "strings";
) )
......
...@@ -86,11 +86,23 @@ MAKELEVEL= ...@@ -86,11 +86,23 @@ MAKELEVEL=
importpath=$(make -s importpath) 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 # package spec
echo 'package main' echo 'package main'
echo echo
# imports # imports
echo 'import "'$importpath'"' if echo "$tests" | egrep -v '_test\.' >/dev/null; then
echo 'import "'$importpath'"'
fi
if $havex; then if $havex; then
echo 'import "./_xtest_"' echo 'import "./_xtest_"'
fi fi
...@@ -98,20 +110,10 @@ importpath=$(make -s importpath) ...@@ -98,20 +110,10 @@ importpath=$(make -s importpath)
# test array # test array
echo echo
echo 'var tests = []testing.Test {' echo 'var tests = []testing.Test {'
for i in $tests
# test functions are named TestFoo do
# the grep -v eliminates methods and other special names echo ' testing.Test{ "'$i'", '$i' },'
# that have multiple dots. done
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
echo '}' echo '}'
# body # body
echo echo
......
...@@ -6,7 +6,6 @@ package tar ...@@ -6,7 +6,6 @@ package tar
import ( import (
"bytes"; "bytes";
"fmt";
"io"; "io";
"os"; "os";
"reflect"; "reflect";
......
...@@ -8,9 +8,6 @@ import ( ...@@ -8,9 +8,6 @@ import (
"bytes"; "bytes";
"fmt"; "fmt";
"io"; "io";
"os";
"reflect";
"strings";
"testing"; "testing";
) )
......
...@@ -10,11 +10,7 @@ package flate ...@@ -10,11 +10,7 @@ package flate
import ( import (
"bytes"; "bytes";
"bufio";
"io";
"os";
"reflect"; "reflect";
"strconv";
"testing"; "testing";
) )
......
...@@ -6,7 +6,6 @@ package gzip ...@@ -6,7 +6,6 @@ package gzip
import ( import (
"bytes"; "bytes";
"fmt";
"io"; "io";
"os"; "os";
"testing"; "testing";
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
package aes package aes
import ( import (
"fmt";
"testing"; "testing";
) )
......
...@@ -14,7 +14,6 @@ import ( ...@@ -14,7 +14,6 @@ import (
"bytes"; "bytes";
"crypto/aes"; "crypto/aes";
"io"; "io";
"os";
"testing"; "testing";
) )
......
...@@ -14,7 +14,6 @@ import ( ...@@ -14,7 +14,6 @@ import (
"bytes"; "bytes";
"crypto/aes"; "crypto/aes";
"io"; "io";
"os";
"testing"; "testing";
) )
......
...@@ -7,10 +7,7 @@ ...@@ -7,10 +7,7 @@
package block package block
import ( import "os"
"io";
"os";
)
const ( const (
// minimal irreducible polynomial of degree b // minimal irreducible polynomial of degree b
......
...@@ -14,7 +14,6 @@ import ( ...@@ -14,7 +14,6 @@ import (
"bytes"; "bytes";
"crypto/aes"; "crypto/aes";
"io"; "io";
"os";
"testing"; "testing";
) )
......
...@@ -14,7 +14,6 @@ import ( ...@@ -14,7 +14,6 @@ import (
"bytes"; "bytes";
"crypto/aes"; "crypto/aes";
"io"; "io";
"os";
"testing"; "testing";
) )
......
...@@ -14,7 +14,6 @@ import ( ...@@ -14,7 +14,6 @@ import (
"bytes"; "bytes";
"crypto/aes"; "crypto/aes";
"io"; "io";
"os";
"testing"; "testing";
) )
......
...@@ -203,15 +203,12 @@ package datafmt ...@@ -203,15 +203,12 @@ package datafmt
import ( import (
"bytes"; "bytes";
"container/vector";
"fmt"; "fmt";
"go/token"; "go/token";
"io"; "io";
"os"; "os";
"reflect"; "reflect";
"runtime"; "runtime";
"strconv";
"strings";
) )
......
...@@ -6,7 +6,6 @@ package datafmt ...@@ -6,7 +6,6 @@ package datafmt
import ( import (
"fmt"; "fmt";
"os";
"strings"; "strings";
"testing"; "testing";
) )
......
...@@ -6,7 +6,6 @@ package datafmt ...@@ -6,7 +6,6 @@ package datafmt
import ( import (
"container/vector"; "container/vector";
"fmt";
"go/scanner"; "go/scanner";
"go/token"; "go/token";
"os"; "os";
......
...@@ -10,10 +10,7 @@ ...@@ -10,10 +10,7 @@
package dwarf package dwarf
import ( import "os"
"os";
"strconv";
)
// a single entry's description: a sequence of attributes // a single entry's description: a sequence of attributes
type abbrev struct { type abbrev struct {
......
...@@ -9,7 +9,6 @@ package dwarf ...@@ -9,7 +9,6 @@ package dwarf
import ( import (
"debug/binary"; "debug/binary";
"fmt";
"os"; "os";
) )
......
...@@ -8,10 +8,7 @@ ...@@ -8,10 +8,7 @@
package gosym package gosym
import ( import "debug/binary"
"debug/binary";
"io";
)
type LineTable struct { type LineTable struct {
Data []byte; Data []byte;
......
...@@ -6,8 +6,6 @@ package gosym ...@@ -6,8 +6,6 @@ package gosym
import ( import (
"debug/elf"; "debug/elf";
"exec";
"io";
"os"; "os";
"testing"; "testing";
"syscall"; "syscall";
......
...@@ -13,15 +13,15 @@ package proc ...@@ -13,15 +13,15 @@ package proc
// and proc_darwin.go do, because deps.bash only looks at // and proc_darwin.go do, because deps.bash only looks at
// this file. // this file.
import ( import (
"container/vector"; _ "container/vector";
"fmt"; _ "fmt";
"io"; _ "io";
"os"; "os";
"runtime"; _ "runtime";
"strconv"; "strconv";
"strings"; _ "strings";
"sync"; _ "sync";
"syscall"; _ "syscall";
) )
type Word uint64 type Word uint64
......
...@@ -24,12 +24,9 @@ package ebnf ...@@ -24,12 +24,9 @@ package ebnf
import ( import (
"container/vector"; "container/vector";
"fmt";
"go/scanner"; "go/scanner";
"go/token"; "go/token";
"os"; "os";
"strconv";
"strings";
"unicode"; "unicode";
"utf8"; "utf8";
) )
......
...@@ -6,14 +6,10 @@ package ebnf ...@@ -6,14 +6,10 @@ package ebnf
import ( import (
"container/vector"; "container/vector";
"fmt";
"go/scanner"; "go/scanner";
"go/token"; "go/token";
"os"; "os";
"strconv"; "strconv";
"strings";
"unicode";
"utf8";
) )
......
...@@ -11,7 +11,6 @@ import ( ...@@ -11,7 +11,6 @@ import (
"bytes"; "bytes";
"fmt"; "fmt";
"http"; "http";
"io";
"log"; "log";
"strconv"; "strconv";
"sync"; "sync";
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
package exvar package exvar
import ( import (
"fmt";
"json"; "json";
"testing"; "testing";
) )
......
...@@ -6,7 +6,6 @@ package flag_test ...@@ -6,7 +6,6 @@ package flag_test
import ( import (
. "flag"; . "flag";
"fmt";
"testing"; "testing";
) )
......
...@@ -10,7 +10,6 @@ import ( ...@@ -10,7 +10,6 @@ import (
"math"; "math";
"strings"; "strings";
"testing"; "testing";
"unsafe";
) )
func TestFmtInterface(t *testing.T) { func TestFmtInterface(t *testing.T) {
......
...@@ -4,9 +4,6 @@ ...@@ -4,9 +4,6 @@
package ast package ast
import "go/token";
type Scope struct { type Scope struct {
Outer *Scope; Outer *Scope;
Names map[string]*Ident Names map[string]*Ident
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
package doc package doc
import ( import (
"fmt";
"go/ast"; "go/ast";
"io"; "io";
"once"; "once";
......
...@@ -6,13 +6,10 @@ package doc ...@@ -6,13 +6,10 @@ package doc
import ( import (
"container/vector"; "container/vector";
"fmt";
"go/ast"; "go/ast";
"go/token"; "go/token";
"io";
"regexp"; "regexp";
"sort"; "sort";
"strings";
) )
......
...@@ -8,11 +8,9 @@ package parser ...@@ -8,11 +8,9 @@ package parser
import ( import (
"bytes"; "bytes";
"container/vector";
"fmt"; "fmt";
"go/ast"; "go/ast";
"go/scanner"; "go/scanner";
"go/token";
"io"; "io";
"os"; "os";
pathutil "path"; pathutil "path";
......
...@@ -10,15 +10,11 @@ ...@@ -10,15 +10,11 @@
package parser package parser
import ( import (
"bytes";
"container/vector"; "container/vector";
"fmt"; "fmt";
"go/ast"; "go/ast";
"go/scanner"; "go/scanner";
"go/token"; "go/token";
"io";
"os";
"strings";
) )
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
package parser package parser
import ( import (
"go/ast";
"os"; "os";
"testing"; "testing";
) )
......
...@@ -10,7 +10,6 @@ import ( ...@@ -10,7 +10,6 @@ import (
"io"; "io";
"go/ast"; "go/ast";
"go/parser"; "go/parser";
"os";
"path"; "path";
"testing"; "testing";
) )
......
...@@ -8,7 +8,6 @@ import ( ...@@ -8,7 +8,6 @@ import (
"bytes"; "bytes";
"io"; "io";
"os"; "os";
"reflect";
"sync"; "sync";
) )
......
...@@ -10,7 +10,6 @@ import ( ...@@ -10,7 +10,6 @@ import (
"math"; "math";
"os"; "os";
"reflect"; "reflect";
"sync";
"unsafe"; "unsafe";
) )
......
...@@ -11,7 +11,6 @@ import ( ...@@ -11,7 +11,6 @@ import (
"reflect"; "reflect";
"strings"; "strings";
"testing"; "testing";
"unsafe";
) )
type ET2 struct { type ET2 struct {
......
...@@ -8,9 +8,7 @@ import ( ...@@ -8,9 +8,7 @@ import (
"fmt"; "fmt";
"os"; "os";
"reflect"; "reflect";
"strings";
"sync"; "sync";
"unicode";
) )
type kind reflect.Type type kind reflect.Type
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
package gob package gob
import ( import (
"os";
"reflect"; "reflect";
"testing"; "testing";
) )
......
...@@ -10,7 +10,6 @@ import ( ...@@ -10,7 +10,6 @@ import (
"bufio"; "bufio";
"fmt"; "fmt";
"io"; "io";
"log";
"net"; "net";
"os"; "os";
"strconv"; "strconv";
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
package http package http
import ( import (
"fmt";
"io"; "io";
"strings"; "strings";
"testing"; "testing";
......
...@@ -4,11 +4,7 @@ ...@@ -4,11 +4,7 @@
package http package http
import ( import "testing"
"fmt";
"os";
"testing";
)
type stringMultimap map[string] []string type stringMultimap map[string] []string
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
package io package io
import ( import (
"bytes";
"os"; "os";
"strings"; "strings";
) )
......
...@@ -12,10 +12,7 @@ package json ...@@ -12,10 +12,7 @@ package json
import ( import (
"bytes"; "bytes";
"fmt";
"math";
"strconv"; "strconv";
"strings";
"utf8"; "utf8";
) )
......
...@@ -7,7 +7,6 @@ package net ...@@ -7,7 +7,6 @@ package net
import ( import (
"flag"; "flag";
"io"; "io";
"os";
"strings"; "strings";
"syscall"; "syscall";
"testing"; "testing";
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package net package net
import ( import (
"io";
"once"; "once";
"os"; "os";
"strings"; "strings";
......
...@@ -6,11 +6,7 @@ ...@@ -6,11 +6,7 @@
package net package net
import ( import "os"
"io";
"os";
"strconv";
)
type _DNS_Config struct { type _DNS_Config struct {
servers []string; // servers to use servers []string; // servers to use
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
package net package net
import ( import (
"os";
"regexp"; "regexp";
"testing"; "testing";
) )
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
package net package net
import ( import (
"io";
"once"; "once";
"os"; "os";
) )
......
...@@ -6,7 +6,6 @@ package net ...@@ -6,7 +6,6 @@ package net
import ( import (
"io"; "io";
"os";
"strings"; "strings";
"syscall"; "syscall";
"testing"; "testing";
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
package net package net
import ( import (
"os";
"testing"; "testing";
"time"; "time";
) )
......
...@@ -6,10 +6,7 @@ ...@@ -6,10 +6,7 @@
package os package os
import ( import "syscall"
"syscall";
"unsafe";
)
var Args []string; // provided by runtime var Args []string; // provided by runtime
var Envs []string; // provided by runtime var Envs []string; // provided by runtime
......
...@@ -7,7 +7,6 @@ package reflect ...@@ -7,7 +7,6 @@ package reflect
import ( import (
"runtime"; "runtime";
"strconv"; "strconv";
"strings";
"unsafe"; "unsafe";
) )
......
...@@ -12,7 +12,6 @@ import ( ...@@ -12,7 +12,6 @@ import (
"log"; "log";
"net"; "net";
"os"; "os";
"strconv";
"sync"; "sync";
) )
......
...@@ -11,10 +11,7 @@ package rpc ...@@ -11,10 +11,7 @@ package rpc
import ( import (
"fmt"; "fmt";
"gob";
"http"; "http";
"io";
"log";
"os"; "os";
"sort"; "sort";
"template"; "template";
......
...@@ -5,9 +5,7 @@ ...@@ -5,9 +5,7 @@
package rpc package rpc
import ( import (
"gob";
"http"; "http";
"io";
"log"; "log";
"net"; "net";
"once"; "once";
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
package strconv_test package strconv_test
import ( import (
"fmt";
"os"; "os";
"reflect"; "reflect";
. "strconv"; . "strconv";
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
package strconv_test package strconv_test
import ( import (
"fmt";
"os"; "os";
"reflect"; "reflect";
. "strconv"; . "strconv";
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
package strconv_test package strconv_test
import ( import (
"fmt";
. "strconv"; . "strconv";
"testing"; "testing";
) )
......
...@@ -6,7 +6,6 @@ package strconv_test ...@@ -6,7 +6,6 @@ package strconv_test
import ( import (
"bufio"; "bufio";
"fmt"; "fmt";
"io";
"os"; "os";
"strconv"; "strconv";
"strings"; "strings";
......
...@@ -5,8 +5,6 @@ ...@@ -5,8 +5,6 @@
package strconv_test package strconv_test
import ( import (
"fmt";
"os";
. "strconv"; . "strconv";
"testing"; "testing";
) )
......
...@@ -11,8 +11,6 @@ ...@@ -11,8 +11,6 @@
// the manuals for the appropriate operating system. // the manuals for the appropriate operating system.
package syscall package syscall
import "unsafe"
func Syscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr) func Syscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr)
func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr) func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr)
func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr) func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr)
......
...@@ -10,7 +10,6 @@ import ( ...@@ -10,7 +10,6 @@ import (
"bytes"; "bytes";
"fmt"; "fmt";
"io"; "io";
"reflect";
"strings"; "strings";
) )
......
...@@ -9,8 +9,6 @@ import ( ...@@ -9,8 +9,6 @@ import (
"container/vector"; "container/vector";
"fmt"; "fmt";
"io"; "io";
"os";
"reflect";
"testing"; "testing";
) )
......
...@@ -7,7 +7,6 @@ package time ...@@ -7,7 +7,6 @@ package time
import ( import (
"os"; "os";
"syscall"; "syscall";
"unsafe";
) )
// Sleep pauses the current goroutine for ns nanoseconds. // Sleep pauses the current goroutine for ns nanoseconds.
......
...@@ -4,11 +4,6 @@ ...@@ -4,11 +4,6 @@
package time package time
import (
"syscall";
"unsafe";
)
// TODO(rsc): This implementation of Tick is a // TODO(rsc): This implementation of Tick is a
// simple placeholder. Eventually, there will need to be // simple placeholder. Eventually, there will need to be
// a single central time server no matter how many tickers // a single central time server no matter how many tickers
......
...@@ -6,7 +6,6 @@ package utf8_test ...@@ -6,7 +6,6 @@ package utf8_test
import ( import (
"bytes"; "bytes";
"fmt";
"strings"; "strings";
"testing"; "testing";
. "utf8"; . "utf8";
......
...@@ -39,7 +39,6 @@ package main ...@@ -39,7 +39,6 @@ package main
import ( import (
"flag"; "flag";
"fmt"; "fmt";
"os";
) )
var n = flag.Int("n", 15, "depth") var n = flag.Int("n", 15, "depth")
......
...@@ -39,7 +39,6 @@ package main ...@@ -39,7 +39,6 @@ package main
import ( import (
"flag"; "flag";
"fmt"; "fmt";
"os";
) )
var n = flag.Int("n", 15, "depth") var n = flag.Int("n", 15, "depth")
......
...@@ -6,11 +6,6 @@ ...@@ -6,11 +6,6 @@
package main package main
import (
"fmt";
"os";
)
type T struct { type T struct {
a float64; a float64;
b int64; b int64;
......
...@@ -4,5 +4,5 @@ ...@@ -4,5 +4,5 @@
package bug1 package bug1
import "./bug0" import _ "./bug0"
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
package main package main
import os "os" import os "os"
type _ os.Error
func f() (os int) { func f() (os int) {
// In the next line "os" should refer to the result variable, not // In the next line "os" should refer to the result variable, not
// to the package. // to the package.
......
...@@ -6,7 +6,9 @@ ...@@ -6,7 +6,9 @@
package foo package foo
import "fmt" import "fmt"
func f() { func f() {
fmt.Println();
fmt := 1; fmt := 1;
_ = fmt; _ = fmt;
} }
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
package bug2 package bug2
import "./bug1" import _ "./bug1"
import "./bug0" import "./bug0"
type T2 struct { t bug0.T } type T2 struct { t bug0.T }
......
...@@ -6,8 +6,6 @@ ...@@ -6,8 +6,6 @@
package main package main
import "fmt"
func main() { func main() {
xy := 1; // ERROR "identifier" xy := 1; // ERROR "identifier"
} }
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
package main package main
import "fmt"
import "reflect" import "reflect"
type S1 struct { i int } type S1 struct { i int }
type S2 struct { S1 } type S2 struct { S1 }
......
...@@ -9,6 +9,7 @@ package main ...@@ -9,6 +9,7 @@ package main
import "sort" import "sort"
func main() { func main() {
sort.Sort(nil);
var x int; var x int;
sort(x); // ERROR "package" sort(x); // ERROR "package"
} }
...@@ -7,3 +7,6 @@ package a ...@@ -7,3 +7,6 @@ package a
func init() { func init() {
println("a"); println("a");
} }
type T int;
...@@ -7,3 +7,5 @@ package b ...@@ -7,3 +7,5 @@ package b
func init() { func init() {
println("b"); println("b");
} }
type V int;
...@@ -9,5 +9,8 @@ package main ...@@ -9,5 +9,8 @@ package main
import . "./a" import . "./a"
import . "./b" import . "./b"
var _ T
var _ V
func main() { func main() {
} }
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
package main package main
import "log"
import "time" import "time"
func f() { func f() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment