Giter VIP home page Giter VIP logo

go's People

Contributors

dearplain avatar jomenxiao avatar lsytj0413 avatar mindlesslcc avatar nkysg avatar siddontang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go's Issues

go test is fail for time2 package

run following command and test case is not passed

go test ./... -test.v -test.cpu=1,2,4
go test ./... -test.v -test.short -test.race

timingwheel.go:(TimingWheel)After()函数中index计算不正确

siddontang,在查看你的时间轮代码时候,觉得(TimingWheel)After()函数中index计算不正确,为了验证猜想,我写了如下测试用例:

输出是:expect time cost 100s, while real time cost is 110 s.
显然,当运行次数越多,你的timingwheel的时间误差将越多,我给你修正后的(TimingWheel)After()函数代码如下:
func (w *TimingWheel) After(timeout time.Duration) <-chan struct{} {
if timeout >= w.maxTimeout {
panic("timeout too much, over maxtimeout")
}

index := int(timeout / w.interval)
if 0 < index {
    index--
}
w.Lock()

index = (w.pos + index) % len(w.cs)

b := w.cs[index]

w.Unlock()

return b

}

再次运行我的测试用例后,输出如下:
expect time cost 100s, while real time cost is 100 s.

This output is perfect.

有关tcp的连接问题

你好,我是不是要在run方法中w.onTicker()这行上面开一个协程去处理时间轮当前位置里面要处理的逻辑啊,例如关闭socket连接等操作

Go 1.10: file_lock_test.go:43: Fatal call has possible formatting directive %s

cb568a3 does not pass unit tests with Go 1.10. At least:

Testing: "/builddir/build/BUILD/go-cb568a3e5cc06256f91a2da5a87455f717eb33f4/_build/src/github.com/siddontang/go/filelock"
+ GOPATH=/builddir/build/BUILD/go-cb568a3e5cc06256f91a2da5a87455f717eb33f4/_build:/usr/share/gocode
+ go test -buildmode pie -compiler gc -ldflags '-extldflags '\''-Wl,-z,relro  '\'''
# github.com/siddontang/go/filelock
./file_lock_test.go:43: Fatal call has possible formatting directive %s
FAIL    github.com/siddontang/go/filelock [build failed]
+ GOPATH=/builddir/build/BUILD/go-cb568a3e5cc06256f91a2da5a87455f717eb33f4/_build:/usr/share/gocode
+ go test -buildmode pie -compiler gc -ldflags '-extldflags '\''-Wl,-z,relro  '\'''
# github.com/siddontang/go/list2
./list_test.go:60: Errorf format %p has arg p of wrong type int
./list_test.go:73: Errorf format %p has arg n of wrong type int
FAIL    github.com/siddontang/go/list2 [build failed]

timingwheel.go:(TimingWheel)After()函数中index计算不正确

siddontang,在查看你的时间轮代码时候,觉得(TimingWheel)After()函数中index计算不正确,为了验证猜想,我写了如下测试用例:

输出是:expect time cost 100s, while real time cost is 110 s.
显然,当运行次数越多,你的timingwheel的时间误差将越多,我给你修正后的(TimingWheel)After()函数代码如下:
`func (w *TimingWheel) After(timeout time.Duration) <-chan struct{} {
if timeout >= w.maxTimeout {
panic("timeout too much, over maxtimeout")
}

index := int(timeout / w.interval)
if 0 < index {
    index--
}
w.Lock()

index = (w.pos + index) % len(w.cs)

b := w.cs[index]

w.Unlock()

return b

}`

再次运行我的测试用例后,输出如下:
expect time cost 100s, while real time cost is 100 s.

This output is perfect.

go test failed bson_test

Description

go test failed bson_test

Reproduction guide

  1. clone repo
  2. run go test ./...

Observed behaviour

`----------------------------------------------------------------------
FAIL: bson_test.go:597: S.TestMarshalErrorItems

bson_test.go:600:
c.Assert(err, ErrorMatches, item.data)
... error string = "Attempted to marshal Raw kind 10 as a document"
... regex string = "Attempted to unmarshal Raw kind 10 as a document"


FAIL: bson_test.go:1429: S.TestObjectIdJSONUnmarshalingError

bson_test.go:1432:
c.Assert(err, ErrorMatches, Invalid ObjectId in JSON: "4d88e15b60f486e428412dc9A")
... error string = "invalid ObjectId in JSON: "4d88e15b60f486e428412dc9A""
... regex string = "Invalid ObjectId in JSON: "4d88e15b60f486e428412dc9A""`

Expected behaviour:

test passed.

System Info

OS: gnu/linux
golang: go version go1.9.2 linux/amd64

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.