summaryrefslogtreecommitdiff
path: root/src/pkg/http
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2009-06-24 20:12:50 -0700
committerRuss Cox <rsc@golang.org>2009-06-24 20:12:50 -0700
commitdfafe9a353bd1d4dcbbde691b9c8cda2533f47a3 (patch)
treeedbec55b247a7a6543d84b4574fb88326833b3e1 /src/pkg/http
parente3fe6186634f9b74b9f39924516e24b068b9e141 (diff)
downloadgolang-dfafe9a353bd1d4dcbbde691b9c8cda2533f47a3.tar.gz
style police: parens in if, for, switch, range
R=r DELTA=32 (0 added, 3 deleted, 29 changed) OCL=30718 CL=30725
Diffstat (limited to 'src/pkg/http')
-rw-r--r--src/pkg/http/client_test.go7
-rw-r--r--src/pkg/http/request_test.go4
-rw-r--r--src/pkg/http/url.go10
3 files changed, 9 insertions, 12 deletions
diff --git a/src/pkg/http/client_test.go b/src/pkg/http/client_test.go
index ca4235879..919e556e4 100644
--- a/src/pkg/http/client_test.go
+++ b/src/pkg/http/client_test.go
@@ -27,10 +27,7 @@ func TestClient(t *testing.T) {
if err != nil {
t.Errorf("Error fetching URL: %v", err);
- } else {
- s := string(b);
- if (!strings.HasPrefix(s, "User-agent:")) {
- t.Errorf("Incorrect page body (did not begin with User-agent): %q", s);
- }
+ } else if s := string(b); !strings.HasPrefix(s, "User-agent:") {
+ t.Errorf("Incorrect page body (did not begin with User-agent): %q", s);
}
}
diff --git a/src/pkg/http/request_test.go b/src/pkg/http/request_test.go
index ab611a0ca..230fe7bbb 100644
--- a/src/pkg/http/request_test.go
+++ b/src/pkg/http/request_test.go
@@ -42,7 +42,7 @@ func TestParseForm(t *testing.T) {
if dlen, olen := len(data), len(test.out); dlen != olen {
t.Errorf("test %d: Have %d keys, want %d keys", i, dlen, olen);
}
- for k, vs := range(test.out) {
+ for k, vs := range test.out {
vec, ok := data[k];
if !ok {
t.Errorf("test %d: Missing key %q", i, k);
@@ -52,7 +52,7 @@ func TestParseForm(t *testing.T) {
t.Errorf("test %d: key %q: Have %d keys, want %d keys", i, k, dlen, olen);
continue
}
- for j, v := range(vs) {
+ for j, v := range vs {
if dv := vec.At(j); dv != v {
t.Errorf("test %d: key %q: val %d: Have %q, want %q", i, k, j, dv, v);
}
diff --git a/src/pkg/http/url.go b/src/pkg/http/url.go
index bd2bfcf93..156f3ad01 100644
--- a/src/pkg/http/url.go
+++ b/src/pkg/http/url.go
@@ -108,8 +108,8 @@ func URLEscape(s string) string {
spaceCount, hexCount := 0, 0;
for i := 0; i < len(s); i++ {
c := s[i];
- if (shouldEscape(c)) {
- if (c == ' ') {
+ if shouldEscape(c) {
+ if c == ' ' {
spaceCount++;
} else {
hexCount++;
@@ -128,7 +128,7 @@ func URLEscape(s string) string {
if !shouldEscape(c) {
t[j] = s[i];
j++;
- } else if (c == ' ') {
+ } else if c == ' ' {
t[j] = '+';
j++;
} else {
@@ -256,10 +256,10 @@ func ParseURL(rawurl string) (url *URL, err os.Error) {
if url.Userinfo, err = URLUnescape(url.Userinfo); err != nil {
return nil, err
}
- if (strings.Index(url.Scheme, "%") >= 0) {
+ if strings.Index(url.Scheme, "%") >= 0 {
return nil, BadURL{"hexadecimal escape in scheme"}
}
- if (strings.Index(url.Host, "%") >= 0) {
+ if strings.Index(url.Host, "%") >= 0 {
return nil, BadURL{"hexadecimal escape in host"}
}