package service import ( "sync" "testing" ) // TestGetAppVersion func TestGetAppVersion(t *testing.T) { s := &AppService{} v := s.GetAppVersion() // print result t.Logf("App Version: %s", v) } func TestMultipleGetAppVersion(t *testing.T) { s := &AppService{} //concurrency test // use a WaitGroup to wait for all goroutines to finish wg := sync.WaitGroup{} wg.Add(10) // start 10 goroutine // start 10 goroutine for i := 0; i < 10; i++ { go func() { defer wg.Done() // decrement the count when done v := s.GetAppVersion() // print result t.Logf("App Version: %s", v) }() } // wait for all goroutine done wg.Wait() }