diff --git a/.travis.yml b/.travis.yml index 6f67dab..7489af2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,16 +2,17 @@ language: go go: - 1.5 + - 1.6 install: - go get github.com/axw/gocov/gocov - go get github.com/mattn/goveralls - go get golang.org/x/tools/cmd/cover - go get github.com/pierrre/gotestcover - - go get -t ./... + - go get -t . script: - - gotestcover -coverprofile="cover.out" -race -covermode="count" ./... + - gotestcover -coverprofile="cover.out" -race -covermode="count" . after_success: - goveralls -coverprofile="cover.out" \ No newline at end of file diff --git a/main.go b/main.go index 645f0f1..7822932 100644 --- a/main.go +++ b/main.go @@ -211,19 +211,15 @@ func ComputePi(rw http.ResponseWriter, r *http.Request) { // pi launches n goroutines to compute an // approximation of pi. func pi(n int) float64 { - ch := make(chan float64) - for k := 0; k <= n; k++ { - go term(ch, float64(k)) - } f := 0.0 for k := 0; k <= n; k++ { - f += <-ch + f += term(float64(k)) } return f } -func term(ch chan float64, k float64) { - ch <- 4 * math.Pow(-1, k) / (2 * k + 1) +func term(k float64) float64 { + return 4 * math.Pow(-1, k) / (2*k + 1) } var thisID = uuid.New()