@@ -28,7 +28,7 @@ type Command struct {
2828}
2929
3030// TODO interface{} must be replaced
31- func NewCommand (name string , rawCommand map [string ]interface {}) Command {
31+ func NewCommand (name string , rawCommand map [interface {} ]interface {}) Command {
3232 newCmd := Command {
3333 Name : name ,
3434 Env : make (map [string ]string ),
@@ -85,17 +85,19 @@ func NewCommand(name string, rawCommand map[string]interface{}) Command {
8585 }
8686
8787 if checksum , ok := rawCommand [CHECKSUM ]; ok {
88- var files []string
89- for _ , value := range checksum .([]interface {}) {
90- // TODO validate if command is realy exists - in validate
91- files = append (files , value .(string ))
92- }
93- checksum , err := calculateChecksum (files )
94- if err == nil {
95- newCmd .Checksum = checksum
96- } else {
97- // TODO return error or caclulate checksum upper in the code
98- fmt .Printf ("error while checksum %s\n " , err )
88+ if patterns , ok := checksum .([]interface {}); ok {
89+ var files []string
90+ for _ , value := range patterns {
91+ // TODO validate if command is realy exists - in validate
92+ files = append (files , value .(string ))
93+ }
94+ checksum , err := calculateChecksum (files )
95+ if err == nil {
96+ newCmd .Checksum = checksum
97+ } else {
98+ // TODO return error or caclulate checksum upper in the code
99+ fmt .Printf ("error while checksum %s\n " , err )
100+ }
99101 }
100102 }
101103 return newCmd
0 commit comments