Browse Source

Merge pull request #15 from uriel/master

Some very minor stylistic nits.
Ask Bjørn Hansen 13 years ago
parent
commit
3a9df4b76d
5 changed files with 10 additions and 13 deletions
  1. 7 9
      config.go
  2. 0 1
      geoip.go
  3. 1 1
      monitor.go
  4. 1 1
      picker.go
  5. 1 1
      serve.go

+ 7 - 9
config.go

@@ -19,12 +19,10 @@ import (
 var configLastRead = map[string]time.Time{}
 
 func configReader(dirName string, Zones Zones) {
-	go func() {
-		for {
-			configReadDir(dirName, Zones)
-			time.Sleep(5 * time.Second)
-		}
-	}()
+	for {
+		configReadDir(dirName, Zones)
+		time.Sleep(5 * time.Second)
+	}
 }
 
 func configReadDir(dirName string, Zones Zones) {
@@ -33,7 +31,7 @@ func configReadDir(dirName string, Zones Zones) {
 		panic(err)
 	}
 
-	var seenFiles = map[string]bool{}
+	seenFiles := map[string]bool{}
 
 	for _, file := range dir {
 		fileName := file.Name()
@@ -144,7 +142,7 @@ func readZoneFile(zoneName, fileName string) (*Zone, error) {
 
 func setupZoneData(data map[string]interface{}, Zone *Zone) {
 
-	var recordTypes = map[string]uint16{
+	recordTypes := map[string]uint16{
 		"a":     dns.TypeA,
 		"aaaa":  dns.TypeAAAA,
 		"ns":    dns.TypeNS,
@@ -175,7 +173,7 @@ func setupZoneData(data map[string]interface{}, Zone *Zone) {
 
 		for rType, dnsType := range recordTypes {
 
-			var rdata = dv[rType]
+			rdata := dv[rType]
 
 			if rdata == nil {
 				//log.Printf("No %s records for label %s\n", rType, dk)

+ 0 - 1
geoip.go

@@ -10,7 +10,6 @@ func setupGeoIP() *geoip.GeoIP {
 	gi := geoip.Open()
 	if gi == nil {
 		log.Printf("Could not open GeoIP database\n")
-		return nil
 	}
 	return gi
 }

+ 1 - 1
monitor.go

@@ -105,7 +105,7 @@ func wsHandler(ws *websocket.Conn) {
 
 func initialStatus() string {
 	status := map[string]string{"v": VERSION, "id": serverId}
-	var hostname, err = os.Hostname()
+	hostname, err := os.Hostname()
 	if err == nil {
 		status["h"] = hostname
 	}

+ 1 - 1
picker.go

@@ -9,7 +9,7 @@ func (label *Label) Picker(qtype uint16, max int) Records {
 
 	if qtype == dns.TypeANY {
 		result := make([]Record, 0)
-		for rtype, _ := range label.Records {
+		for rtype := range label.Records {
 
 			rtype_records := label.Picker(rtype, max)
 

+ 1 - 1
serve.go

@@ -130,7 +130,7 @@ func statusRR(z *Zone) []dns.RR {
 
 	status := map[string]string{"v": VERSION, "id": serverId}
 
-	var hostname, err = os.Hostname()
+	hostname, err := os.Hostname()
 	if err == nil {
 		status["h"] = hostname
 	}