Skip to content

Latest commit

 

History

History
34 lines (26 loc) · 463 Bytes

File metadata and controls

34 lines (26 loc) · 463 Bytes

simple-task

package main

import (
	"fmt"
	"time"

	"github.com/sourcegraph/conc"
)

func task1() {
	// Simulate a task
	fmt.Println("Task 1 stared")
}

func main() {
	var group conc.WaitGroup

	// Add task to the group
	group.Go(task1)

	group.Go(func() {
		// Simulate another task
		fmt.Println("Task 2 started")
		time.Sleep(time.Second)
	})

	// Wait for all tasks to complete
	group.Wait()
	fmt.Println("All tasks completed successfully")
}