]> Cypherpunks repositories - gostls13.git/commitdiff
build: remove dead code
authorRuss Cox <rsc@golang.org>
Fri, 22 Mar 2013 21:28:22 +0000 (17:28 -0400)
committerRuss Cox <rsc@golang.org>
Fri, 22 Mar 2013 21:28:22 +0000 (17:28 -0400)
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7877045

24 files changed:
src/cmd/go/discovery.go
src/cmd/yacc/yacc.go
src/pkg/compress/flate/inflate.go
src/pkg/compress/gzip/gunzip.go
src/pkg/compress/lzw/reader.go
src/pkg/crypto/dsa/dsa_test.go
src/pkg/crypto/rand/util.go
src/pkg/encoding/asn1/marshal.go
src/pkg/encoding/csv/reader.go
src/pkg/encoding/gob/decode.go
src/pkg/encoding/gob/type.go
src/pkg/encoding/json/decode.go
src/pkg/html/template/transition.go
src/pkg/math/big/nat.go
src/pkg/net/http/httputil/reverseproxy.go
src/pkg/net/ip.go
src/pkg/net/unixsock_posix.go
src/pkg/os/file_posix.go
src/pkg/os/getwd.go
src/pkg/reflect/tostring_test.go
src/pkg/strconv/extfloat.go
src/pkg/syscall/exec_bsd.go
src/pkg/testing/quick/quick.go
src/pkg/text/template/parse/parse.go

index d9f930867e0831362554b448d4e96006ee31895b..0478340505bc3973ea85f9ce2ed833d5f8470efe 100644 (file)
@@ -48,7 +48,6 @@ func parseMetaGoImports(r io.Reader) (imports []metaImport) {
                        })
                }
        }
-       return
 }
 
 // attrValue returns the attribute value for the case-insensitive key
index 0c18f93b6c95101cd5a9cd035f54c57b30aca70f..76b3aeac5d6217e05e1a9e6d879b2ba99df2e1f2 100644 (file)
@@ -3164,7 +3164,6 @@ func ungetrune(f *bufio.Reader, c rune) {
 
 func write(f *bufio.Writer, b []byte, n int) int {
        panic("write")
-       return 0
 }
 
 func open(s string) *bufio.Reader {
index 7fe1749631092b81545e9fd45297b1011018c7ca..beca34b4d8ce0eb385aedf52b8cc03a85f727157 100644 (file)
@@ -640,7 +640,6 @@ func (f *decompressor) huffSym(h *huffmanDecoder) (int, error) {
                        return int(chunk >> huffmanValueShift), nil
                }
        }
-       return 0, CorruptInputError(f.roffset)
 }
 
 // Flush any buffered output to the underlying writer.
index 33736f635082fd636fb07957803126993d7b88fe..1fb9b0964ce33399f768da7435f7db0cfc29eb62 100644 (file)
@@ -120,7 +120,6 @@ func (z *Reader) readString() (string, error) {
                        return string(z.buf[0:i]), nil
                }
        }
-       panic("not reached")
 }
 
 func (z *Reader) read2() (uint32, error) {
index cf8ca7c788a6fe987f2b917b3b53d9bf61b688d4..efbc758f94b8d0b80e1c02d64248eea210563c07 100644 (file)
@@ -202,7 +202,6 @@ func (d *decoder) decode() {
                        return
                }
        }
-       panic("unreachable")
 }
 
 func (d *decoder) flush() {
index 177aa444dfd207a9a20f730f96d7fb40c7c64f37..568416d0dfb23377129b7db9d5081a4cb762e4ae 100644 (file)
@@ -63,8 +63,9 @@ func testParameterGeneration(t *testing.T, sizes ParameterSizes, L, N int) {
 }
 
 func TestParameterGeneration(t *testing.T) {
-       // This test is too slow to run all the time.
-       return
+       if testing.Short() {
+               t.Skip("skipping parameter generation test in short mode")
+       }
 
        testParameterGeneration(t, L1024N160, 1024, 160)
        testParameterGeneration(t, L2048N224, 2048, 224)
index 50e5b162bdd615901e750b6c4133593ea44e8dff..21608dbaca8860905ab8d1c5b94758209d2b6541 100644 (file)
@@ -98,8 +98,6 @@ func Prime(rand io.Reader, bits int) (p *big.Int, err error) {
                        return
                }
        }
-
-       return
 }
 
 // Int returns a uniform random value in [0, max).
