Skip to content

Instantly share code, notes, and snippets.

View horzu's full-sized avatar

Mert Şakar horzu

View GitHub Profile
@horzu
horzu / main.go
Created March 17, 2022 10:31
Concurrency in Go: Go routines example - 1
package main
import (
"fmt"
"time"
)
func main() {
counter("first")
counter("second")
@horzu
horzu / main.go
Created March 17, 2022 11:43
Concurrency in Go: Go routines example - 1
package main
import (
"fmt"
"time"
)
func main() {
go counter("first")
counter("second")
@horzu
horzu / main.go
Created March 17, 2022 12:12
Concurrency in Go: Go routines example - 1
package main
import (
"fmt"
"time"
)
func main() {
go counter("first")
go counter("second")
@horzu
horzu / gist:f82f46a1168254790cbfd4d35a165576
Created March 17, 2022 12:16
Concurrency in Go: Go routines example - 1
package main
import (
"fmt"
"time"
)
func main() {
go counter("first")
go counter("second")
@horzu
horzu / gist:52129fa78769b25421f8139286af2ad7
Created March 17, 2022 12:22
Concurrency in Go: Go routines example - 1
package main
import (
"fmt"
"time"
)
func main() {
go counter("first")
go counter("second")
@horzu
horzu / gist:17116e9e8510a2fe84925dd6d3f063cb
Last active March 17, 2022 12:54
Concurrency in Go: Go routines example - 2
package main
import (
"fmt"
"sync"
"time"
)
func main() {
var wg sync.WaitGroup
@horzu
horzu / channels-1
Last active March 17, 2022 19:40
channels-1
package main
import (
"fmt"
"time"
)
func main() {
c := make(chan string)
go counter("first", c)
@horzu
horzu / channels-2
Created March 17, 2022 19:50
channels-2
package main
import (
"fmt"
"time"
)
func main() {
c := make(chan string)
go counter("first", c)
@horzu
horzu / channels-3
Created March 17, 2022 20:31
channels-3
package main
import (
"fmt"
"time"
)
func main() {
c := make(chan string)
go counter("first", c)
@horzu
horzu / channels-4
Last active March 17, 2022 20:43
channels-4
package main
import (
"fmt"
"time"
)
func main() {
c := make(chan string)
go counter("first", c)