Skip to content

Commit e4675c3

Browse files
feat: adicionar documentação para funções de controle de fluxo em Go
1 parent df413ef commit e4675c3

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

internal/fluxo_de_controle/topics.go

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Package fluxo_de_controle provides functions and utilities to demonstrate
2+
// and explain control flow concepts in Go. It includes examples and explanations
3+
// for various control flow structures such as loops, conditionals, and logical operators.
14
package fluxo_de_controle
25

36
import (
@@ -6,8 +9,14 @@ import (
69
"github.com/fabianoflorentino/aprendago/pkg/format"
710
)
811

9-
const rootDir = "internal/fluxo_de_controle"
12+
// rootDir represents the root directory path for the "fluxo_de_controle" module within the internal package.
13+
const (
14+
rootDir = "internal/fluxo_de_controle"
15+
)
1016

17+
// FluxoDeControle demonstrates various control flow constructs in Go.
18+
// It prints section headers and executes corresponding sections to illustrate
19+
// different control flow mechanisms such as loops, conditionals, and logical operators.
1120
func FluxoDeControle() {
1221
fmt.Printf("\n\n06 - Fluxo de Controle\n")
1322

@@ -24,6 +33,9 @@ func FluxoDeControle() {
2433
executeSection("Operadores lógicos condicionais")
2534
}
2635

36+
// MenuFluxoDeControle returns a slice of format.MenuOptions, each representing a menu option
37+
// for different sections of control flow topics in Go. Each menu option has an associated
38+
// execution function that calls executeSection with a specific section title.
2739
func MenuFluxoDeControle([]string) []format.MenuOptions {
2840
return []format.MenuOptions{
2941
{Options: "--entendendo-fluxo-de-controle", ExecFunc: func() { executeSection("Entendendo Fluxo de Controle") }},
@@ -40,6 +52,10 @@ func MenuFluxoDeControle([]string) []format.MenuOptions {
4052
}
4153
}
4254

55+
// HelpMeFluxoDeControle provides a list of help topics related to control flow in Go.
56+
// It includes explanations and details about various control flow concepts such as loops,
57+
// conditional statements, and logical operators. The function prints a formatted help
58+
// message to guide users through these topics.
4359
func HelpMeFluxoDeControle() {
4460
hlp := []format.HelpMe{
4561
{Flag: "--entendendo-fluxo-de-controle", Description: "Explica o conceito de fluxo de controle em Go.", Width: 0},
@@ -60,6 +76,9 @@ func HelpMeFluxoDeControle() {
6076
format.PrintHelpMe(hlp)
6177
}
6278

79+
// executeSection formats and processes a given section of the project.
80+
// It takes a section name as a string and applies the FormatSection function
81+
// from the format package to the specified section within the root directory.
6382
func executeSection(section string) {
6483
format.FormatSection(rootDir, section)
6584
}

0 commit comments

Comments
 (0)