func detectOS(data map[string][]byte, parent *database.Layer) (detectedOS string, err error) { detectedOS = detectors.DetectOS(data) // Attempt to detect the OS from the parent layer. if detectedOS == "" && parent != nil { detectedOS, err = parent.OperatingSystem() if err != nil { return "", err } } // If the detectedOS is not in the supported OS list, the OS is unsupported. if detectedOS != "" { isSupported := false for _, osPrefix := range SupportedOS { if strings.HasPrefix(detectedOS, osPrefix) { isSupported = true break } } if !isSupported { return "", ErrUnsupported } } return }