hello all, i'm trying cache images on a server to a local folder, by doing
the following (pseudo-code, but mostly working)

the problem is that it blocks on the io time consuming code in struct
Cache. that is the scanner "service" is unable to continue finding images

hope this explains the issue, otherwise i will try to make it a working code

package main
import "fmt"
func main() {
cache := services.Cache

scanner := services.Scanner

core := services.Core

go cache.Start()

go scanner.Start()

go core.Start()


package services
type Scanner struct {

func (self *Scanner) visit(path string, f os.FileInfo, err error) error {
itemFound <- path


func (self *Scanner) start() {
// loop over the filesystem, finding images

filepath.Walk("/", self.visit)


type Core struct {


func (self *Core) start() {
for {

select {

case msg := <- itemFound

go self.doItemFound(msg)




func (self *Scanner) doItemFound(path string) {
// do some stuff

cachePicture <- path


type Cache struct {

func (self *Cache) start() {
for {

select {

case msg := <- cachePicture

go self.doCachePicture(msg)




func (self *Cache) doCachePicture(path string) {
// do some time consuming io, copying images from server to local machine

You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
postedNov 17, '13 at 12:06p
activeNov 17, '13 at 12:06p

1 user in discussion

Lboregard: 1 post



site design / logo © 2022 Grokbase