mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2025-03-28 02:37:11 +00:00
source/local: trim whitespace from input
Trim leading and trailing whitespace from the input (from feature files and hooks). Makes it a bit more relaxed on the expected input format.
This commit is contained in:
parent
45dc46ab81
commit
181b4e0168
1 changed files with 3 additions and 2 deletions
|
@ -147,9 +147,10 @@ func (s *localSource) GetFeatures() *nfdv1alpha1.Features {
|
|||
func parseFeatures(lines [][]byte) map[string]string {
|
||||
features := make(map[string]string)
|
||||
|
||||
for _, line := range lines {
|
||||
for _, l := range lines {
|
||||
line := strings.TrimSpace(string(l))
|
||||
if len(line) > 0 {
|
||||
lineSplit := strings.SplitN(string(line), "=", 2)
|
||||
lineSplit := strings.SplitN(line, "=", 2)
|
||||
|
||||
key := lineSplit[0]
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue