Re: [go-nuts] Re: A proposal for generic in go

2016-07-01 Thread Andrew Mezoni
>> I would also like to point out again that I am not arguing in favor or against the C++ or the Java way. I am simply trying to get you to answer the question which of the two you are proposing. Neither one nor the other. Only the "Go way". And I am did not propose. I am only try bring

[go-nuts] What versions of mobile OS does go.mobile work on?

2016-07-01 Thread tnzk . marge
Hi, I am considering to write a shared library that works on both of Android and iOS using go.mobile. What versions of mobile OS does go.mobile work on? I have read the document below but it does not mention about the versions of target platform: https://github.com/golang/go/wiki/Mobile

Re: [go-nuts] Prevent RTS from creating an OS thread

2016-07-01 Thread Matt Harden
Forking is not safe in Go either. On Fri, Jul 1, 2016 at 11:34 AM Alex Bligh wrote: > > > On 30 Jun 2016, at 14:10, Martynas Pumputis wrote: > > > > I see :-/ > > > > One very fragile workaround I've had in mind is to replace any > > occurrence of

Re: [go-nuts] Re: GUI for Go

2016-07-01 Thread Matt Harden
Don't forget that gopherjs is a thing. On Fri, Jul 1, 2016 at 7:41 AM Lucio wrote: > https://github.com/peterhoward42/godesktopgui >

Re: [go-nuts] Re: Relaxing rules on slice comparison: would it make sense?

2016-07-01 Thread Matt Harden
Conceptually, the value of a string is the sequence of bytes it contains, just like an array of bytes. It doesn't matter that the implementation of strings looks more like a slice internally. On the other hand the value of a slice is a reference to (part of) an underlying array, together with a

Re: [go-nuts] GIMP plugins written in pure Go

2016-07-01 Thread simran
Thanks Mike, really appreciate you doing up a sample so quickly. Sam, will keep you posted on how i progress (although progress will be slow... only got a couple of hours a week to spend on it :) I'm not worried about performance though... i'm not processing video, and images are likely to be

Re: [go-nuts] callee returns nil, caller does not see nil

2016-07-01 Thread Kevin Manley
Thanks, makes sense On Friday, July 1, 2016 at 8:06:45 PM UTC-4, Caleb Spare wrote: > > https://golang.org/doc/faq#nil_error > > Make Validate return error, not MultiError. > > -Caleb > > On Fri, Jul 1, 2016 at 5:04 PM, Kevin Manley > wrote: > > I am new to Go so I'm

Re: [go-nuts] callee returns nil, caller does not see nil

2016-07-01 Thread Caleb Spare
https://golang.org/doc/faq#nil_error Make Validate return error, not MultiError. -Caleb On Fri, Jul 1, 2016 at 5:04 PM, Kevin Manley wrote: > I am new to Go so I'm sure this is just me misunderstanding how things work, > but I was surprised at this result. Please can

Re: [go-nuts] Re: How to emulate "defer" in C++, a funny blog entry

2016-07-01 Thread dollarlux . ubicommerce
https://github.com/guangzhuwu/defer On Thursday, January 17, 2013 at 1:28:30 PM UTC-8, mkb wrote: > > On Thu, Jan 17, 2013 at 4:22 PM, Nick Craig-Wood > wrote: > > Agree 100% with that! Make variable shadowing a compiler error is my > > opinion, but that is probably

[go-nuts] Re: net/smtp Client.hello() returns a single error and drops the ehlo error entirely

2016-07-01 Thread will.sarka via golang-nuts
The handling outside of a HELO,HELO appear to work correctly. Setting the Postfix smtp-sink to return a soft bounce on DATA, for instance, presents to issues whatsoever. Just HELO,EHLO. Here's the full command line for the Postfix sink: sudo /usr/sbin/smtp-sink -Q EHLO,HELO -u root -v

Re: [go-nuts] Re: x/text/runes: How can i replace LF by CRLF ?

2016-07-01 Thread Tong Sun
Actually that's how I'm using it as well. I use it to deal with huge xml files and transform only those pieces that I'm interested in. Anyway, I'm not expecting that one can fit all, but instead, just sharing the idea how transforming can be chained together in one particular way. Happy hacking.