@@ -130,6 +128,4 @@ func Int(rand io.Reader, max *big.Int) (n *big.Int, err error) {
                        return
                }
        }
-
-       return
 }
index 0c216fdb3cd8947120587ed6b8454dac066f9dde..adaf80dcdb0a11f83a0d97793bd554e0601e0865 100644 (file)
@@ -460,7 +460,6 @@ func marshalBody(out *forkableWriter, value reflect.Value, params fieldParameter
                default:
                        return marshalUTF8String(out, v.String())
                }
-               return
        }
 
        return StructuralError{"unknown Go type"}
index 336dd6540d772383dace1c15f224149dc71b3afc..b099caf60a805cb157d277db5ba636c72fff6c16 100644 (file)
@@ -212,7 +212,6 @@ func (r *Reader) skip(delim rune) error {
                        return nil
                }
        }
-       panic("unreachable")
 }
 
 // parseRecord reads and parses a single csv record from r.
@@ -249,7 +248,6 @@ func (r *Reader) parseRecord() (fields []string, err error) {
                        return nil, err
                }
        }
-       panic("unreachable")
 }
 
 // parseField parses the next field in the record.  The read field is
index a80d9f9195fd930c4c067c0c9786fe2593c13fa8..7cc7565409c22ba2402ff85ba68be1ccf7d2903e 100644 (file)
@@ -1066,7 +1066,6 @@ func (dec *Decoder) compatibleType(fr reflect.Type, fw typeId, inProgress map[re
        case reflect.Struct:
                return true
        }
-       return true
 }
 
 // typeString returns a human-readable description of the type identified by remoteId.
index ea0db4eac45276a61768d3a384fcc6f35e298568..7fa0b499f02f781b181dafb22cb8ad5fe5d51fb4 100644 (file)
@@ -526,7 +526,6 @@ func newTypeObject(name string, ut *userTypeInfo, rt reflect.Type) (gobType, err
        default:
                return nil, errors.New("gob NewTypeObject can't handle type: " + rt.String())
        }
-       return nil, nil
 }
 
 // isExported reports whether this is an exported - upper case - name.
index 722037c30941223a01968bcf45c1ca08dbe38564..62ac294b89f3bd113c6b63f6974a1c4f7d147dcb 100644 (file)
@@ -868,7 +868,6 @@ func (d *decodeState) literalInterface() interface{} {
                }
                return n
        }
-       panic("unreachable")
 }
 
 // getu4 decodes \uXXXX from the beginning of s, returning the hex value,
index 2ea2089c6b034b698320999e749a07fada2d0aaa..564eb202075fafd3d90dad5b99d27cb21fc3b09f 100644 (file)
@@ -429,7 +429,6 @@ func tCSS(c context, s []byte) (context, int) {
                }
                k = i + 1
        }
-       panic("unreachable")
 }
 
 // tCSSStr is the context transition function for the CSS string and URL states.
@@ -470,7 +469,6 @@ func tCSSStr(c context, s []byte) (context, int) {
                c, _ = tURL(c, decodeCSS(s[:i+1]))
                k = i + 1
        }
-       panic("unreachable")
 }
 
 // tError is the context transition function for the error state.
index 9d09f97b77bf275c73bf3d6270ed98e7236d7d66..6874900d0bdecf0d7a69c8a3a78e573bf0012b61 100644 (file)
@@ -1021,8 +1021,6 @@ func trailingZeroBits(x Word) uint {
        default:
                panic("unknown word size")
        }
-
-       return 0
 }
 
 // trailingZeroBits returns the number of consecutive least significant zero
