[go-nuts] Re: Hi, someone may help me converting this python code to GO

2016-07-09 Thread Kevin Powick
Glad to see you put some effort into it yourself. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visi

Re: [go-nuts] Re: Go 1.7 Release Candidate 1 is released

2016-07-09 Thread Lucio
On Friday, 8 July 2016 16:49:02 UTC+2, Ian Lance Taylor wrote: > > On Fri, Jul 8, 2016 at 2:08 AM, Lucio > > wrote: > > This may be spurious, but I took a fresh clone/checkout of go1.7rc1 and > > tried to build it using an arbitrary TIP (at the time) version of Go - > one, > > I'm sure, that w

[go-nuts] Hi, someone may help me converting this python code to GO

2016-07-09 Thread eavinti
def GetCrc16(strHexData): crc16tab = ( 0x, 0x1189, 0x2312, 0x329B, 0x4624, 0x57AD, 0x6536, 0x74BF, 0x8C48, 0x9DC1, 0xAF5A, 0xBED3, 0xCA6C, 0xDBE5, 0xE97E, 0xF8F7, 0x1081, 0x0108, 0x3393, 0x221A, 0x56A5, 0x472C, 0x75B7, 0x643E, 0x9CC9, 0x8D40, 0xBFDB, 0xAE52, 0xDAED, 0xCB64, 0xF9FF, 0xE876,

Re: [go-nuts] confused about string allocation

2016-07-09 Thread Ian Lance Taylor
On Sat, Jul 9, 2016 at 4:38 PM, Erich Rickheit KSC wrote: > I found myself writing code like this: > > s := make([]byte, len) > for i := 0; i < len; i++ { > // fill in s with stringy goodness > } > return string(s) > > Does this reuse the memory in s

Re: [go-nuts] Go can't alloc custom objects from byte slice's memory address?

2016-07-09 Thread Ian Lance Taylor
On Fri, Jul 8, 2016 at 10:11 PM, Arthur wrote: > my program allocates many different kinds of small object, and that gives GC > a lot pressure. > so I wan't to make a big slice and split object from it manually. > > block = make([]byte, 30*1024) > myObj := (*myObjType)(unsafe.Pointer(&block[offset

[go-nuts] Missing .a files after installing module with go get

2016-07-09 Thread hola
I'm trying to install a module with go get but after running my application I'm getting error: /usr/local/Cellar/go/1.6.2/libexec/bin/go build -o /private/var/folders/nl/bnwx64ps33jd8x5spk494g44gn/T/Unnamed14go /Users/user/dev/go/src/com.app/gateway/main.go # command-line-arguments /usr/loc

[go-nuts] confused about string allocation

2016-07-09 Thread Erich Rickheit KSC
I found myself writing code like this: s := make([]byte, len) for i := 0; i < len; i++ { // fill in s with stringy goodness } return string(s) Does this reuse the memory in s for the string, or does it allocate new memory and copy? Or does escape an

Re: [go-nuts] Re: Using "map index expressions" as the value for a range loop

2016-07-09 Thread Matt Harden
OK, after initializing k to an actual value, I see what's happening: k = "" prior to the loop m = {"foo": 314, "bar": 42} prior to the loop loop, round 1 k gets set to "foo" m[""] gets set to 314 -- AND by chance, the map iterator is going to visit this new map entry later (round 3). m["foo"] ge

Re: [go-nuts] Re: Using "map index expressions" as the value for a range loop

2016-07-09 Thread Matt Harden
OK but based on Jesse's explanation, I expect the map to contain keys "bar" and "". But in fact, in the playground at least, we get "foo" and "bar", with the values reversed: foo bar map[foo:314 bar:42] I can't think of a valid explanation for that behavior. On Thu, Jul 7, 2016 at 4:44 PM wr

[go-nuts] Re: Does http PATCH not read body data ?

2016-07-09 Thread C Banning
try: https://play.golang.org/p/2RDK8JVO_2 On Saturday, July 9, 2016 at 12:12:42 PM UTC-6, Mayank Jha wrote: > > I am using, https://play.golang.org/p/0_FhHaMNIz to implement a PATCH > method endpoint. However when I try to read the body, using io.ioutil I am > getting nothing in the body even th

[go-nuts] Does http PATCH not read body data ?

2016-07-09 Thread Mayank Jha
I am using, https://play.golang.org/p/0_FhHaMNIz to implement a PATCH method endpoint. However when I try to read the body, using io.ioutil I am getting nothing in the body even though I send some data using, "curl -vvv -XPATCH localhost:8000 -d'sdsadkk'". Is this normal ? -- You received this

[go-nuts] Re: Go can't alloc custom objects from byte slice's memory address?

2016-07-09 Thread Arthur
finally, I find the reason: the allocated objects can't have reference to other objects, because GC don't know those reference and would recycle them. after GC, we'll have dangling pointer and may meet strange behavior. 在 2016年7月9日星期六 UTC+8下午1:11:49,Arthur写道: > > my program allocates many differe

[go-nuts] Re: Go 1.7 Release Candidate 1 is released

2016-07-09 Thread Eric Brown
Look at the release notes, under 'Compiler Toolchain', about 20% scroll down the page. Try the compiler arguments provided and see if disabling the new compiler back-end ( -ssa=0 ) resolves this and report your results. On Friday, July 8, 2016 at 4:08:31 AM UTC-5, Lucio wrote: > > This may be s

[go-nuts] Re: Go can't alloc custom objects from byte slice's memory address?

2016-07-09 Thread andrewchamberss
Rather than using unsafe, maybe you could batch allocate with typed slices. that are split up by type. On Saturday, July 9, 2016 at 5:11:49 PM UTC+12, Arthur wrote: > > my program allocates many different kinds of small object, and that gives > GC a lot pressure. > so I wan't to make a big slice

[go-nuts] Re: Go can't alloc custom objects from byte slice's memory address?

2016-07-09 Thread Chad
You could create an array per object type (which would be the aggregate underlying array of your slices) and use a sync.Pool for each type as the previous post mentions. On Saturday, July 9, 2016 at 8:40:15 AM UTC+2, Arthur wrote: > > the program need parser SQL, and generate the AST node alloca

[go-nuts] Re: Go can't alloc custom objects from byte slice's memory address?

2016-07-09 Thread Uli Kunitz
You might want to look at sync.Pool for reusing temporary objects of the same type. Otherwise you want to check whether all the temporary objects are really required. On Saturday, July 9, 2016 at 8:40:15 AM UTC+2, Arthur wrote: > > the program need parser SQL, and generate the AST node allocates