Re: [go-nuts] issues about struct align

2017-05-20 Thread xjdrew
Here is my c code test: drew@drew-PC MSYS /e/examples/c $ cat align.c #include typedef struct _A { char a; long long b; } A; int main() { printf("%d\n", sizeof(int*)); printf("%d\n", sizeof(A)); } drew@drew-PC MSYS /e/examples/c $ gcc -o align align.c drew

Re: [go-nuts] issues about struct align

2017-05-20 Thread xjdrew
To Jan & Ohir, thanks for information. Do you run my code example in GO plagground? The pointer size of `a` is 4 bytes, it shows go playground use 32bit go. As my test, the go playground environment is: GOOS: nacl GOARCH: amd64p32 the Machine is amd64, but run 32bit GO. My Machine is amd6

Re: [go-nuts] Re: text/template: cannot index from map[int32]string

2017-05-20 Thread Jon Calhoun
As a temporary fix you could create a custom function for when you are using maps with an int32 key. This is less than ideal but would work temporarily - https://play.golang.org/p/IOa_p4gxDB On Saturday, May 20, 2017 at 12:26:46 PM UTC-4, bup...@gmail.com wrote: > > I reported this as issue #204

Re: [go-nuts] A question about reading of TCP sockets.

2017-05-20 Thread Enrico Maria Fusi
Hi I was under this impression, too I think for my purposes is Better to use a TLV based stream, also because I am familiar with TLVs. Which means, a naturally delimited syntax, as you said. Thanks for the clarification on tcp read behavior. Thank On 20 May 2017 17:39, "Jesper Louis Andersen" <

Re: [go-nuts] multiple commands in one ssh session

2017-05-20 Thread Matt Harden
Instead of session.Run, use session.Shell. To interact with the shell, you will need to connect to at least Stdin, probably using StdinPipe() (NOTE I left out error handling): session, err := client.NewSession() in, err := session.StdinPipe() out, err := session.StdoutPipe() session.Stderr = out

Re: [go-nuts] "non-bool used as if condition" - why not?

2017-05-20 Thread Rob Pike
I have (schematically) seen this C++ code in production: bool flag = "false"; This kind of problem is introduced by implicit type conversions, and (outside of some carefully controlled cases with interfaces), Go does not have them, for just this sort of reason. Bugs caused by implicit type conver

Re: [go-nuts] Compiling Go plugins with playground/NACL/GAE-like isolation

2017-05-20 Thread Tylor
In my case, since I can have my users submit their code to my service and I take care of the building and distributing and loading their plug-in, I'm going to force them to: 1. Only import from a whitelisted set of packages 2. Forbid them from calling go 3. Disallow cgo 4. Have their interfacing f

Re: [go-nuts] Re: text/template: cannot index from map[int32]string

2017-05-20 Thread bupjae
I reported this as issue #20439. Thanks. By the way, I'm still finding how to workaround. 2017년 5월 21일 일요일 오전 1시 11분 26초 UTC+9, Ian Lance Taylor 님의 말: > On Sat, May 20, 2017 at 7:55 AM, > wrote: > > One additional question: may I report this as bu

Re: [go-nuts] Compiler: tools to develop new target for Golang?

2017-05-20 Thread Ian Lance Taylor
On Fri, May 19, 2017 at 3:21 PM, wrote: > My apologies, I have worded the question poorly. > > Basically, I want to compile Go source to a bytecode format, which will be > interpreted at some later step. The design is similar to Java's compilation > process. > > Thus far, I know I can produce an

Re: [go-nuts] Re: text/template: cannot index from map[int32]string

2017-05-20 Thread Ian Lance Taylor
On Sat, May 20, 2017 at 7:55 AM, wrote: > One additional question: may I report this as bug of golang? Yes. Thanks. Ian > 2017년 5월 20일 토요일 오후 11시 51분 56초 UTC+9, bup...@gmail.com 님의 말: >> >> Go Source: >> https://play.golang.org/p/dMKNy4pTnb >> >> Expected: >> >> [ ok] Element 0 is zero >> [ o

