Przeglądaj źródła

Merge pull request #3 from benmanns/gofmt

Run gofmt
Jehiah Czebotar 11 lat temu
rodzic
commit
2e89d10a8b
3 zmienionych plików z 6 dodań i 6 usunięć
  1. 3 3
      epsilon_greedy.go
  2. 1 1
      hostpool.go
  3. 2 2
      hostpool_test.go

+ 3 - 3
epsilon_greedy.go

@@ -30,13 +30,13 @@ type epsilonGreedyHostPool struct {
 
 // Construct an Epsilon Greedy HostPool
 //
-// Epsilon Greedy is an algorithm that allows HostPool not only to track failure state, 
+// Epsilon Greedy is an algorithm that allows HostPool not only to track failure state,
 // but also to learn about "better" options in terms of speed, and to pick from available hosts
 // based on how well they perform. This gives a weighted request rate to better
 // performing hosts, while still distributing requests to all hosts (proportionate to their performance).
 // The interface is the same as the standard HostPool, but be sure to mark the HostResponse immediately
 // after executing the request to the host, as that will stop the implicitly running request timer.
-// 
+//
 // A good overview of Epsilon Greedy is here http://stevehanov.ca/blog/index.php?id=132
 //
 // To compute the weighting scores, we perform a weighted average of recent response times, over the course of
@@ -53,7 +53,7 @@ func NewEpsilonGreedy(hosts []string, decayDuration time.Duration, calc EpsilonV
 		epsilon:                float32(initialEpsilon),
 		decayDuration:          decayDuration,
 		EpsilonValueCalculator: calc,
-		timer:                  &realTimer{},
+		timer: &realTimer{},
 	}
 
 	// allocate structures

+ 1 - 1
hostpool.go

@@ -185,7 +185,7 @@ func (p *standardHostPool) markFailed(hostR HostPoolResponse) {
 }
 func (p *standardHostPool) Hosts() []string {
 	hosts := make([]string, len(p.hosts))
-	for host, _ := range p.hosts {
+	for host := range p.hosts {
 		hosts = append(hosts, host)
 	}
 	return hosts

+ 2 - 2
hostpool_test.go

@@ -89,7 +89,7 @@ func TestEpsilonGreedy(t *testing.T) {
 		hostR.Mark(nil)
 	}
 
-	for host, _ := range hitCounts {
+	for host := range hitCounts {
 		log.Printf("host %s hit %d times (%0.2f percent)", host, hitCounts[host], (float64(hitCounts[host])/float64(iterations))*100.0)
 	}
 
@@ -113,7 +113,7 @@ func TestEpsilonGreedy(t *testing.T) {
 		hostR.Mark(nil)
 	}
 
-	for host, _ := range hitCounts {
+	for host := range hitCounts {
 		log.Printf("host %s hit %d times (%0.2f percent)", host, hitCounts[host], (float64(hitCounts[host])/float64(iterations))*100.0)
 	}