mirror of https://github.com/siddontang/go.git
format with goimports
This commit is contained in:
parent
530a231625
commit
b151716326
|
@ -182,7 +182,7 @@ func isZero(v reflect.Value) bool {
|
||||||
if v.Type() == typeTime {
|
if v.Type() == typeTime {
|
||||||
return v.Interface().(time.Time).IsZero()
|
return v.Interface().(time.Time).IsZero()
|
||||||
}
|
}
|
||||||
for i := v.NumField()-1; i >= 0; i-- {
|
for i := v.NumField() - 1; i >= 0; i-- {
|
||||||
if !isZero(v.Field(i)) {
|
if !isZero(v.Field(i)) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -207,7 +207,7 @@ func (e *encoder) addSlice(v reflect.Value) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
l := v.Len()
|
l := v.Len()
|
||||||
et := v.Type().Elem()
|
et := v.Type().Elem()
|
||||||
if et == typeDocElem {
|
if et == typeDocElem {
|
||||||
for i := 0; i < l; i++ {
|
for i := 0; i < l; i++ {
|
||||||
elem := v.Index(i).Interface().(DocElem)
|
elem := v.Index(i).Interface().(DocElem)
|
||||||
|
@ -401,7 +401,7 @@ func (e *encoder) addElem(name string, v reflect.Value, minSize bool) {
|
||||||
case time.Time:
|
case time.Time:
|
||||||
// MongoDB handles timestamps as milliseconds.
|
// MongoDB handles timestamps as milliseconds.
|
||||||
e.addElemName('\x09', name)
|
e.addElemName('\x09', name)
|
||||||
e.addInt64(s.Unix() * 1000 + int64(s.Nanosecond() / 1e6))
|
e.addInt64(s.Unix()*1000 + int64(s.Nanosecond()/1e6))
|
||||||
|
|
||||||
case url.URL:
|
case url.URL:
|
||||||
e.addElemName('\x02', name)
|
e.addElemName('\x02', name)
|
||||||
|
|
|
@ -31,7 +31,6 @@ func (h *StreamHandler) Close() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//NullHandler does nothing, it discards anything.
|
//NullHandler does nothing, it discards anything.
|
||||||
type NullHandler struct {
|
type NullHandler struct {
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
package websocket
|
package websocket
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gorilla/websocket"
|
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/gorilla/websocket"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestWSClient(t *testing.T) {
|
func TestWSClient(t *testing.T) {
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
package websocket
|
package websocket
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gorilla/websocket"
|
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/gorilla/websocket"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestWSServer(t *testing.T) {
|
func TestWSServer(t *testing.T) {
|
||||||
|
|
Loading…
Reference in New Issue