https://github.com/romanitalian/golang-race
https://github.com/romanitalian/golang-race
example golang race
Last synced: 7 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/romanitalian/golang-race
- Owner: romanitalian
- Created: 2018-04-26T16:49:41.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-04-28T11:51:46.000Z (over 7 years ago)
- Last Synced: 2025-01-16T05:29:44.405Z (9 months ago)
- Topics: example, golang, race
- Language: Go
- Size: 4.88 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# golang-race
### For tag: 0.0.1
Execute this command - order to view of summation result
> `$ go run main.go`Example output:
`261848`Expected: `1000000`
Execute this command - order to view of "race" detection
> `$ go run -race main.go````
$ go run -race main.go
==================
WARNING: DATA RACE
Read at 0x00c04206e080 by goroutine 7:
main.main.func1()
D:/proj/golang/golang-race/main.go:11 +0x48Previous write at 0x00c04206e080 by goroutine 6:
main.main.func1()
D:/proj/golang/golang-race/main.go:11 +0x5eGoroutine 7 (running) created at:
main.main()
D:/proj/golang/golang-race/main.go:19 +0x8fGoroutine 6 (running) created at:
main.main()
D:/proj/golang/golang-race/main.go:19 +0x8f
==================
210100
Found 1 data race(s)
exit status 66```
### For tag: 0.0.2
Default run
>`$ go run main_atomic.go`>`1000000`
With flag "-race"
>`$ go run -race main_atomic.go`>`963237`
### For tag: 0.0.3
Default run
>`$ go run main_mutex.go`> `1000000`
With flag "-race"
> `$ go run -race main_mutex.go`> `610917`
### For tag: 0.0.4
>`$ go run main_waitgroup.go`
> `1000000`
With flag "-race"
> `$ go run -race main_waitgroup.go`> `1000000`