Re: [go-nuts] net/smtp Client.hello() returns a single error and drops the ehlo error entirely

2016-07-01 Thread Ian Lance Taylor
On Fri, Jul 1, 2016 at 1:17 PM, 'Matthew Altman' via golang-nuts wrote: > https://github.com/golang/go/blob/master/src/net/smtp/smtp.go#L76-L79 > > This method can make two distinct SMTP calls. First an EHLO and then a HELO. > If the EHLO fails it attempts HELO.

Re: [go-nuts] Re: x/text/runes: How can i replace LF by CRLF ?

2016-07-01 Thread mhhcbon
Thing is, now i read at it twice, it s not writable by essence. It takes an input as a whole and transform it using a pretty nice api. To take an example about why it s not suitable for me, two days ago i was parsing git logs, which is a text stream. Ideally, i do not want to load all that text

Re: [go-nuts] Re: A proposal for generic in go

2016-07-01 Thread Andrew Mezoni
>> That there is an indirection in the struct doesn't mean that a function doesn't need to know the size of the memory it is allocating for a bucket. Your judgement are now incorrect. Obtaining the size of the of the type is not so hard at runtime. It always known from `rtype` This is how map

Re: [go-nuts] Re: x/text/runes: How can i replace LF by CRLF ?

2016-07-01 Thread Tong Sun
On Fri, Jul 1, 2016 at 4:36 PM, Tong Sun wrote: > > On Fri, Jul 1, 2016 at 4:13 PM, mhhcbon wrote: > >> I honestly admit i have no real understanding of what i m doing ... >> > > >> I can only figure out it works on the other end :o >> >> But its way more readable, to me, src -> transform ->

Re: [go-nuts] Re: x/text/runes: How can i replace LF by CRLF ?

2016-07-01 Thread Tong Sun
I don't know whether you are replying to me from your following context. But assuming so, The reason it's string only is that I'm dealing with string only at the moment, and you can see from the source that the code is not mine, and I don't think I'm qualified enough to extend the functionality

[go-nuts] Re: x/text/runes: How can i replace LF by CRLF ?

