@@ -37,10 +37,10 @@ func (r *Reference) String() string {
3737
3838// ParseReferences is a convenient wrapper that operates on a slice of strings and
3939// calls ParseReference for each of them. It returns at the first invalid argument.
40- func ParseReferences (args []string , parseArch bool ) ([]* Reference , error ) {
40+ func ParseReferences (args []string ) ([]* Reference , error ) {
4141 ret := []* Reference {}
4242 for _ , arg := range args {
43- reference , err := ParseReference (arg , parseArch )
43+ reference , err := ParseReference (arg )
4444 if err != nil {
4545 return nil , err
4646 }
@@ -52,7 +52,7 @@ func ParseReferences(args []string, parseArch bool) ([]*Reference, error) {
5252// ParseReference parses a string and returns a Reference object. If `parseArch` is passed,
5353// the method also tries to parse the architecture bit, i.e. string must be in the form
5454// "packager:arch@version", useful to represent a platform (or core) name.
55- func ParseReference (arg string , parseArch bool ) (* Reference , error ) {
55+ func ParseReference (arg string ) (* Reference , error ) {
5656 ret := & Reference {}
5757 if arg == "" {
5858 return nil , fmt .Errorf (tr ("invalid empty core argument" ))
@@ -69,20 +69,18 @@ func ParseReference(arg string, parseArch bool) (*Reference, error) {
6969 ret .Version = toks [1 ]
7070 }
7171
72- if parseArch {
73- toks = strings .Split (ret .PackageName , ":" )
74- if len (toks ) != 2 {
75- return nil , fmt .Errorf (tr ("invalid item %s" ), arg )
76- }
77- if toks [0 ] == "" {
78- return nil , fmt .Errorf (tr ("invalid empty core name '%s'" ), arg )
79- }
80- ret .PackageName = toks [0 ]
81- if toks [1 ] == "" {
82- return nil , fmt .Errorf (tr ("invalid empty core architecture '%s'" ), arg )
83- }
84- ret .Architecture = toks [1 ]
72+ toks = strings .Split (ret .PackageName , ":" )
73+ if len (toks ) != 2 {
74+ return nil , fmt .Errorf (tr ("invalid item %s" ), arg )
75+ }
76+ if toks [0 ] == "" {
77+ return nil , fmt .Errorf (tr ("invalid empty core name '%s'" ), arg )
78+ }
79+ ret .PackageName = toks [0 ]
80+ if toks [1 ] == "" {
81+ return nil , fmt .Errorf (tr ("invalid empty core architecture '%s'" ), arg )
8582 }
83+ ret .Architecture = toks [1 ]
8684
8785 return ret , nil
8886}
0 commit comments