High Performance Calculation of Sums and Returns in Go
In Go, when you want to measure function performance, use the Go testing package to run a benchmark.

For example,

returns.go:

package finance

// Calculate returns
func Re(data []float64) []float64 {
    var re []float64
    if len(data) &gt; 0 {
        re = make([]float64, len(data))
    }
    for i := 1; i &lt; len(data); i++ {
        if data[i-1] != 0 {
            re[i] = (data[i] / data[i-1]) - 1
        }
    }
    return re
}

// Calculate sum
func Sum(data []float64) float64 {
    var sum float64
    for _, x := range data {
        sum += x
    }
    return sum
}


returns_test.go:

package finance

import "testing"

func BenchmarkRe(b *testing.B) {
    data := make([]float64, 5*12)
    for i := range data {
        data[i] = float64(i)
    }
    b.ResetTimer()
    for N := 0; N &lt; b.N; N++ {
        Re(data)
    }
}

func BenchmarkSum(b *testing.B) {
    data := make([]float64, 5*12)
    for i := range data {
        data[i] = float64(i)
    }
    b.ResetTimer()
    for N := 0; N &lt; b.N; N++ {
        Sum(data)
    }
}


Output:

$ go test returns.go returns_test.go -bench=. -benchmem
BenchmarkRe-4     7545566   156 ns/op     480 B/op    1 allocs/op
BenchmarkSum-4   28272992    41.5 ns/op     0 B/op    0 allocs/op
$


I looked at some other alternatives, but that's the fastest.

Note: I fixed your divide-by-zero bug.