Skip to content

Commit

Permalink
feat: updated toml.go
Browse files Browse the repository at this point in the history
Signed-off-by: Asish Kumar <[email protected]>
  • Loading branch information
officialasishkumar committed May 11, 2024
1 parent 2d1a654 commit f9a58dd
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions pkg/package/toml.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,20 @@ func (pkg *Package) UnmarshalTOML(data interface{}) error {
pkg.Description = v
}

if v, ok := meta[INCLUDE_FLAG].([]string); ok {
pkg.Include = v
convertToStringArray := func(v interface{}) []string {
var arr []string
for _, item := range v.([]interface{}) {
arr = append(arr, item.(string))
}
return arr
}

if v, ok := meta[INCLUDE_FLAG].([]interface{}); ok {
pkg.Include = convertToStringArray(v)
}

if v, ok := meta[EXCLUDE_FLAG].([]string); ok {
pkg.Exclude = v
if v, ok := meta[EXCLUDE_FLAG].([]interface{}); ok {
pkg.Exclude = convertToStringArray(v)
}

return nil
Expand Down

0 comments on commit f9a58dd

Please sign in to comment.