Logo
Explore Help
Register Sign In
joshuacox/katenary
1
0
Fork 0
You've already forked katenary
forked from Katenary/katenary
Code Pull Requests Activity
Files
689c2a48033e219fa661ad5c7a0dcd47737e5c36
katenary/generator/labels/labelStructs/configMap.go

14 lines
274 B
Go
Raw Normal View History

Use real types to parse labels We were using `yaml.Unmarshal` on basic types or inline structs. This was not efficient and not clear to defined what we expect in labels. We now use types to unmarshal the labels. Only the `values` label is, at this time, parsed by GetValuesFromLabel because this `utils` function is clearly a special case.
2024-04-24 23:06:45 +02:00
package labelStructs
Add more tests, refactor to fix problems Signed-off-by: Patrice Ferlet <metal3d@gmail.com>
2024-04-24 20:55:27 +02:00
Use real types to parse labels We were using `yaml.Unmarshal` on basic types or inline structs. This was not efficient and not clear to defined what we expect in labels. We now use types to unmarshal the labels. Only the `values` label is, at this time, parsed by GetValuesFromLabel because this `utils` function is clearly a special case.
2024-04-24 23:06:45 +02:00
import "gopkg.in/yaml.v3"
type ConfigMapFile []string
func ConfigMapFileFrom(data string) (ConfigMapFile, error) {
var mapping ConfigMapFile
if err := yaml.Unmarshal([]byte(data), &mapping); err != nil {
return nil, err
}
return mapping, nil
Add more tests, refactor to fix problems Signed-off-by: Patrice Ferlet <metal3d@gmail.com>
2024-04-24 20:55:27 +02:00
}
Copy Permalink
Powered by Gitea Version: 1.24.5 Page: 1100ms Template: 2ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API