-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Teryukha Mikhail Romanovich
committed
Jun 29, 2024
1 parent
30c24dc
commit 0b5f6cf
Showing
8 changed files
with
48 additions
and
19 deletions.
There are no files selected for viewing
Binary file not shown.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,36 @@ | ||
package config | ||
|
||
var ( | ||
SnakeCase bool | ||
CamelCase bool | ||
ConstCount uint | ||
ConstLen uint | ||
PrintTree bool | ||
BlockLen uint | ||
import ( | ||
"fmt" | ||
"gopkg.in/yaml.v3" | ||
"os" | ||
) | ||
|
||
type Config struct { | ||
SnakeCase bool `yaml:"SnakeCase"` | ||
CamelCase bool `yaml:"CamelCase"` | ||
ConstCount uint `yaml:"ConstCount"` | ||
ConstLen uint `yaml:"ConstLen"` | ||
BlockLen uint `yaml:"BlockLen"` | ||
} | ||
|
||
var Cfg = Config{} | ||
|
||
const FuncComment = "OPT:" | ||
|
||
var UsingFunctions []string = []string{"Go"} | ||
|
||
var CountVar = 3 | ||
func ReadConfigFromFile(filename string) *Config { | ||
file, err := os.ReadFile(filename) | ||
if err != nil { | ||
return nil | ||
} | ||
|
||
var config = Config{} | ||
err = yaml.Unmarshal(file, &config) | ||
if err != nil { | ||
return nil | ||
} | ||
fmt.Println("Получен конфиг из файла", config) | ||
return &config | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters