-race flag better, we can refer to the Go documentation:
Data races are among the most common and hardest to debug types of bugs in concurrent systems. A data race occurs when two goroutines access the same variable concurrently and at least one of the accesses is a write.
It is easy to use via the command line interface. So, how to use
-race flag in GoLand with tests? Is it possible to use
-race always in tests? Here you go.
- Navigate to a test file, click on the gutter icon near the test name and select Modify Run Configuration.
-raceentry to the Go tool arguments field.
- Save changes and run the configuration again.
- Navigate to Help | Find Action in the main menu (Shift+Shift by shortcuts) and type Edit Configurations, press Enter.
- Select the Edit configuration templates option, find Go Test.
-raceentry to the Go tool arguments field. Pay attention that changing a template does not affect the existing configuration and you should add the flag manually to the same field.