- fine-tuning of one-line func heuristic (nodes.go)
- enabled for function declarations (not just function literals)
- applied gofmt -w $GOROOT/src
(look for instance at src/pkg/debug/elf/elf.go)
R=r, rsc
CC=go-dev
http://go/go-review/1026006
diff --git a/src/pkg/net/dnsclient.go b/src/pkg/net/dnsclient.go
index 3c28300..4a3b7dc 100644
--- a/src/pkg/net/dnsclient.go
+++ b/src/pkg/net/dnsclient.go
@@ -178,9 +178,7 @@
var cfg *_DNS_Config
var dnserr os.Error
-func loadConfig() {
- cfg, dnserr = _DNS_ReadConfig();
-}
+func loadConfig() { cfg, dnserr = _DNS_ReadConfig() }
func isDomainName(s string) bool {
// Requirements on DNS name:
diff --git a/src/pkg/net/dnsmsg.go b/src/pkg/net/dnsmsg.go
index 93ab3aa..c7c27e3 100644
--- a/src/pkg/net/dnsmsg.go
+++ b/src/pkg/net/dnsmsg.go
@@ -231,9 +231,7 @@
A uint32 "ipv4";
}
-func (rr *_DNS_RR_A) Header() *_DNS_RR_Header {
- return &rr.Hdr;
-}
+func (rr *_DNS_RR_A) Header() *_DNS_RR_Header { return &rr.Hdr }
// Packing and unpacking.
@@ -521,9 +519,7 @@
return s;
}
-func printStruct(any interface{}) string {
- return printStructValue(structValue(any));
-}
+func printStruct(any interface{}) string { return printStructValue(structValue(any)) }
// Resource record packer.
func packRR(rr _DNS_RR, msg []byte, off int) (off2 int, ok bool) {
diff --git a/src/pkg/net/fd.go b/src/pkg/net/fd.go
index 3c32646..bcb7372 100644
--- a/src/pkg/net/fd.go
+++ b/src/pkg/net/fd.go
@@ -270,9 +270,7 @@
var wakeupbuf [1]byte
-func (s *pollServer) Wakeup() {
- s.pw.Write(&wakeupbuf);
-}
+func (s *pollServer) Wakeup() { s.pw.Write(&wakeupbuf) }
func (s *pollServer) WaitRead(fd *netFD) {
s.cr <- fd;
diff --git a/src/pkg/net/fd_darwin.go b/src/pkg/net/fd_darwin.go
index 8ae9f68..45acad6 100644
--- a/src/pkg/net/fd_darwin.go
+++ b/src/pkg/net/fd_darwin.go
@@ -107,6 +107,4 @@
return fd, mode, nil;
}
-func (p *pollster) Close() os.Error {
- return os.NewSyscallError("close", syscall.Close(p.kq));
-}
+func (p *pollster) Close() os.Error { return os.NewSyscallError("close", syscall.Close(p.kq)) }
diff --git a/src/pkg/net/fd_nacl.go b/src/pkg/net/fd_nacl.go
index 36a012b..3167964 100644
--- a/src/pkg/net/fd_nacl.go
+++ b/src/pkg/net/fd_nacl.go
@@ -23,14 +23,11 @@
func (p *pollster) StopWaiting(fd int, bits uint) {
}
-func (p *pollster) DelFD(fd int, mode int) {
-}
+func (p *pollster) DelFD(fd int, mode int) {}
func (p *pollster) WaitFD(nsec int64) (fd int, mode int, err os.Error) {
_, err = newpollster();
return;
}
-func (p *pollster) Close() os.Error {
- return nil;
-}
+func (p *pollster) Close() os.Error { return nil }
diff --git a/src/pkg/net/ipsock.go b/src/pkg/net/ipsock.go
index 76a64e7..fd37155 100644
--- a/src/pkg/net/ipsock.go
+++ b/src/pkg/net/ipsock.go
@@ -30,9 +30,7 @@
// TODO(rsc): if syscall.OS == "linux", we're supposd to read
// /proc/sys/net/core/somaxconn,
// to take advantage of kernels that have raised the limit.
-func listenBacklog() int {
- return syscall.SOMAXCONN;
-}
+func listenBacklog() int { return syscall.SOMAXCONN }
// Internet sockets (TCP, UDP)
diff --git a/src/pkg/net/net.go b/src/pkg/net/net.go
index 9c3762a..d649756 100644
--- a/src/pkg/net/net.go
+++ b/src/pkg/net/net.go
@@ -266,6 +266,4 @@
type UnknownNetworkError string
-func (e UnknownNetworkError) String() string {
- return "unknown network " + string(e);
-}
+func (e UnknownNetworkError) String() string { return "unknown network " + string(e) }
diff --git a/src/pkg/net/parse.go b/src/pkg/net/parse.go
index a9ba2d2..9ed3f2d 100644
--- a/src/pkg/net/parse.go
+++ b/src/pkg/net/parse.go
@@ -17,9 +17,7 @@
data []byte;
}
-func (f *file) close() {
- f.file.Close();
-}
+func (f *file) close() { f.file.Close() }
func (f *file) getLineFromData() (s string, ok bool) {
data := f.data;
@@ -104,9 +102,7 @@
return a[0:n];
}
-func getFields(s string) []string {
- return splitAtBytes(s, " \r\t\n");
-}
+func getFields(s string) []string { return splitAtBytes(s, " \r\t\n") }
// Bigger than we need, not too big to worry about overflow
const big = 0xFFFFFF
diff --git a/src/pkg/net/tcpsock.go b/src/pkg/net/tcpsock.go
index 2c84be0..a49a73d 100644
--- a/src/pkg/net/tcpsock.go
+++ b/src/pkg/net/tcpsock.go
@@ -28,13 +28,9 @@
}
// Network returns the address's network name, "tcp".
-func (a *TCPAddr) Network() string {
- return "tcp";
-}
+func (a *TCPAddr) Network() string { return "tcp" }
-func (a *TCPAddr) String() string {
- return joinHostPort(a.IP.String(), itoa(a.Port));
-}
+func (a *TCPAddr) String() string { return joinHostPort(a.IP.String(), itoa(a.Port)) }
func (a *TCPAddr) family() int {
if a == nil || len(a.IP) <= 4 {
@@ -81,9 +77,7 @@
return c;
}
-func (c *TCPConn) ok() bool {
- return c != nil && c.fd != nil;
-}
+func (c *TCPConn) ok() bool { return c != nil && c.fd != nil }
// Implementation of the Conn interface - see Conn for documentation.
@@ -283,6 +277,4 @@
}
// Addr returns the listener's network address, a *TCPAddr.
-func (l *TCPListener) Addr() Addr {
- return l.fd.laddr;
-}
+func (l *TCPListener) Addr() Addr { return l.fd.laddr }
diff --git a/src/pkg/net/timeout_test.go b/src/pkg/net/timeout_test.go
index 0e03b63..acac3c7 100644
--- a/src/pkg/net/timeout_test.go
+++ b/src/pkg/net/timeout_test.go
@@ -28,9 +28,7 @@
}
}
-func TestTimeoutUDP(t *testing.T) {
- testTimeout(t, "udp", "127.0.0.1:53");
-}
+func TestTimeoutUDP(t *testing.T) { testTimeout(t, "udp", "127.0.0.1:53") }
func TestTimeoutTCP(t *testing.T) {
// 74.125.19.99 is www.google.com.
diff --git a/src/pkg/net/udpsock.go b/src/pkg/net/udpsock.go
index f3b6bf6..4449e83 100644
--- a/src/pkg/net/udpsock.go
+++ b/src/pkg/net/udpsock.go
@@ -28,14 +28,9 @@
}
// Network returns the address's network name, "udp".
-func (a *UDPAddr) Network() string {
- return "udp";
-}
+func (a *UDPAddr) Network() string { return "udp" }
-func (a *UDPAddr) String() string {
- return joinHostPort(a.IP.String(), itoa(a.Port));
-
-}
+func (a *UDPAddr) String() string { return joinHostPort(a.IP.String(), itoa(a.Port)) }
func (a *UDPAddr) family() int {
if a == nil || len(a.IP) <= 4 {
@@ -76,13 +71,9 @@
fd *netFD;
}
-func newUDPConn(fd *netFD) *UDPConn {
- return &UDPConn{fd};
-}
+func newUDPConn(fd *netFD) *UDPConn { return &UDPConn{fd} }
-func (c *UDPConn) ok() bool {
- return c != nil && c.fd != nil;
-}
+func (c *UDPConn) ok() bool { return c != nil && c.fd != nil }
// Implementation of the Conn interface - see Conn for documentation.
diff --git a/src/pkg/net/unixsock.go b/src/pkg/net/unixsock.go
index b30d7f2..033f650 100644
--- a/src/pkg/net/unixsock.go
+++ b/src/pkg/net/unixsock.go
@@ -127,13 +127,9 @@
fd *netFD;
}
-func newUnixConn(fd *netFD) *UnixConn {
- return &UnixConn{fd};
-}
+func newUnixConn(fd *netFD) *UnixConn { return &UnixConn{fd} }
-func (c *UnixConn) ok() bool {
- return c != nil && c.fd != nil;
-}
+func (c *UnixConn) ok() bool { return c != nil && c.fd != nil }
// Implementation of the Conn interface - see Conn for documentation.
@@ -400,9 +396,7 @@
}
// Addr returns the listener's network address.
-func (l *UnixListener) Addr() Addr {
- return l.fd.laddr;
-}
+func (l *UnixListener) Addr() Addr { return l.fd.laddr }
// ListenUnixgram listens for incoming Unix datagram packets addressed to the
// local address laddr. The returned connection c's ReadFrom