Skip to content

Instantly share code, notes, and snippets.

@jsgoecke
Last active December 29, 2015 22:49
Show Gist options
  • Save jsgoecke/7738466 to your computer and use it in GitHub Desktop.
Save jsgoecke/7738466 to your computer and use it in GitHub Desktop.

Revisions

  1. jsgoecke revised this gist Dec 2, 2013. 1 changed file with 7 additions and 8 deletions.
    15 changes: 7 additions & 8 deletions gistfile1.go
    Original file line number Diff line number Diff line change
    @@ -1,14 +1,13 @@
    package main

    import "fmt"

    func hello(channel chan string) {
    channel <- "Hello world!\n"
    func hello(ch chan string) {
    ch <- "Hello world!"
    }

    func main() {
    channel := make(chan string)
    go hello(channel)
    response := <- channel
    fmt.Printf(response)
    ch := make(chan string)
    go hello(ch)
    fmt.Println(<-ch)
    }
  2. jsgoecke revised this gist Dec 1, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions gistfile1.go
    Original file line number Diff line number Diff line change
    @@ -2,13 +2,13 @@ package main

    import "fmt"

    func helloWorld(channel chan string) {
    func hello(channel chan string) {
    channel <- "Hello world!\n"
    }

    func main() {
    channel := make(chan string)
    go helloWorld(channel)
    go hello(channel)
    response := <- channel
    fmt.Printf(response)
    }
  3. jsgoecke created this gist Dec 1, 2013.
    14 changes: 14 additions & 0 deletions gistfile1.go
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    package main

    import "fmt"

    func helloWorld(channel chan string) {
    channel <- "Hello world!\n"
    }

    func main() {
    channel := make(chan string)
    go helloWorld(channel)
    response := <- channel
    fmt.Printf(response)
    }
    2 changes: 2 additions & 0 deletions gistfile2.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,2 @@
    go run hello_world.go
    Hello world!