(fileName string, fileOffset int, fileContents []byte)
| 233 | } |
| 234 | |
| 235 | func detectFileLocation(fileName string, fileOffset int, fileContents []byte) ks.FileLocation { |
| 236 | // If the object YAML begins with a Helm style "# Source: " comment |
| 237 | // Use the information in there as the file name |
| 238 | firstRow := string(bytes.Split(fileContents, []byte("\n"))[0]) |
| 239 | helmTemplatePrefix := "# Source: " |
| 240 | if strings.HasPrefix(firstRow, helmTemplatePrefix) { |
| 241 | return ks.FileLocation{ |
| 242 | Name: firstRow[len(helmTemplatePrefix):], |
| 243 | Line: 1, // Set line to 1 as the line definition gets lost in Helm |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | return ks.FileLocation{ |
| 248 | Name: fileName, |
| 249 | Line: fileOffset, |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | func (p *Parser) decodeItem(s *parsedObjects, detectedVersion schema.GroupVersionKind, fileName string, fileOffset int, fileContents []byte) error { |
| 254 | addPodSpeccer := func(ps ks.PodSpecer) { |
no outgoing calls