2016-07-01 Thread mhhcbon
Pretty cool. Why string only ? Le vendredi 24 juin 2016 22:54:35 UTC+2, mhhcbon a écrit : > > Hi, > > I have a small func like this > > > func WriteAsWindows1252 (src string, dst string) error { > bSrc, err := ioutil.ReadFile(src) > if err != nil { > return err > } > > bDst :=

Re: [go-nuts] Re: x/text/runes: How can i replace LF by CRLF ?

2016-07-01 Thread Tong Sun
On Fri, Jul 1, 2016 at 4:13 PM, mhhcbon wrote: > I honestly admit i have no real understanding of what i m doing ... > > I can only figure out it works on the other end :o > > But its way more readable, to me, src -> transform -> transform -> sink > Then maybe check this one out?

Re: [go-nuts] Re: A proposal for generic in go

2016-07-01 Thread 'Axel Wagner' via golang-nuts
On Fri, Jul 1, 2016 at 10:00 PM, Andrew Mezoni wrote: > >> How does the generic function know the size of the return value? > > All your judgement are not correct only because you ask not a correct > questions. > I am not asking the questions you want me to ask, but

Re: [go-nuts] Re: A proposal for generic in go

2016-07-01 Thread Andrew Mezoni
Can I ask the question out of turn? Ok. I ask. What wrong in Java way? What wrong in C# way? Of course, they have a boxing/unboxing concepts. Does this means that boxing/unboxing is very, very, very slow operations and should not be used even in Java or in C#? But they used. They used at least in

Re: [go-nuts] redirect already running processes stdout

2016-07-01 Thread ethanlewis787
Thanks for the answers ! I will check reptyr out. I have looked at trying to rewrite https://github.com/jerome-pouiller/reredirect which seems to be similar to what I am looking for. I want this because I would like to write a application to catch stdout of another process for logging purposes.

[go-nuts] net/smtp Client.hello() returns a single error and drops the ehlo error entirely

2016-07-01 Thread 'Matthew Altman' via golang-nuts
https://github.com/golang/go/blob/master/src/net/smtp/smtp.go#L76-L79 This method can make two distinct SMTP calls. First an EHLO and then a HELO. If the EHLO fails it attempts HELO. However, if the connection was closed remotely after EHLO the HELO will of course also fail but the error message

Re: [go-nuts] Re: A proposal for generic in go

2016-07-01 Thread 'Axel Wagner' via golang-nuts
On Fri, Jul 1, 2016 at 9:51 PM, wrote: > > How does the compiler know sizeof(T)? >> > > > interesting question. About obtaining sizeof(T). The sizeof(T) is known > from the call site calling the generic function, in particular from the > type of variable that's passed to

Re: [go-nuts] GIMP plugins written in pure Go

2016-07-01 Thread Sam Whited
On Fri, Jul 1, 2016 at 2:29 PM, Ian Lance Taylor wrote: > Current release of Go have a concurrent collector that does almost all > of its work in parallel with your application. If your application is > allocating a lot of memory quickly, the collector works harder. I > don't

Re: [go-nuts] Re: A proposal for generic in go

2016-07-01 Thread Andrew Mezoni
>> How does the generic function know the size of the return value? All your judgement are not correct only because you ask not a correct questions. They return pointers to appropriate values. Or you really think that the `map` also returns a value instead of pointer? How it (map) can know the

Re: [go-nuts] Re: A proposal for generic in go

2016-07-01 Thread Ian Lance Taylor
On Fri, Jul 1, 2016 at 12:51 PM, wrote: > > Perhaps modify Golang's 2.0 calling convention, that EVERY function must get > upon compilation one extra invisible-to programmer argument that is pointer > that > when said function is generic, points to sizeof(T) storage place .

Re: [go-nuts] Re: A proposal for generic in go

2016-07-01 Thread charraster
> How does the compiler know sizeof(T)? > interesting question. About obtaining sizeof(T). The sizeof(T) is known from the call site calling the generic function, in particular from the type of variable that's passed to the generic function. What If generic function calls another generic

Re: [go-nuts] Re: A proposal for generic in go

2016-07-01 Thread 'Axel Wagner' via golang-nuts
Perhaps a better question is: Given a generic function func Get(l List, i int) E { … } var a List{ 1,2,3} var b List{"1", "2", "3"} var c List{1.0, 2.0, 3.0} fmt.Println(Get(a, 0), Get(b, 1), Get(c, 2)) // Should print "1 2 3.0" implement the code, a compiler would generate for this, in C

Re: [go-nuts] Prevent RTS from creating an OS thread

2016-07-01 Thread Alex Bligh
> On 30 Jun 2016, at 14:10, Martynas Pumputis wrote: > > I see :-/ > > One very fragile workaround I've had in mind is to replace any > occurrence of syscall.Syscall by syscall.Rawsyscall within call graph > of doSomeStuff(). However, the Go scheduler is not truly

Re: [go-nuts] redirect already running processes stdout

2016-07-01 Thread Konstantin Khomoutov
On Fri, 1 Jul 2016 10:28:59 -0700 (PDT) ethanlewis...@gmail.com wrote: > I am starting to look into intercepting a running processes output. I > know how to do this manually by look at /proc/$PID/fd/1 or by using > gdb etc. I do not want to use os.exec and then join the child > processes output

[go-nuts] Re: Questions about struct conversion

2016-07-01 Thread Constantin Konstantinidis
Indeed, zero declaration also works using rsa. prefix. package main import ( "crypto/rsa" "fmt" // "math/big" ) func main() { pub := {} mypub := (*rsa.PublicKey)(pub) fmt.Printf("Hello, playground %v", mypub) } On Friday, July 1, 2016 at 4:30:54 PM UTC+2, mura wrote: > > Hi, > > Thanks for

[go-nuts] Re: redirect already running processes stdout

2016-07-01 Thread C Banning
Check out: https://golang.org/pkg/os/exec/#example_Cmd_StdoutPipe On Friday, July 1, 2016 at 11:35:28 AM UTC-6, ethanl...@gmail.com wrote: > > I am starting to look into intercepting

[go-nuts] redirect already running processes stdout

2016-07-01 Thread ethanlewis787
I am starting to look into intercepting a running processes output. I know how to do this manually by look at /proc/$PID/fd/1 or by using gdb etc. I do not want to use os.exec and then join the child processes output with the parent. I want to start Process A and capture the output of A in

Re: [go-nuts] Re: A proposal for generic in go

2016-07-01 Thread 'Axel Wagner' via golang-nuts
On Fri, Jul 1, 2016 at 12:40 PM, wrote: > the parametrized struct got me interested, how to best handle the > embedding the arbitrary type. > > Especially passing said struct to a generic function. > > > > type S struct { > > I1 int > > C1 char > > *T1 T* > > I2 int > >

[go-nuts] [ANN] new mailing list for Google APIs with Go

2016-07-01 Thread 'Jonathan Amsterdam' via golang-nuts
If you use Go to access Google APIs (for example, by using the Google Cloud API clients at import paths starting with "google.golang.org/cloud"), we recommend you join the new group google-api-go-announce . We at Google will use that

[go-nuts] Re: A proposal for generic in go

2016-07-01 Thread Andrew Mezoni
>> I believe you've made a mistake here, elem needs to be *T , not T This was just an abstract example. I just wanted to say that if someone want to try implement a transpiller of the "Go.next" to the "Go" then the better way to represent the data of the different types (which are specified by

[go-nuts] Re: A proposal for generic in go

2016-07-01 Thread charraster
On Friday, July 1, 2016 at 1:53:46 PM UTC+2, Andrew Mezoni wrote: > > >> Now imagine that T=int8 > > Generic struct always has the same size only because it uses pointers. > > type S struct { > elem ***T > arr []T > } > > I believe you've made a mistake here, elem needs to be *T , not T --

[go-nuts] Re: GUI for Go

2016-07-01 Thread Lucio
https://github.com/peterhoward42/godesktopgui A missing "/" in the middle. On Friday, 1 July 2016 16:31:40 UTC+2, Peter Howard wrote: > > My github project shows a simple

Re: [go-nuts] GIMP plugins written in pure Go

2016-07-01 Thread Sam Whited
On Thu, Jun 30, 2016 at 10:37 PM, simran wrote: > I'm wanting to write some image modification stuff and want to plug it into > GIMP, and being able to look at samples would really help. This doesn't answer your question, but I'd be curious to see what sort of

[go-nuts] Re: GUI for Go

2016-07-01 Thread Fino
may be we need to wait for webassembly's golang translate. but some platform native features still cannot be done in a brower. BR fino -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails

[go-nuts] Re: GUI for Go

2016-07-01 Thread Peter Howard
My github project shows a simple way to make a go gui based on an html5 model by using css and the Bootstrap library and go's template package. It also shows how to compile the whole thing including the dedicated local server and the html and css into a single executable.

[go-nuts] Re: Questions about struct conversion

2016-07-01 Thread mura
Hi, Thanks for your reply. FWIW, this code works: https://play.golang.org/p/hcakVsG6qd So the naming of structs or their field probably doesn't matter. On Friday, July 1, 2016 at 3:49:11 PM UTC+8, Constantin Konstantinidis wrote: > > You are redeclaring the package type. > When converting

Re: [go-nuts] Re: Relaxing rules on slice comparison: would it make sense?

2016-07-01 Thread Chad
On Friday, July 1, 2016 at 4:01:54 PM UTC+2, Chad wrote: > > > > On Friday, July 1, 2016 at 3:44:10 PM UTC+2, Martin Geisler wrote: >> >> On Fri, Jul 1, 2016 at 12:52 PM, Chad wrote: >> > However, that it's a valid point you raise (re strings) >> > But that's exactly the

Re: [go-nuts] Re: Relaxing rules on slice comparison: would it make sense?

2016-07-01 Thread Chad
On Friday, July 1, 2016 at 3:44:10 PM UTC+2, Martin Geisler wrote: > > On Fri, Jul 1, 2016 at 12:52 PM, Chad > wrote: > > However, that it's a valid point you raise (re strings) > > But that's exactly the reason for which, someone would probably ask > whether > > a

Re: [go-nuts] Re: Relaxing rules on slice comparison: would it make sense?

2016-07-01 Thread Chad
Yes. You're absolutely right.That's due to the current implementation of strings. Maybe they should be implemented as a struct with an unexported array of byte That would just work. Having the string kind with the same structure as a slice is the problem here. strings should probably be pure

Re: [go-nuts] Re: Relaxing rules on slice comparison: would it make sense?

2016-07-01 Thread Martin Geisler
On Fri, Jul 1, 2016 at 12:52 PM, Chad wrote: > However, that it's a valid point you raise (re strings) > But that's exactly the reason for which, someone would probably ask whether > a string is a reference type or a value type. > > This could probably made clearer in the

Re: [go-nuts] Append to slice... what happens?

2016-07-01 Thread Ian Lance Taylor
On Fri, Jul 1, 2016 at 2:42 AM, Martin Geisler wrote: > > On Mon, Jun 27, 2016 at 8:18 PM, Ian Lance Taylor wrote: >> On Sun, Jun 26, 2016 at 10:55 PM, Dan Kortschak >> wrote: >>> On Mon, 2016-06-27 at 07:49 +0200, Martin

[go-nuts] Use httputil.NewSingleHostReverseProxy and forward to a second proxy

2016-07-01 Thread ultrarun81
Hey Guys, i have a problem. I want to use the NewSingleHostReverseProxy Function in Go an forward a request to a second proxy. Here my code ... proxyUrl, _ := url.Parse("http://localhost:8118;) remote = parseURL("http://abcd.tld;) http.DefaultTransport = {Proxy: http.ProxyURL(proxyUrl)}

[go-nuts] Re: A proposal for generic in go

2016-07-01 Thread Andrew Mezoni
>> Now imagine that T=int8 Generic struct always has the same size only because it uses pointers. type S struct { elem T arr []T } Is the same as the following struct. type S struct { elem unsafe.Pointer arr []unsafe.Pointer } This is because it is designed to be universal. You may

Re: [go-nuts] Re: Relaxing rules on slice comparison: would it make sense?

2016-07-01 Thread Chad
On Friday, July 1, 2016 at 12:11:43 PM UTC+2, Martin Geisler wrote: > > On Fri, Jul 1, 2016 at 3:15 AM, Chad > wrote: > > No, it's actually fine. You are comparing values. > > > > A slice being a struct under the hood, for slices you would compare the > > structs (slice

[go-nuts] Re: A proposal for generic in go

2016-07-01 Thread charraster
On Wednesday, June 15, 2016 at 3:04:05 AM UTC+2, xingtao zhao wrote: > > Here is my proposal for generic in go: > https://docs.google.com/document/d/1nO7D15c2B3eq2kF62C0yUs_UgpkyPL2zHhMAmlq1l98/edit?usp=sharing > > Many parts has not been finished, and just initial thoughts. In the > proposal,

[go-nuts] Re: GUI for Go

2016-07-01 Thread Mandolyte
I noticed that the QML project has been forked, so it may have some new energy -- 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

Re: [go-nuts] Append to slice... what happens?

2016-07-01 Thread Martin Geisler
Hi Ian, On Mon, Jun 27, 2016 at 8:18 PM, Ian Lance Taylor wrote: > On Sun, Jun 26, 2016 at 10:55 PM, Dan Kortschak > wrote: >> On Mon, 2016-06-27 at 07:49 +0200, Martin Geisler wrote: >>> BTW, I was about to say that you could simplify the line

Re: [go-nuts] Re: Singleton pattern for a client handle

2016-07-01 Thread Nathan Fisher
Methods; specifically pointer receivers. Using a value will create copies of the struct on every method call whereas pointers will use the same struct. Another benefit is to optionally do an atomic swap or use a mutex guard if you wanted to change the instance at runtime (eg config reloads).

[go-nuts] Re: GUI for Go

2016-07-01 Thread Rio M
I hope for project based on Javascript+Golang server (like http://electron.atom.io/). -- 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

[go-nuts] Re: Questions about struct conversion

2016-07-01 Thread Constantin Konstantinidis
You are redeclaring the package type. When converting type, the conversion semantics is simply mytype(a) and conversion occurs if the rule that you mention is respected. I suppose that you need to have your own struct to store date, with a different name everything works. The package type is