@@ -134,31 +134,32 @@ func parseNameAndVersion(in string) (string, string, bool) {
134
134
return split [0 ][1 ], split [0 ][2 ], true
135
135
}
136
136
137
+ // UnmarshalYAML decodes a ProfilePlatformReference from YAML source.
137
138
func (p * ProfilePlatformReference ) UnmarshalYAML (unmarshal func (interface {}) error ) error {
138
139
var data map [string ]string
139
140
if err := unmarshal (& data ); err != nil {
140
141
return err
141
142
}
142
- if platformId , ok := data ["platform" ]; ! ok {
143
+ if platformID , ok := data ["platform" ]; ! ok {
143
144
return fmt .Errorf (tr ("missing 'platform' directive" ))
144
- } else if platformId , platformVersion , ok := parseNameAndVersion (platformId ); ! ok {
145
+ } else if platformID , platformVersion , ok := parseNameAndVersion (platformID ); ! ok {
145
146
return fmt .Errorf (tr ("invalid 'platform' directive" ))
146
147
} else if c , err := semver .Parse (platformVersion ); err != nil {
147
148
return fmt .Errorf ("%s: %w" , tr ("error parsing version constraints" ), err )
148
- } else if split := strings .SplitN (platformId , ":" , 2 ); len (split ) != 2 {
149
- return fmt .Errorf ("%s: %s" , tr ("invalid platform identifier" ), platformId )
149
+ } else if split := strings .SplitN (platformID , ":" , 2 ); len (split ) != 2 {
150
+ return fmt .Errorf ("%s: %s" , tr ("invalid platform identifier" ), platformID )
150
151
} else {
151
152
p .Packager = split [0 ]
152
153
p .Architecture = split [1 ]
153
154
p .Version = c
154
155
}
155
156
156
157
if rawIndexURL , ok := data ["platform_index_url" ]; ok {
157
- if indexURL , err := url .Parse (rawIndexURL ); err != nil {
158
+ indexURL , err := url .Parse (rawIndexURL )
159
+ if err != nil {
158
160
return fmt .Errorf ("%s: %w" , tr ("invlid platform index URL:" ), err )
159
- } else {
160
- p .PlatformIndexURL = indexURL
161
161
}
162
+ p .PlatformIndexURL = indexURL
162
163
}
163
164
return nil
164
165
}
@@ -169,6 +170,7 @@ type ProfileLibraryReference struct {
169
170
Version * semver.Version
170
171
}
171
172
173
+ // UnmarshalYAML decodes a ProfileLibraryReference from YAML source.
172
174
func (l * ProfileLibraryReference ) UnmarshalYAML (unmarshal func (interface {}) error ) error {
173
175
var data string
174
176
if err := unmarshal (& data ); err != nil {
0 commit comments