]> Cypherpunks repositories - gostls13.git/commitdiff
clean up some BUG/TODO in go code
authorRuss Cox <rsc@golang.org>
Wed, 1 Jul 2009 14:32:04 +0000 (07:32 -0700)
committerRuss Cox <rsc@golang.org>
Wed, 1 Jul 2009 14:32:04 +0000 (07:32 -0700)
R=r
DELTA=23  (1 added, 12 deleted, 10 changed)
OCL=30957
CL=30980

src/pkg/bufio/bufio.go
src/pkg/flag/flag.go
src/pkg/io/io.go
src/pkg/net/dnsclient.go
src/pkg/net/dnsconfig.go
src/pkg/net/ip.go
src/pkg/net/net.go
src/pkg/os/path_test.go

index 4cbebddb548bac346d8549309f69e83a1824ffaf..7e4df4ef5c44227903d9b7a990d20fc8e7eaa7f3 100644 (file)
@@ -270,9 +270,7 @@ func (b *Reader) ReadLineSlice(delim byte) (line []byte, err os.Error) {
                        return nil, ErrBufferFull
                }
        }
-
-       // BUG 6g bug100
-       return nil, nil
+       panic("not reached");
 }
 
 // ReadLineBytes reads until the first occurrence of delim in the input,
@@ -323,7 +321,6 @@ func (b *Reader) ReadLineBytes(delim byte) (line []byte, err os.Error) {
                        full = make([][]byte, 16);
                } else if nfull >= len(full) {
                        newfull := make([][]byte, len(full)*2);
-                       // BUG slice assignment
                        for i := 0; i < len(full); i++ {
                                newfull[i] = full[i];
                        }
index 392f089cd6db4f7b348e64d2f70cad6f8b86d97c..437aaf230a09402e4ab9758fc5dff25a15c93952 100644 (file)
@@ -48,7 +48,7 @@ import (
        "strconv"
 )
 
-// BUG: atob belongs elsewhere
+// TODO(r): BUG: atob belongs elsewhere
 func atob(str string) (value bool, ok bool) {
        switch str {
                case "1", "t", "T", "true", "TRUE", "True":
index 12b98921f7a0ca6ab2c2089486b7e21155f50a3d..e7f28a4ec5abcc6fccdf3afbaf9d43e5027006a8 100644 (file)
@@ -117,9 +117,7 @@ func ReadAtLeast(r Reader, buf []byte, min int) (n int, err os.Error) {
 // If an EOF happens after reading some but not all the bytes,
 // ReadFull returns ErrUnexpectedEOF.
 func ReadFull(r Reader, buf []byte) (n int, err os.Error) {
-       // TODO(rsc): 6g bug keeps us from writing the obvious 1-liner
-       n, err = ReadAtLeast(r, buf, len(buf));
-       return;
+       return ReadAtLeast(r, buf, len(buf));
 }
 
 // Copyn copies n bytes (or until an error) from src to dst.
index 72af10f543955fdb26f912bc8239d058b2f2e24f..57cf15c9212145b7000ba72b8c8878047fe5efa9 100644 (file)
@@ -88,7 +88,6 @@ func _Exchange(cfg *_DNS_Config, c Conn, name string) (m *_DNS_Msg, err os.Error
 
 // Find answer for name in dns message.
 // On return, if err == nil, addrs != nil.
-// TODO(rsc): Maybe return []IP instead?
 func answer(name, server string, dns *_DNS_Msg) (addrs []string, err *DNSError) {
        addrs = make([]string, 0, len(dns.answer));
 
index e56d964f2d8aa9b950aaa3da143c2a5a40f8ef59..7e455d5f8bc5065cf83a817e17b81271268b8aca 100644 (file)
@@ -29,10 +29,7 @@ var _DNS_configError os.Error;
 // of the host name to get the default search domain.
 // We assume it's in resolv.conf anyway.
 func _DNS_ReadConfig() (*_DNS_Config, os.Error) {
-       // TODO(rsc): 6g won't let me say file, err :=
-       var file *file;
-       var err os.Error;
-       file, err = open("/etc/resolv.conf");
+       file, err := open("/etc/resolv.conf");
        if err != nil {
                return nil, err
        }
index 774f048ca8036c3049d15e0c081d26fc8ef23a0f..8c52ede1e3f8ebd1af60a0329d33fe8299185858 100644 (file)
@@ -346,7 +346,6 @@ L:  for j < IPv6len {
                        if p4 == nil {
                                return nil
                        }
-                       // BUG: p[j:j+4] = p4
                        p[j] = p4[12];
                        p[j+1] = p4[13];
                        p[j+2] = p4[14];
index bbd89ca8453c2c45f46e826b6902cd7d65a65cf2..46efa6e58e08bebcb304e2dfab1e5224386aef6c 100644 (file)
@@ -777,11 +777,12 @@ func (l *ListenerUnix) AcceptUnix() (c *ConnUnix, raddr string, err os.Error) {
 // Accept implements the Accept method in the Listener interface;
 // it waits for the next call and returns a generic Conn.
 func (l *ListenerUnix) Accept() (c Conn, raddr string, err os.Error) {
-       // TODO(rsc): 6g bug prevents saying
-       //      c, raddr, err = l.AcceptUnix();
-       //      return;
-       c1, r1, e1 := l.AcceptUnix();
-       return c1, r1, e1;
+       // TODO(rsc): Should return l.AcceptUnix() be okay here?
+       // There is a type conversion -- the first return arg of
+       // l.AcceptUnix() is *ConnUnix and it gets converted to Conn
+       // in the explicit assignment.
+       c, raddr, err = l.AcceptUnix();
+       return;
 }
 
 
index bb6148920ed258bbf3dd70a62978be9fd2257fcc..ddb523b406d7d175277f44030b4b44547a142346 100644 (file)
@@ -109,9 +109,7 @@ func TestRemoveAll(t *testing.T) {
                t.Fatalf("MkdirAll %q: %s", dpath, err);
        }
 
-       // TODO(rsc): toss tmp once bug152 is fixed
-       tmp := []string{fpath, dpath+"/file1", path+"/zzz"};
-       for i, s := range tmp {
+       for i, s := range []string{fpath, dpath+"/file1", path+"/zzz"} {
                fd, err = os.Open(s, os.O_WRONLY | os.O_CREAT, 0666);
                if err != nil {
                        t.Fatalf("create %q: %s", s, err);