Skip to content

Commit 38bcd52

Browse files
author
Peter Mogensen
committed
gofmt
1 parent 63097be commit 38bcd52

File tree

3 files changed

+25
-28
lines changed

3 files changed

+25
-28
lines changed

example.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package main
22

33
import (
44
"fmt"
5-
stdlog "log"
65
"github.com/One-com/gone/daemon"
76
"github.com/One-com/gone/daemon/srv"
87
"github.com/One-com/gone/http/gonesrv"
@@ -11,6 +10,7 @@ import (
1110
"github.com/One-com/gone/log/syslog"
1211
"github.com/One-com/gone/sd"
1312
"io"
13+
stdlog "log"
1414
"net/http"
1515
"os"
1616
"os/signal"
@@ -33,8 +33,8 @@ func newHTTPServer(handler http.HandlerFunc) (s srv.Server) {
3333

3434
// basic HTTP server
3535
s1 := &http.Server{
36-
Addr: ":4321",
37-
Handler: handler,
36+
Addr: ":4321",
37+
Handler: handler,
3838
ErrorLog: errorlog,
3939
}
4040
// wrapped to get Shutdown() and graceful shutdown

jconf/subconfig_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package jconf
22

33
import (
4-
"log"
54
"bytes"
65
"encoding/json"
6+
"log"
77
"os"
88
)
99

@@ -43,7 +43,7 @@ func ExampleSubConfig() {
4343

4444
// Let our submodule parse its own config
4545
initSubModule(cfg.S)
46-
46+
4747
var out bytes.Buffer
4848
b, err := json.Marshal(cfg)
4949
if err != nil {
@@ -55,7 +55,7 @@ func ExampleSubConfig() {
5555
log.Fatalf("Indent error: %s", err)
5656
}
5757
out.WriteTo(os.Stdout)
58-
58+
5959
// Output:
6060
// {
6161
// "A": "app",

metric/test/metrictest2.go

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
package main
22

33
import (
4+
"fmt"
45
"github.com/One-com/gone/metric"
56
"github.com/One-com/gone/metric/sink/statsd"
6-
"fmt"
77

88
"log"
99
"time"
10-
// "strconv"
10+
// "strconv"
1111
"io"
1212
"os"
1313
"sync"
1414
)
1515

1616
type blockOut struct {
17-
mu sync.Mutex
17+
mu sync.Mutex
1818
out io.Writer
1919
}
2020

@@ -26,44 +26,43 @@ func (b *blockOut) Write(p []byte) (n int, err error) {
2626
return
2727
}
2828

29-
var period = metric.FlushInterval(2*time.Second)
29+
var period = metric.FlushInterval(2 * time.Second)
3030

3131
func main() {
3232

3333
sink, err := statsd.New(
3434
statsd.Buffer(512),
35-
statsd.Output(&blockOut{out:os.Stdout}),
35+
statsd.Output(&blockOut{out: os.Stdout}),
3636
statsd.Prefix("prefix"))
3737
if err != nil {
3838
log.Fatal(err)
3939
}
4040

41-
// client.Gauge("gauge", 42, false)
42-
// client.Counter("c", 1, true)
41+
// client.Gauge("gauge", 42, false)
42+
// client.Counter("c", 1, true)
4343

44-
4544
client := metric.NewClient(sink, period)
4645

47-
gauge := client.NewGauge("gauge",period)
48-
timer := client.NewTimer("timer", period)
49-
histo := client.NewHistogram("histo",period)
50-
counter := client.NewCounter("counter",period)
51-
// set := client.NewSet("set", period)
46+
gauge := client.NewGauge("gauge", period)
47+
timer := client.NewTimer("timer", period)
48+
histo := client.NewHistogram("histo", period)
49+
counter := client.NewCounter("counter", period)
50+
// set := client.NewSet("set", period)
5251

5352
g := 100
5453
for g != 0 {
55-
client.Gauge(fmt.Sprintf("g%d",g), uint64(g), false)
56-
client.Counter(fmt.Sprintf("c%d",g), 1, false)
54+
client.Gauge(fmt.Sprintf("g%d", g), uint64(g), false)
55+
client.Counter(fmt.Sprintf("c%d", g), 1, false)
5756
counter.Inc(1)
5857
gauge.Set(uint64(g))
59-
timer.Sample(time.Duration(g)*time.Millisecond)
58+
timer.Sample(time.Duration(g) * time.Millisecond)
6059
histo.Sample(int64(g))
61-
// set.Update(strconv.FormatInt(int64(g), 10))
62-
60+
// set.Update(strconv.FormatInt(int64(g), 10))
61+
6362
time.Sleep(time.Second)
6463
g--
65-
if g % 2 == 0 {
66-
if g % 4 == 0 {
64+
if g%2 == 0 {
65+
if g%4 == 0 {
6766
client.SetOptions(metric.FlushInterval(time.Second))
6867
} else {
6968
client.SetOptions(metric.FlushInterval(0))
@@ -74,5 +73,3 @@ func main() {
7473

7574
client.Flush()
7675
}
77-
78-

0 commit comments

Comments
 (0)