|
| 1 | +// Package concorrencia provides utilities and constants for exploring concurrency-related |
| 2 | +// topics in Go. It includes definitions for topic names, flags, and descriptions |
| 3 | +// that can be used to structure and reference concurrency concepts consistently |
| 4 | +// throughout the project. This package is designed to facilitate learning and |
| 5 | +// experimentation with concurrency mechanisms such as goroutines, waitgroups, mutexes, |
| 6 | +// and atomic operations. |
| 7 | +package concorrencia |
| 8 | + |
| 9 | +// rootDir represents the relative path to the directory where concurrency-related |
| 10 | +// topics are stored within the project. This constant is used to reference the |
| 11 | +// directory in a consistent manner throughout the codebase. |
| 12 | +const ( |
| 13 | + rootDir = "internal/concorrencia" |
| 14 | +) |
| 15 | + |
| 16 | +// The following constants define the names of various concurrency-related topics. |
| 17 | +// These constants are used to identify and reference specific sections of the |
| 18 | +// concurrency content. |
| 19 | +const ( |
| 20 | + concorrenciaVsParalelismo string = "Concorrência vs Paralelismo" |
| 21 | + goroutinesWaitgroups string = "Goroutines & WaitGroups" |
| 22 | + discussaoCondicaoDeCorrida string = "Discussão: Condição de corrida" |
| 23 | + condicaoDeCorrida string = "Condição de corrida" |
| 24 | + mutex string = "Mutex" |
| 25 | + atomic string = "Atomic" |
| 26 | +) |
| 27 | + |
| 28 | +// The following constants define the command-line flags that can be used to |
| 29 | +// execute specific concurrency-related topics. These flags are used to |
| 30 | +// provide a user-friendly interface for selecting and executing different |
| 31 | +// sections of the concurrency content. |
| 32 | +const ( |
| 33 | + flagConcorrenciaVsParalelismo string = "--concorrencia-vs-paralelismo" |
| 34 | + flagGoroutinesWaitgroups string = "--goroutines-waitgroups" |
| 35 | + flagDiscussaoCondicaoDeCorrida string = "--discussao-condicao-de-corrida" |
| 36 | + flagCondicaoDeCorrida string = "--condicao-de-corrida" |
| 37 | + flagMutex string = "--mutex" |
| 38 | + flagAtomic string = "--atomic" |
| 39 | +) |
| 40 | + |
| 41 | +// The following constants define the descriptions for each concurrency-related |
| 42 | +// topic. These descriptions provide additional context and information about |
| 43 | +// the content covered in each section. They are used to enhance the user |
| 44 | +// experience by providing clear explanations of what each topic entails. |
| 45 | +const ( |
| 46 | + descConcorrenciaVsParalelismo string = "Apresenta a diferença entre concorrência e paralelismo." |
| 47 | + descGoroutinesWaitgroups string = "Apresenta o uso de goroutines e waitgroups." |
| 48 | + descDiscussaoCondicaoDeCorrida string = "Apresenta uma discussão sobre condição de corrida." |
| 49 | + descCondicaoDeCorrida string = "Apresenta o conceito de condição de corrida." |
| 50 | + descMutex string = "Apresenta o uso de mutex." |
| 51 | + descAtomic string = "Apresenta o uso de atomic." |
| 52 | +) |
| 53 | + |
| 54 | +// The following slice contains the names of all concurrency-related topics. |
| 55 | +// This slice is used to iterate over the topics and execute the corresponding |
| 56 | +// sections when the user selects a specific topic. |
| 57 | +var ( |
| 58 | + topics = []string{ |
| 59 | + concorrenciaVsParalelismo, |
| 60 | + goroutinesWaitgroups, |
| 61 | + discussaoCondicaoDeCorrida, |
| 62 | + condicaoDeCorrida, |
| 63 | + mutex, |
| 64 | + atomic, |
| 65 | + } |
| 66 | +) |
0 commit comments