diff options
author | Robert Griesemer <gri@golang.org> | 2009-12-15 15:35:38 -0800 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2009-12-15 15:35:38 -0800 |
commit | e4bd81f903362d998f7bfc02095935408aff0bc5 (patch) | |
tree | 05f75a90e239d33be427da4f9c5596d2fcb3dc96 /src/pkg/net/dnsconfig.go | |
parent | d9527dd16f72598b54a64550607bf892efa12384 (diff) | |
download | golang-e4bd81f903362d998f7bfc02095935408aff0bc5.tar.gz |
1) Change default gofmt default settings for
parsing and printing to new syntax.
Use -oldparser to parse the old syntax,
use -oldprinter to print the old syntax.
2) Change default gofmt formatting settings
to use tabs for indentation only and to use
spaces for alignment. This will make the code
alignment insensitive to an editor's tabwidth.
Use -spaces=false to use tabs for alignment.
3) Manually changed src/exp/parser/parser_test.go
so that it doesn't try to parse the parser's
source files using the old syntax (they have
new syntax now).
4) gofmt -w src misc test/bench
3rd set of files.
R=rsc
CC=golang-dev
http://codereview.appspot.com/180048
Diffstat (limited to 'src/pkg/net/dnsconfig.go')
-rw-r--r-- | src/pkg/net/dnsconfig.go | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/src/pkg/net/dnsconfig.go b/src/pkg/net/dnsconfig.go index 243a4b431..b2153e07d 100644 --- a/src/pkg/net/dnsconfig.go +++ b/src/pkg/net/dnsconfig.go @@ -9,12 +9,12 @@ package net import "os" type _DNS_Config struct { - servers []string; // servers to use - search []string; // suffixes to append to local name - ndots int; // number of dots in name to trigger absolute lookup - timeout int; // seconds before giving up on packet - attempts int; // lost packets before giving up on server - rotate bool; // round robin among servers + servers []string // servers to use + search []string // suffixes to append to local name + ndots int // number of dots in name to trigger absolute lookup + timeout int // seconds before giving up on packet + attempts int // lost packets before giving up on server + rotate bool // round robin among servers } var _DNS_configError os.Error @@ -24,81 +24,81 @@ 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) { - file, err := open("/etc/resolv.conf"); + file, err := open("/etc/resolv.conf") if err != nil { return nil, err } - conf := new(_DNS_Config); - conf.servers = make([]string, 3)[0:0]; // small, but the standard limit - conf.search = make([]string, 0); - conf.ndots = 1; - conf.timeout = 1; - conf.attempts = 1; - conf.rotate = false; + conf := new(_DNS_Config) + conf.servers = make([]string, 3)[0:0] // small, but the standard limit + conf.search = make([]string, 0) + conf.ndots = 1 + conf.timeout = 1 + conf.attempts = 1 + conf.rotate = false for line, ok := file.readLine(); ok; line, ok = file.readLine() { - f := getFields(line); + f := getFields(line) if len(f) < 1 { continue } switch f[0] { - case "nameserver": // add one name server - a := conf.servers; - n := len(a); + case "nameserver": // add one name server + a := conf.servers + n := len(a) if len(f) > 1 && n < cap(a) { // One more check: make sure server name is // just an IP address. Otherwise we need DNS // to look it up. - name := f[1]; + name := f[1] if len(ParseIP(name)) != 0 { - a = a[0 : n+1]; - a[n] = name; - conf.servers = a; + a = a[0 : n+1] + a[n] = name + conf.servers = a } } - case "domain": // set search path to just this domain + case "domain": // set search path to just this domain if len(f) > 1 { - conf.search = make([]string, 1); - conf.search[0] = f[1]; + conf.search = make([]string, 1) + conf.search[0] = f[1] } else { conf.search = make([]string, 0) } - case "search": // set search path to given servers - conf.search = make([]string, len(f)-1); + case "search": // set search path to given servers + conf.search = make([]string, len(f)-1) for i := 0; i < len(conf.search); i++ { conf.search[i] = f[i+1] } - case "options": // magic options + case "options": // magic options for i := 1; i < len(f); i++ { - s := f[i]; + s := f[i] switch { case len(s) >= 6 && s[0:6] == "ndots:": - n, _, _ := dtoi(s, 6); + n, _, _ := dtoi(s, 6) if n < 1 { n = 1 } - conf.ndots = n; + conf.ndots = n case len(s) >= 8 && s[0:8] == "timeout:": - n, _, _ := dtoi(s, 8); + n, _, _ := dtoi(s, 8) if n < 1 { n = 1 } - conf.timeout = n; + conf.timeout = n case len(s) >= 8 && s[0:9] == "attempts:": - n, _, _ := dtoi(s, 9); + n, _, _ := dtoi(s, 9) if n < 1 { n = 1 } - conf.attempts = n; + conf.attempts = n case s == "rotate": conf.rotate = true } } } } - file.close(); + file.close() - return conf, nil; + return conf, nil } |