index 5099d973ff3d7ad275f456bdb33da1ebde1b9c15..1990f64dbd89253c653ab932e30144845d752fc9 100644 (file)
@@ -202,7 +202,6 @@ func (m *maxLatencyWriter) flushLoop() {
                        m.lk.Unlock()
                }
        }
-       panic("unreached")
 }
 
 func (m *maxLatencyWriter) stop() { m.done <- true }
index aee4064161c628a4883563ec65dc69de8240859d..b92b948784cb34d291f6826633413bc1f71a4b5a 100644 (file)
@@ -222,7 +222,6 @@ func (ip IP) DefaultMask() IPMask {
        default:
                return classCMask
        }
-       return nil // not reached
 }
 
 func allFF(b []byte) bool {
index 6d6ce3f5e200ecdc7a774ae88fefe325e5488174..8d57dacbd60cb15f9e8ee738da36cd481821ca0c 100644 (file)
@@ -99,7 +99,6 @@ func sotypeToNet(sotype int) string {
        default:
                panic("sotypeToNet unknown socket type")
        }
-       return ""
 }
 
 // UnixConn is an implementation of the Conn interface for connections
index b979fed97f7f9c77a336b4aff2e791c5d9b2e035..3df43feaa13c6b73f7e836bec51188c2886a4b10 100644 (file)
@@ -46,8 +46,6 @@ func Readlink(name string) (string, error) {
                        return string(b[0:n]), nil
                }
        }
-       // Silence 6g.
-       return "", nil
 }
 
 // Rename renames a file.
index 1b22123068dedfd90a757155798024657e033ff4..0235c5d779bdb6f3a4a42953bfbe0531b542b7c9 100644 (file)
@@ -90,8 +90,6 @@ func Getwd() (pwd string, err error) {
                                }
                        }
                }
-               fd.Close()
-               return "", ErrNotExist
 
        Found:
                pd, err := fd.Stat()
index 7486a9bfca3e935471de18bdaa14493d94519b5a..e416fd84da7bd15c355775a6843a034aa0b38178 100644 (file)
@@ -92,5 +92,4 @@ func valueToString(val Value) string {
        default:
                panic("valueToString: can't print type " + typ.String())
        }
-       return "valueToString: can't happen"
 }
index b7eaaa61bf4d92016c62a3fe4c4cd3bf6bb7da79..bed8b16bdaef3ca1f5eb4eb9b08f2a13eb856919 100644 (file)
@@ -636,7 +636,6 @@ func (f *extFloat) ShortestDecimal(d *decimalSlice, lower, upper *extFloat) bool
                                1<<shift, multiplier*2)
                }
        }
-       return false
 }
 
 // adjustLastDigit modifies d = x-currentDiff*ε, to get closest to
index 318cbc060c099bfa730ff4d3d4c34359b937acc6..bc644d97a4e1e2cb9a3e8d5f2606f1a58fb3d4b2 100644 (file)
@@ -215,11 +215,6 @@ childerror:
        for {
                RawSyscall(SYS_EXIT, 253, 0, 0)
        }
-
-       // Calling panic is not actually safe,
-       // but the for loop above won't break
-       // and this shuts up the compiler.
-       panic("unreached")
 }
 
 // Try to open a pipe with O_CLOEXEC set on both file descriptors.
index 2427098228170cabffb27dcd746a5e8a1d69e4da..761a6471b57564a861c0d353724a2a9c5dba4d5c 100644 (file)
@@ -140,8 +140,6 @@ func Value(t reflect.Type, rand *rand.Rand) (value reflect.Value, ok bool) {
        default:
                return reflect.Value{}, false
        }
-
-       return
 }
 
 // A Config structure contains options for running a test.
index 03bd22d95c76b9e7a21a6ddf4d7e3b4254abb5f2..802e298c23007b604ad0bcc8a734e33d53485e2f 100644 (file)
@@ -429,7 +429,6 @@ func (t *Tree) pipeline(context string) (pipe *PipeNode) {
                        t.unexpected(token, context)
                }
        }
-       return
 }
 
 func (t *Tree) parseControl(context string) (pos Pos, line int, pipe *PipeNode, list, elseList *ListNode) {