[go-nuts] Re: Persistence of value, or Safely close what you expected

2019-03-18 Thread Andrey Tcherepanov
Thank you all very much for the discussion and suggestions. I decided to take a dive and opened proposal under https://github.com/golang/go/issues/30916 Any suggestions on improvements are welcome, but please keep in mind that I am not trying to solve my CURRENT problem at hand (it is solved,

Re: [go-nuts] why the XOR between*(*[]uintptr)(unsafe.Pointer(&dst)) is fast then []byte

2019-03-18 Thread Michael Jones
n%8 is not what you want. n - n%8 is what you want, best expressed as n &^0x7 On Mon, Mar 18, 2019 at 7:36 PM zhou yu wrote: > *Why the XOR between*(*[]uintptr)(unsafe.Pointer(&dst)) is fast then > []byte?* > > I find a fast xor lib https://github.com/templexxx/xor, and write the > benchmark be

Re: [go-nuts] Signal SIGSEGV: segmentation violation code=0x1

2019-03-18 Thread Ian Lance Taylor
On Mon, Mar 18, 2019 at 8:17 PM <615912...@qq.com> wrote: > > shmid, _, err := syscall.Syscall(syscall.SYS_SHMGET, uintptr(10001), 1<<32, > IpcCreate|0600) > data_shmaddr, _, _ := syscall.Syscall(syscall.SYS_SHMAT, shmid, 0, 0) > C.memcpy(unsafe.Pointer(data_shmaddr+uintptr(per_offs)), > unsafe.P

Re: [go-nuts] cgo:build trouble

2019-03-18 Thread Ian Lance Taylor
On Sun, Mar 17, 2019 at 9:37 PM wrote: > > package main > > import( > ) > > /* > #include > */ > import "C" > > func main() { > C.printf(C.CString("hello")) > } > > //>build this file with go build, i got > //./testems.go:12:2: unexpected type: ... > > could someone help me with this trouble?

Re: [go-nuts] Re: why compiler do not accept elided type in this case ?

2019-03-18 Thread zhou yu
sorry and thank you, impressive 在 2019年3月19日星期二 UTC+8上午11:15:11,kortschak写道: > > It can infer the type, but from memory, it was decided that for > improved safety explicit types should be used. There have been > discussion about relaxing this in the past and it is an open proposal. > > See http

[go-nuts] Signal SIGSEGV: segmentation violation code=0x1

2019-03-18 Thread 615912558
shmid, _, err := syscall.Syscall(syscall.SYS_SHMGET, uintptr(10001), 1<<32, IpcCreate|0600) data_shmaddr, _, _ := syscall.Syscall(syscall.SYS_SHMAT, shmid, 0, 0) C.memcpy(unsafe.Pointer(data_shmaddr+uintptr(per_offs)), unsafe.Pointer((C. CString)(string(*data))), C.ulong(len(*data))) I'm trying t

Re: [go-nuts] Re: why compiler do not accept elided type in this case ?

2019-03-18 Thread Dan Kortschak
It can infer the type, but from memory, it was decided that for improved safety explicit types should be used. There have been discussion about relaxing this in the past and it is an open proposal. See https://github.com/golang/go/issues/21496 On Mon, 2019-03-18 at 20:01 -0700, zhou yu wrote: > g

[go-nuts] Re: why compiler do not accept elided type in this case ?

2019-03-18 Thread zhou yu
gc can not infer the type of {1, 2} of {1,2,3,4}, so you need to indicate it's type 在 2019年3月19日星期二 UTC+8上午10:47:43,dja...@gmail.com写道: > > Hi, > https://play.golang.org/p/hRHEuGG6zAf > why composite literal in line 16 does not work ? > thanks in advance. > -- You received this message because

[go-nuts] why compiler do not accept elided type in this case ?

2019-03-18 Thread djadala
Hi, https://play.golang.org/p/hRHEuGG6zAf why composite literal in line 16 does not work ? thanks in advance. -- 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 gola

[go-nuts] why the XOR between*(*[]uintptr)(unsafe.Pointer(&dst)) is fast then []byte

2019-03-18 Thread zhou yu
*Why the XOR between*(*[]uintptr)(unsafe.Pointer(&dst)) is fast then []byte?* I find a fast xor lib https://github.com/templexxx/xor, and write the benchmark below, the result show that BenchmarkFastXORWords is 5x faster than BenchmarkS afeXORBytes on my computer I can't figure out why? Anyon

[go-nuts] go build not working for windows - got This version is not compatible with the version of Windows you're running.

2019-03-18 Thread Tong Sun
Hi, Shooting into dark to see if somebody has bumped into such problem before -- when I am building Go for a specific project, I'll get that "This version is not compatible with the version of Windows you're running" error. Note, - I'll get the error *only *for that *specific *project, n

Re: [go-nuts] Re: gomobile genjava duplicate constructor definition

2019-03-18 Thread Elias Naur
On Mon, Mar 18, 2019 at 6:33 PM wrote: > > Elias, thank you for the prompt response and submitting a fix. > > I have checked this out, and though it does result in successful compilation, > it does not solve my problem because the public constructor is removed > allowing me no initializer access

Re: [go-nuts] protobuf and golang

2019-03-18 Thread Michael Jones
Yes, the way to think of the topic here is: first, write your own code to decode the legacy format, then arrange the data in a struct of your design, and *then* persist the struct or slice of structs using an encode/decode mechanism of choice, such as gob, protobuf, json, etc. Step one here is you

[go-nuts] Re: How to retain environment in SSH

2019-03-18 Thread EduRam
Try passing command "source .login;" before your command. On Monday, March 11, 2019 at 7:00:23 AM UTC, Subramanian Sridharan wrote: > > Hi guys! > > I would like to know how to keep the environment variables over SSH using > Go. > > I find that several environment variables are missing when I SS

Re: [go-nuts] protobuf and golang

2019-03-18 Thread Kurtis Rader
On Mon, Mar 18, 2019 at 10:00 AM R Srinivasan wrote: > i am investigating the use of go+protobuf for reading binary files of a > legacy design. > > my intial attempts to define the data structures have hit a roadblock - > support for data types such as uint16, int16, uint8, int8. Is this an > in

Re: [go-nuts] Re: protobuf and golang

2019-03-18 Thread Robert Engels
protobuf is not designed to match up to existing binary formats. It is a specification that allows protobuf implementations to read/write messages in a cross platform way. Things like “text” protobuf are human readable. > On Mar 18, 2019, at 12:42 PM, Burak Serdar wrote: > >> On Mon, Mar 18,

Re: [go-nuts] Re: protobuf and golang

2019-03-18 Thread Burak Serdar
On Mon, Mar 18, 2019 at 11:39 AM R Srinivasan wrote: > > Dont follow you. There is a way to indicate a particular field is uint16 in > the proto3 language? please clarify. thanks, srini There are only 32- and 64-bit variants, according to https://developers.google.com/protocol-buffers/docs/prot

[go-nuts] Re: protobuf and golang

2019-03-18 Thread R Srinivasan
Dont follow you. There is a way to indicate a particular field is uint16 in the proto3 language? please clarify. thanks, srini On Monday, March 18, 2019 at 1:08:58 PM UTC-4, Tamás Gulácsi wrote: > > Protobuf is a data interchange format, good to publish that legacy binary > - after you've parsed

[go-nuts] Re: gomobile genjava duplicate constructor definition

2019-03-18 Thread kevin . harrison
Elias, thank you for the prompt response and submitting a fix. I have checked this out, and though it does result in successful compilation, it does not solve my problem because the public constructor is removed allowing me no initializer access from the application side. I had attempted to fix

[go-nuts] protobuf and golang

2019-03-18 Thread Tamás Gulácsi
Protobuf is a data interchange format, good to publish that legacy binary - after you've parsed it. As such you are free to put that uing16 value into an uint32... -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group an

[go-nuts] protobuf and golang

2019-03-18 Thread R Srinivasan
all i am investigating the use of go+protobuf for reading binary files of a legacy design. my intial attempts to define the data structures have hit a roadblock - support for data types such as uint16, int16, uint8, int8. Is this an inherent protobuf limitation or am i overlooking something.

Re: [go-nuts] Go packaging

2019-03-18 Thread Sam Whited
On Mon, Mar 18, 2019, at 06:24, Nada Saif wrote: > I am learning to Go. For packages, do I need to use GitHub? > I tried to build two packages one accessing functions from the other. Welcome! You can use whatever repository hosting you want, and even use your own domain name with it! I encourage

[go-nuts] Re: panic at fmt.Printlb

2019-03-18 Thread jake6502
Can't say for sure without seeing additional code. But it looks like you have a race condition. It appears that the fmt.Println() is trying to print the map at the same time that you are modifying it. Your locks may prevent ForEachRemov() and FindAndRemove() from accessing the map at the same

[go-nuts] Re: gdb go optimized out

2019-03-18 Thread mountainfpf
I set the parameters in your way and execute dlv or not.Thanks. On Saturday, March 16, 2019 at 12:12:42 AM UTC+8, Jake Montgomery wrote: > > First off, we are always happy to have new users in the group. But one > more bit of etiquette - Please don't post screenshots of text. Instead copy > pas

Re: [go-nuts] Re: Go 1.12.1 and Go 1.11.6 are released

2019-03-18 Thread Michael Jones
I don't have direct feedback on this, but I do have an observation based on my own faster-sort code, which is that timing seems about the same, and scaling seems different than this report. The sorty_test.go file starts with "const N = 1 << 28" so we're talking about sorting a 268,435,456-element