if acc, found := findAcc(reg); found {
if diff, updated := throttle.ProcessUpdate(
dev.MAC,
rater.PowerConsumptionEntry{PowerConsumption: int(acc), Time: time.Now()},
); updated {
prof.PowerConsumption = cap.NewPowerConsumptionReport()
prof.PowerConsumption.PowerConsumption.Value = cap.PowerConsumptionProperties{
DeltaEnergy: diff,
}
}
}
읽을 수 잇냐????
c++ 보다가 go 코드 보니까 ㄹㅇ 선녀로 보이네
이걸보면 역시 함() { } 보다 함() { } 이 가독성이 더좋은것같다
개인적으로는 if 컨디션 전 초기화부분은 길면 따로 빼는게 어떨까 싶은데 뭐 취향인 듯
나도 같은 생각임 어차피 :=로 할당할거면 diff, updated를 두번째 if문 밖으로 빼는게 깔끔해보임