chore: format our golang codes by 'goreturns -l -w .' (#47)

be noted that we don't need to format generated codes, e.g. generated by thrift
This commit is contained in:
Jay 2019-07-22 13:06:31 +08:00 committed by GitHub
parent a247e34ea4
commit 927eb455ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 57 additions and 63 deletions

View File

@ -82,5 +82,5 @@ func flows2map(flows []*proxy.Flow, m map[int64]int) {
}
}
fmt.Printf("Load map[wayid] to speed with %d items, %d forward and %d backward.\n", (fwdCnt+bwdCnt), fwdCnt, bwdCnt)
fmt.Printf("Load map[wayid] to speed with %d items, %d forward and %d backward.\n", (fwdCnt + bwdCnt), fwdCnt, bwdCnt)
}

View File

@ -1,8 +1,8 @@
package main
import (
"testing"
"fmt"
"testing"
)
func setChan2True(c chan<- bool) {

View File

@ -1,16 +1,16 @@
package main
import (
"testing"
"os"
"log"
"fmt"
"strconv"
"io"
"encoding/csv"
"fmt"
"io"
"io/ioutil"
"strings"
"log"
"os"
"reflect"
"strconv"
"strings"
"testing"
"github.com/Telenav/osrm-backend/traffic_updater/go/gen-go/proxy"
)
@ -51,7 +51,6 @@ func TestGenerateSingleRecord2(t *testing.T) {
}
}
func validateStatistic(ds *dumperStatistic, t *testing.T) {
sum := ds.Sum()
if (sum.wayCnt != 4) || (sum.nodeCnt != 9) || (sum.fwdRecordCnt != 4) || (sum.bwdRecordCnt != 3) || (sum.wayMatchedCnt != 4) || (sum.nodeMatchedCnt != 9) {
@ -177,4 +176,3 @@ func compareFileContentUnstable(f1, f2 string, t *testing.T) {
t.Error("TestLoadWay2Nodeids failed to generate correct map\n")
}
}

View File

@ -6,6 +6,7 @@ import (
"log"
"os"
"time"
"github.com/golang/snappy"
)
@ -38,7 +39,6 @@ func load(mappingPath string, data chan<- string) {
}
}
// input data format
// wayid1, n1, n2
// wayid2, n3, n4, n5
@ -54,5 +54,3 @@ func convert(data <-chan string, sources [TASKNUM]chan string) {
sources[chanIndex] <- str
}
}

View File

@ -1,12 +1,11 @@
package main
import (
"testing"
"reflect"
"sync"
"testing"
)
func TestLoadWay2Nodeids(t *testing.T) {
// load result into sources
var sources [TASKNUM]chan string
@ -19,7 +18,7 @@ func TestLoadWay2Nodeids(t *testing.T) {
allWay2NodesChan := make(chan string, 10000)
var wgs sync.WaitGroup
wgs.Add(TASKNUM)
for i:= 0; i < TASKNUM; i++ {
for i := 0; i < TASKNUM; i++ {
//fmt.Printf("### current i is %d\n", i)
go mergeChannels(sources[i], allWay2NodesChan, &wgs)
}
@ -61,4 +60,3 @@ func generateMockWay2nodeids(way2nodeids map[string]bool) {
way2nodeids["24418343,84760849102,84760850102"] = true
way2nodeids["24418344,84760846102,84760858102"] = true
}

View File

@ -2,10 +2,11 @@ package main
import (
"flag"
"strings"
"fmt"
"os"
"io"
"os"
"strings"
"github.com/golang/snappy"
)
@ -48,7 +49,7 @@ func main() {
defer fo.Close()
defer fo.Sync()
buf := make([]byte, 128 * 1024)
buf := make([]byte, 128*1024)
if inputCompressed {
_, err := io.CopyBuffer(fo, snappy.NewReader(fi), buf)
if err != nil {

View File

@ -156,4 +156,3 @@ func main() {
endTime := time.Now()
fmt.Printf("Total processing time for wayid2nodeids-extract takes %f seconds\n", endTime.Sub(startTime).Seconds())
}