1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2025-03-05 08:17:04 +00:00

kernel.go: Replace forbidden symbols

Some Kernel versions include symbols such as "+".
Yocto L4T kernel is an example of this behaviour.
To fix this error all unknown symbols are replaced by an underscore.

Signed-off-by: Pablo Rodriguez <paroque28@gmail.com>
This commit is contained in:
Pablo Rodriguez 2020-05-14 16:17:04 +00:00 committed by Pablo Rodriguez
parent 1bdf0525f9
commit 3c81ff9d80

View file

@ -97,6 +97,11 @@ func parseVersion() (map[string]string, error) {
}
full := strings.TrimSpace(string(raw))
// Replace forbidden symbols
fullRegex := regexp.MustCompile("[^-A-Za-z0-9_.]")
full = fullRegex.ReplaceAllString(full, "_")
version["full"] = full
// Regexp for parsing version components