Rewrite channels to golang