diff options
| author | Dominik Honnef <dominik@honnef.co> | 2016-03-21 00:12:18 +0100 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@golang.org> | 2016-03-25 06:28:13 +0000 |
| commit | fdba5a7544e54227c910ae3b26511c718df786a1 (patch) | |
| tree | b2acc55d32e25e299654ce0de1abf7bdd1eaa048 /src/cmd | |
| parent | 6a6a0734163567545aed2b558f24f2aafc6c9072 (diff) | |
| download | go-fdba5a7544e54227c910ae3b26511c718df786a1.tar.xz | |
all: delete dead non-test code
This change removes a lot of dead code. Some of the code has never been
used, not even when it was first commited. The rest shouldn't have
survived refactors.
This change doesn't remove unused routines helpful for debugging, nor
does it remove code that's used in commented out blocks of code that are
only unused temporarily. Furthermore, unused constants weren't removed
when they were part of a set of constants from specifications.
One noteworthy omission from this CL are about 1000 lines of unused code
in cmd/fix, 700 lines of which are the typechecker, which hasn't been
used ever since the pre-Go 1 fixes have been removed. I wasn't sure if
this code should stick around for future uses of cmd/fix or be culled as
well.
Change-Id: Ib714bc7e487edc11ad23ba1c3222d1fd02e4a549
Reviewed-on: https://go-review.googlesource.com/20926
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/cmd')
| -rw-r--r-- | src/cmd/api/goapi.go | 9 | ||||
| -rw-r--r-- | src/cmd/cgo/gcc.go | 3 | ||||
| -rw-r--r-- | src/cmd/dist/util.go | 1 | ||||
| -rw-r--r-- | src/cmd/doc/pkg.go | 20 | ||||
| -rw-r--r-- | src/cmd/go/build.go | 10 | ||||
| -rw-r--r-- | src/cmd/go/generate.go | 12 | ||||
| -rw-r--r-- | src/cmd/go/main.go | 15 | ||||
| -rw-r--r-- | src/cmd/go/pkg.go | 1 | ||||
| -rw-r--r-- | src/cmd/pprof/internal/report/report.go | 36 | ||||
| -rw-r--r-- | src/cmd/yacc/yacc.go | 10 |
10 files changed, 10 insertions, 107 deletions
diff --git a/src/cmd/api/goapi.go b/src/cmd/api/goapi.go index b946077276..982c40b085 100644 --- a/src/cmd/api/goapi.go +++ b/src/cmd/api/goapi.go @@ -368,15 +368,6 @@ func (w *Walker) parseFile(dir, file string) (*ast.File, error) { return f, nil } -func contains(list []string, s string) bool { - for _, t := range list { - if t == s { - return true - } - } - return false -} - // The package cache doesn't operate correctly in rare (so far artificial) // circumstances (issue 8425). Disable before debugging non-obvious errors // from the type-checker. diff --git a/src/cmd/cgo/gcc.go b/src/cmd/cgo/gcc.go index b2835a495f..84cd2e816a 100644 --- a/src/cmd/cgo/gcc.go +++ b/src/cmd/cgo/gcc.go @@ -1282,8 +1282,7 @@ func runGcc(stdin []byte, args []string) (string, string) { // with equivalent memory layout. type typeConv struct { // Cache of already-translated or in-progress types. - m map[dwarf.Type]*Type - typedef map[string]ast.Expr + m map[dwarf.Type]*Type // Map from types to incomplete pointers to those types. ptrs map[dwarf.Type][]*Type diff --git a/src/cmd/dist/util.go b/src/cmd/dist/util.go index 57b1d2dd84..34f7372de8 100644 --- a/src/cmd/dist/util.go +++ b/src/cmd/dist/util.go @@ -131,7 +131,6 @@ var maxbg = 4 /* maximum number of jobs to run at once */ var ( bgwork = make(chan func(), 1e5) - bgdone = make(chan struct{}, 1e5) bghelpers sync.WaitGroup diff --git a/src/cmd/doc/pkg.go b/src/cmd/doc/pkg.go index a14ccdb59b..d0983d447d 100644 --- a/src/cmd/doc/pkg.go +++ b/src/cmd/doc/pkg.go @@ -29,17 +29,15 @@ const ( ) type Package struct { - writer io.Writer // Destination for output. - name string // Package name, json for encoding/json. - userPath string // String the user used to find this package. - unexported bool - matchCase bool - pkg *ast.Package // Parsed package. - file *ast.File // Merged from all files in the package - doc *doc.Package - build *build.Package - fs *token.FileSet // Needed for printing. - buf bytes.Buffer + writer io.Writer // Destination for output. + name string // Package name, json for encoding/json. + userPath string // String the user used to find this package. + pkg *ast.Package // Parsed package. + file *ast.File // Merged from all files in the package + doc *doc.Package + build *build.Package + fs *token.FileSet // Needed for printing. + buf bytes.Buffer } type PackageError string // type returned by pkg.Fatalf. diff --git a/src/cmd/go/build.go b/src/cmd/go/build.go index b63c195f78..08062ea9a5 100644 --- a/src/cmd/go/build.go +++ b/src/cmd/go/build.go @@ -1312,16 +1312,6 @@ func (b *builder) do(root *action) { wg.Wait() } -// hasString reports whether s appears in the list of strings. -func hasString(strings []string, s string) bool { - for _, t := range strings { - if s == t { - return true - } - } - return false -} - // build is the action for building a single package or command. func (b *builder) build(a *action) (err error) { // Return an error if the package has CXX files but it's not using diff --git a/src/cmd/go/generate.go b/src/cmd/go/generate.go index cbedacb34d..749e28c24d 100644 --- a/src/cmd/go/generate.go +++ b/src/cmd/go/generate.go @@ -17,7 +17,6 @@ import ( "runtime" "strconv" "strings" - "unicode" ) var cmdGenerate = &Command{ @@ -371,17 +370,6 @@ func (g *Generator) expandVar(word string) string { return os.Getenv(word) } -// identLength returns the length of the identifier beginning the string. -func (g *Generator) identLength(word string) int { - for i, r := range word { - if r == '_' || unicode.IsLetter(r) || unicode.IsDigit(r) { - continue - } - return i - } - return len(word) -} - // setShorthand installs a new shorthand as defined by a -command directive. func (g *Generator) setShorthand(words []string) { // Create command shorthand. diff --git a/src/cmd/go/main.go b/src/cmd/go/main.go index 65cbab2b0d..4e0987d69e 100644 --- a/src/cmd/go/main.go +++ b/src/cmd/go/main.go @@ -403,8 +403,6 @@ func errorf(format string, args ...interface{}) { setExitStatus(1) } -var logf = log.Printf - func exitIfErrors() { if exitStatus != 0 { exit() @@ -428,19 +426,6 @@ func run(cmdargs ...interface{}) { } } -func runOut(dir string, cmdargs ...interface{}) []byte { - cmdline := stringList(cmdargs...) - cmd := exec.Command(cmdline[0], cmdline[1:]...) - cmd.Dir = dir - out, err := cmd.CombinedOutput() - if err != nil { - os.Stderr.Write(out) - errorf("%v", err) - out = nil - } - return out -} - // envForDir returns a copy of the environment // suitable for running in the given directory. // The environment is the current process's environment diff --git a/src/cmd/go/pkg.go b/src/cmd/go/pkg.go index 927d68d1c6..fa923c8873 100644 --- a/src/cmd/go/pkg.go +++ b/src/cmd/go/pkg.go @@ -90,7 +90,6 @@ type Package struct { target string // installed file for this package (may be executable) fake bool // synthesized package external bool // synthesized external test package - forceBuild bool // this package must be rebuilt forceLibrary bool // this package is a library (even if named "main") cmdline bool // defined by files listed on command line local bool // imported via local path (./ or ../) diff --git a/src/cmd/pprof/internal/report/report.go b/src/cmd/pprof/internal/report/report.go index b2b07b24f9..86bd4a280b 100644 --- a/src/cmd/pprof/internal/report/report.go +++ b/src/cmd/pprof/internal/report/report.go @@ -10,7 +10,6 @@ import ( "fmt" "io" "math" - "os" "path/filepath" "regexp" "sort" @@ -248,14 +247,6 @@ func valueOrDot(value int64, rpt *Report) string { return rpt.formatValue(value) } -// canAccessFile determines if the filename can be opened for reading. -func canAccessFile(path string) bool { - if fi, err := os.Stat(path); err == nil { - return fi.Mode().Perm()&0400 != 0 - } - return false -} - // printTags collects all tags referenced in the profile and prints // them in a sorted table. func printTags(w io.Writer, rpt *Report) error { @@ -764,14 +755,6 @@ type node struct { tags tagMap } -func (ts tags) string() string { - var ret string - for _, s := range ts { - ret = ret + fmt.Sprintf("%s %s %d %d\n", s.name, s.unit, s.value, s.weight) - } - return ret -} - type nodeInfo struct { name string origName string @@ -1697,22 +1680,3 @@ type Report struct { sampleValue func(*profile.Sample) int64 formatValue func(int64) string } - -func (rpt *Report) formatTags(s *profile.Sample) (string, bool) { - var labels []string - for key, vals := range s.Label { - for _, v := range vals { - labels = append(labels, key+":"+v) - } - } - for key, nvals := range s.NumLabel { - for _, v := range nvals { - labels = append(labels, scaledValueLabel(v, key, "auto")) - } - } - if len(labels) == 0 { - return "", false - } - sort.Strings(labels) - return strings.Join(labels, `\n`), true -} diff --git a/src/cmd/yacc/yacc.go b/src/cmd/yacc/yacc.go index 4f9d13c545..cce330793d 100644 --- a/src/cmd/yacc/yacc.go +++ b/src/cmd/yacc/yacc.go @@ -237,7 +237,6 @@ var defact = make([]int, NSTATES) // default actions of states // lookahead set information -var lkst []Lkset var nolook = 0 // flag to turn off lookahead computations var tbitset = 0 // size of lookahead sets var clset Lkset // temporary storage for lookahead computations @@ -3185,8 +3184,6 @@ func isword(c rune) bool { return c >= 0xa0 || c == '_' || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') } -func mktemp(t string) string { return t } - // // return 1 if 2 arrays are equal // return 0 if not equal @@ -3204,13 +3201,6 @@ func aryeq(a []int, b []int) int { return 1 } -func putrune(f *bufio.Writer, c int) { - s := string(c) - for i := 0; i < len(s); i++ { - f.WriteByte(s[i]) - } -} - func getrune(f *bufio.Reader) rune { var r rune |
