-
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
Benjamin Sanvoisin
committed
Jun 30, 2023
1 parent
058b397
commit 24c5648
Showing
5 changed files
with
39 additions
and
30 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -5,3 +5,8 @@ type Check struct { | |
Status string | ||
RelatedGuidelines string | ||
} | ||
|
||
type Module struct { | ||
Name string | ||
FullPath string | ||
} |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package helpers | ||
|
||
import ( | ||
"fmt" | ||
"guacamole/data" | ||
"os" | ||
"path/filepath" | ||
|
||
"github.com/spf13/viper" | ||
) | ||
|
||
func GetModules() ([]data.Module, error) { | ||
codebasePath := viper.GetString("codebase-path") + "modules/" | ||
modules := []data.Module{} | ||
//Get all subdirectories in root path | ||
err := filepath.Walk(codebasePath, func(path string, info os.FileInfo, err error) error { | ||
if err != nil { | ||
fmt.Println("Error:", err) | ||
} | ||
if info.IsDir() && path != codebasePath { | ||
modules = append(modules, data.Module{Name: info.Name(), FullPath: path}) | ||
} | ||
return nil | ||
}) | ||
return modules, err | ||
} |