Giter VIP home page Giter VIP logo

golib's People

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

Watchers

 avatar  avatar  avatar

golib's Issues

try: reconsider func names

I've been using try in scripts and really liking it.

However, I find A0, A1, etc to be fairly unintuitive. Particularly since in the kind of context in which I'm using try, I'm also tempted to dot import it. Then code reads:

A0(fn())

and the A0 is mysterious.

I'm on board for them being short. But maybe E for error? H for handle? X for "danger I might panic"? C for check?

Also, I'd like to request just "A" instead of "A0". :)

ioutil.SectionWriter runtime error:slice bounds out of range

hi ! I'm using the ioutil.SectionWriter to write to files at different offset concurently,but runtime error:slice bounds out of range raised. I'm confused if I used the wrong way?the code I used is as follows:

sectionWriter:=ioutil.NewSectionWriter(file,offset,num)
_,err=io.Copy(sectionWriter,resp.Body)

the error is as follows:

panic: runtime error: slice bounds out of range

goroutine 20 [running]:
panic(0x80f5a0, 0xc82001a0e0)
        /usr/lib/go-1.6/src/runtime/panic.go:481 +0x3e6
github.com/dsnet/golib/ioutil.(*SectionWriter).WriteAt(0xc820015a10, 0xc820130000, 0x8000, 0x8000, 0x80000000, 0xc82000b4c0, 0x0, 0x0)
        /home/robin/cold-storage/clients/cmd_go_lang/csutil/src/github.com/dsnet/golib/ioutil/section_writer.go:41 +0x21a
github.com/dsnet/golib/ioutil.(*SectionWriter).Write(0xc820015a10, 0xc820130000, 0x8000, 0x8000, 0x8000, 0x0, 0x0)
        /home/robin/cold-storage/clients/cmd_go_lang/csutil/src/github.com/dsnet/golib/ioutil/section_writer.go:27 +0x61
io.copyBuffer(0x7f88a4244ce8, 0xc820015a10, 0x7f88a41ff0b0, 0xc82000b500, 0xc820130000, 0x8000, 0x8000, 0x0, 0x0, 0x0)
        /usr/lib/go-1.6/src/io/io.go:382 +0x2c9
io.Copy(0x7f88a4244ce8, 0xc820015a10, 0x7f88a41ff0b0, 0xc82000b500, 0xc82000b500, 0x0, 0x0)
        /usr/lib/go-1.6/src/io/io.go:350 +0x64

During the debug,I find that when the error happens,the cnt is much larger than the length of data slice.But I don't know how to solve it !Am I using it the wrong way?

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.