These two are different types:
processQueue chan ReadyDownload
process chan ProcessItem
You can put a ReadyDownloader
value in a channel of type chan ProcessItem
(if it implements the interface), but you cannot convert one channel type to another, in the same way that you cannot convert a []T
slice into a []interface{}
slice, another common confusion similar to this one.
What you need to do is make all the channels of type chan ProcessItem
:
func Run(in chan ProcessItem) chan CCFile {
out := make(chan CCFile)
processQueue := make(chan ProcessItem)
go cache.BypassFilter(in, processQueue, out)
// writes the cached, already processed version to out if it exists
// otherwise redirects the input to processQueue
go process(processQueue, out)
return out
}
To read more about why this is (for slices, but the same applies for channels), you can read the following go-wiki page: