chore: some changes

This commit is contained in:
srikanthccv 2025-05-30 22:14:36 +05:30
parent 1f04b77897
commit 9fd7a1807a

View File

@ -10,13 +10,11 @@ import (
// LoadFieldKeysFromJSON loads telemetry field keys from a JSON file
func LoadFieldKeysFromJSON(filePath string) (map[string][]*telemetrytypes.TelemetryFieldKey, error) {
// Read the JSON file
jsonData, err := os.ReadFile(filePath)
if err != nil {
return nil, fmt.Errorf("failed to read JSON file: %w", err)
}
// Parse JSON directly into the target format using built-in unmarshaling
var result map[string][]*telemetrytypes.TelemetryFieldKey
if err := json.Unmarshal(jsonData, &result); err != nil {
return nil, fmt.Errorf("failed to unmarshal JSON: %w", err)
@ -27,7 +25,6 @@ func LoadFieldKeysFromJSON(filePath string) (map[string][]*telemetrytypes.Teleme
// LoadFieldKeysFromJSONString loads telemetry field keys from a JSON string
func LoadFieldKeysFromJSONString(jsonStr string) (map[string][]*telemetrytypes.TelemetryFieldKey, error) {
// Parse JSON directly into the target format using built-in unmarshaling
var result map[string][]*telemetrytypes.TelemetryFieldKey
if err := json.Unmarshal([]byte(jsonStr), &result); err != nil {
return nil, fmt.Errorf("failed to unmarshal JSON: %w", err)