I'm new to go and have come across the following issue that I haven't been able to find covered in the tutorial or google searches, though I'm sure it must be a basic aspect of the language I have missed. I have code like the following:

type Task func()

var f Task = func() { fmt.Println("foo") }

type TaskWithValue func() interface{}

var g TaskWithValue = func() { return "foo" }

var h TaskWithValue = func() { return 123 }
fgh
Cannot use func() { return "foo" } (type func ()) as type TaskWithValue in assignment
TaskTaskTaskTaskinterface{}