Skip to content

Commit 87210de

Browse files
Some code clean up and formatting
1 parent e9612d9 commit 87210de

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

cmd/laclm/main.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@ func main() {
2828
func exec() error {
2929

3030
/* exec() wraps run() protecting it with user interrupts */
31-
31+
3232
err := godotenv.Load()
3333
if err != nil {
3434
fmt.Println("No .env file found, continuing with system environment variables\n")
3535
}
3636

3737
/* setting up cobra for cli interactions */
38-
var(
38+
var (
3939
configPath string
40-
rootCmd = &cobra.Command{
40+
rootCmd = &cobra.Command{
4141
Use: "laclm <command> <subcommand>",
4242
Short: "Backend server for linux acl management",
4343
Example: heredoc.Doc(`
@@ -68,18 +68,16 @@ func exec() error {
6868
if there is an error in loading the config file, then it will exit with code 1
6969
*/
7070
if err := config.LoadConfig(configPath); err != nil {
71-
fmt.Printf("Configuration Error in %s: %s",
72-
configPath,
71+
fmt.Printf("Configuration Error in %s: %s",
72+
configPath,
7373
err.Error(),
7474
)
7575
/* since the configuration is invalid, don't proceed */
7676
os.Exit(1)
7777
}
7878

79-
fmt.Println("loaded config")
80-
81-
/*
82-
true for production, false for development mode
79+
/*
80+
true for production, false for development mode
8381
logger is only for http server and core components (after this step)
8482
using logger for cli issues doesn't make sense
8583
*/

config/config.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ type Config struct {
1313
Logging Logging `yaml:"logging,omitempty"`
1414
FileSystemServers []FileSystemServers `yaml:"filesystem_servers,omitempty"`
1515
BackendSecurity BackendSecurity `yaml:"backend_security,omitempty"`
16-
Authentication Authentication `yaml:"authentication,omitempty"`
16+
Authentication Authentication `yaml:"authentication,omitempty"`
1717
}
1818

1919
/* complete config normalizer function */
2020
func (c *Config) Normalize() error {
2121
if err := c.AppInfo.Normalize(); err != nil {
22-
return fmt.Errorf("app configuration error: %w", err)
22+
return fmt.Errorf("app configuration error: %w", err)
2323
}
2424

2525
if err := c.Server.Normalize(); err != nil {
@@ -37,11 +37,11 @@ func (c *Config) Normalize() error {
3737
for i := range c.FileSystemServers {
3838
if err := c.FileSystemServers[i].Normalize(); err != nil {
3939
return fmt.Errorf("file system server [%d] error: %w", i, err)
40-
}
40+
}
4141
}
4242

4343
if err := c.BackendSecurity.Normalize(); err != nil {
44-
return fmt.Errorf("backend security configuration error: %w", err)
44+
return fmt.Errorf("backend security configuration error: %w", err)
4545
}
4646

4747
if err := c.Authentication.Normalize(); err != nil {

0 commit comments

Comments
 (0)