package et_calc import "strings" func unitTrans(data map[string]float64, inUnits, outUnits map[string]string) { for kName, _ := range data { inUnit, ok := inUnits[kName] outUnit, ok2 := outUnits[kName] if strings.EqualFold(inUnit, outUnit) || !ok || !ok2 { continue } else { data[kName] *= getCoef(inUnit, outUnit) } } } func getCoef(in, out string) float64 { k := 1.0 return k }