[go-nuts] Re: Russian translation of the Tour of Go

2017-05-20 Thread Alexander Guz
Hi! Just wanted to know, if there is any schedule on deploying the Tour of Go site? The link to translation was merged to the repository, but it's still not visible on the tour site. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscri

Re: [go-nuts] "non-bool used as if condition" - why not?

2017-05-20 Thread Jakob Borg
On 20 May 2017, at 17:01, bcandler100 via golang-nuts wrote: > > And I wonder why the language designers decided not to allow this: > > if err { > ... > } > > especially since Go has a well-defined notion of "zero value" which could be > treated as "false" in this context. Implicit type

Re: [go-nuts] A question about reading of TCP sockets.

2017-05-20 Thread Jesper Louis Andersen
Hi, TCP is a stream-oriented protocol. When you send your 1516 bytes, the receiver may read anything from 0 to 1516 bytes when they execute the read. The reason is that the operating system kernels in both ends are free to "chop up" the stream at any point. Furthermore, transmission errors and ret

Re: [go-nuts] can i get goroutine`s id or have some local storage of a goroutine?

2017-05-20 Thread will . faught
Can you wrap them in a struct and call them through a method? -- 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

[go-nuts] "non-bool used as if condition" - why not?

2017-05-20 Thread bcandler100 via golang-nuts
I tried googling and searching the FAQ, but I didn't find the answer to this question. Coming from a C background, I see a lot of Go code like this: if err != nil { ... } And I wonder why the language designers decided not to allow this: if err { ... } especially since Go has a well-d

[go-nuts] A question about reading of TCP sockets.

2017-05-20 Thread fusi . enrico . maria
Hello All first I apologize for my English, I'm not a native speaker. I have a question about how golang reads the sockets in tcp. Imagine I send , using a conn.Write(buffer), a buffer which has the (unpredictable) size from 80 Bytes to 1516. Now, if I do something like this (after creating "l

[go-nuts] Re: GOPATH Problem--SOLVED & Not a Go issue

2017-05-20 Thread coolduderahulbabbar
Thanks for the solution it helped me. was stuck in this for 2 days. On Friday, December 6, 2013 at 10:21:06 PM UTC+5:30, Bill Hogsett wrote: > > Well, I solved my problem and it was not a go problem (*big surprise!!*). > > I was using the command sudo along with go get and apparently my root user

Re: Re: [go-nuts] Freebsd - Raspberry and Go from Source

2017-05-20 Thread Low Eel
> >> Actually Freebsd runs only on one Raspi2, and I confirm putting the GOARM >> to 5 was allowing the bootstrap >> to compile. Nevertheless, when I compiled the 1.8.1 , it stopped because >> of one subsystem 5l hanged and got killed after a while. >> > > This is unexpected -- 5l is written

[go-nuts] Re: text/template: cannot index from map[int32]string

2017-05-20 Thread bupjae
One additional question: may I report this as bug of golang? 2017년 5월 20일 토요일 오후 11시 51분 56초 UTC+9, bup...@gmail.com 님의 말: > > Go Source: > https://play.golang.org/p/dMKNy4pTnb > > Expected: > > [ ok] Element 0 is zero > [ ok] Element 0 is zero > [ ok] Element 0 is zero > > Actual: > > [ ok] Eleme

[go-nuts] text/template: cannot index from map[int32]string

2017-05-20 Thread bupjae
Go Source: https://play.golang.org/p/dMKNy4pTnb Expected: [ ok] Element 0 is zero [ ok] Element 0 is zero [ ok] Element 0 is zero Actual: [ ok] Element 0 is zero [ ok] Element 0 is zero [err] template: :1:15: executing "" at : error calling index: value has type int; should be int32 I think