View livelock.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"sync" | |
"time" | |
) | |
type BirOrnek struct { | |
sync.Mutex |
View deadlockout.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fatal error: all goroutines are asleep - deadlock! | |
goroutine 1 [chan send]: | |
main.main() | |
H:/GolandProjects/concurrency_samples/main.go:6 +0x31 | |
exit status 2 |
View deadlock.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
func main() { | |
numbers := make(chan int) | |
numbers <- 4 | |
} |
View data_race_waitgroup.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"sync" | |
) | |
func main() { | |
i := 0 |
View data_race_fix.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main() { | |
i := make(chan int) | |
go func() { | |
a := 0 | |
a++ |
View data_race_fix.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main() { | |
i := make(chan int) | |
go func() { | |
a := 0 | |
a++ |
View data_race_output.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WARNING: DATA RACE | |
Read at 0x00c00012c078 by goroutine 7: | |
main.main.func1() | |
H:/GolandProjects/concurrency_samples/main.go:11 +0x39 | |
Previous write at 0x00c00012c078 by main goroutine: | |
main.main() | |
H:/GolandProjects/concurrency_samples/main.go:14 +0x116 | |
Goroutine 7 (running) created at: |
View data_race.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main() { | |
wait := make(chan int) | |
i := 0 | |
go func() { |
View client.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"google.golang.org/grpc" | |
"google.golang.org/grpc/credentials/insecure" | |
pb "grpc_example/gen/protos" | |
"io" | |
"log" | |
) |
View install.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
go get google.golang.org/grpc |
NewerOlder