func processFile()

in load_tests/validation/validate.go [176:210]


func processFile(file *os.File, filePath string) (int, error) {
	var err error
	file, err = os.Open(filePath)
	if err != nil {
		return 0, fmt.Errorf("error opening file: %v", err)
	}
	defer file.Close()
	var message Message
	var recordId string

	localCounter := 0
	// Directly unmarshal the JSON objects from the S3 object body
	decoder := json.NewDecoder(file)
	for {
		err = decoder.Decode(&message)
		if err == io.EOF {
			break
		}
		if err != nil {
			fmt.Println("[TEST ERROR] Malform log entry. Unmarshal Error:", err)
			continue
		}

		recordId = message.Log[:8]
		value, err := strconv.ParseUint(recordId, 10, 32)
		if err != nil {
			fmt.Println("[TEST ERROR] Malform log entry. ParseUint Error:", err)
			continue
		}
		recordIdUint := uint32(value)
		inputMap[recordIdUint] = struct{}{}
	}

	return localCounter, nil
}