func computeFibonacci(num int) []int {
	fibNumbers := make([]int, num)
	a, b := 1, 1
	for i := range fibNumbers {
		fibNumbers[i] = a
		a, b = b, a+b
	}
	return fibNumbers
}
Compute Fibonacci numbers
package main
import (
	"fmt"
	"io"
	"os"
)
var out io.Writer = os.Stdout
func main() {
	fib(7)
}
func fib(num int) {
	for _, v := range dispatchFib(num) {
		fmt.Fprintln(out, v)
	}
}
func dispatchFib(num int) []int {
	switch {
	case num == 0:
		return []int{0}
	case num < 0:
		return computeNegafibonacci(num)
	default:
		return computeFibonacci(num)
	}
}