Go fmt on the entire project

This commit is contained in:
Renan DelValle 2017-01-03 20:57:25 -05:00
parent b636ff490c
commit 2678032c2c
6 changed files with 18 additions and 18 deletions

View file

@ -7,8 +7,8 @@ One should implement Val() to be able to use this utility.
package runAvg
import (
"errors"
"container/list"
"errors"
)
type Interface interface {
@ -19,7 +19,7 @@ type Interface interface {
}
type runningAverageCalculator struct {
window list.List
window list.List
windowSize int
currentSum float64
}
@ -30,7 +30,7 @@ var racSingleton *runningAverageCalculator
// return single instance
func getInstance(curSum float64, wSize int) *runningAverageCalculator {
if racSingleton == nil {
racSingleton = &runningAverageCalculator {
racSingleton = &runningAverageCalculator{
windowSize: wSize,
currentSum: curSum,
}
@ -55,7 +55,7 @@ func (rac *runningAverageCalculator) calculate(data Interface) float64 {
elementToRemove := rac.window.Front()
rac.currentSum -= elementToRemove.Value.(Interface).Val()
rac.window.Remove(elementToRemove)
// adding new element to the window
rac.window.PushBack(data)
rac.currentSum += data.Val()
@ -105,4 +105,4 @@ func Init() {
racSingleton.window.Init()
racSingleton.windowSize = 0
racSingleton.currentSum = 0.0
}
}