Re: [go-nuts] Is channel push atomic?

2018-03-08 Thread Jan Mercl
On Fri, Mar 9, 2018 at 8:19 AM Andrey Tcherepanov < xnow4fippy...@sneakemail.com> wrote: > So if this is a "just" a mutex, this whole thing will not be atomic - it would introduce intermediate (albeit invisible) between "<-" parts. I was hoping for the "edge collapse" here. Not sure IIUC, but I

Re: [go-nuts] Is channel push atomic?

2018-03-08 Thread Andrey Tcherepanov
Thanks Jan, So if this is a "just" a mutex, this whole thing will not be atomic - it would introduce intermediate (albeit invisible) between "<-" parts. I was hoping for the "edge collapse" here. Andrey On Friday, March 9, 2018 at 12:08:13 AM UTC-7, Jan Mercl wrote: > > On Fri, Mar 9, 2018

Re: [go-nuts] Is channel push atomic?

2018-03-08 Thread Jan Mercl
On Fri, Mar 9, 2018 at 7:47 AM Andrey Tcherepanov < xnow4fippy...@sneakemail.com> wrote: > ch <- <-ch // Is this an atomic operation? Channel send and receive operations are safe wrt to concurrency. That may be seen atomic in a certain sense: only one goroutine at a time can ever perform such

[go-nuts] Debugging unit tests in go

2018-03-08 Thread Sotirios Mantziaris
Visual studio code with go extension which uses delve. Just works like a charm. -- 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] Is channel push atomic?

2018-03-08 Thread Henrik Johansson
What do you mean atomic? The individual operations create happens before edges afaik and since your channel is local there is nothing to worry about. If you publish that channel then no I would say someone else can puh or pull in between the two operations. fre 9 mars 2018 kl 07:47 skrev Andrey

[go-nuts] Is channel push atomic?

2018-03-08 Thread Andrey Tcherepanov
Hello fellow nuts, Is pull-push to a (same) channel atomic? func f() { ch := make(chan interface{}, 100) // ... ch <- <-ch // Is this an atomic operation? } Thank you very much! -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

[go-nuts] Re: how to force tests to run on main C thread?

2018-03-08 Thread Jason E. Aten
Appears that TestMain() was added for this situation: https://github.com/golang/go/issues/8202 http://cs-guy.com/blog/2015/01/test-main/ -- 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: how to force tests to run on main C thread?

2018-03-08 Thread Jason E. Aten
Ah, I found this question was asked by Gustavo Niemeyer back in 2014... Quoting from the last post of https://groups.google.com/forum/#!topic/golang-dev/YPjaFoesQzU > rsc > You can't move test execution onto the main goroutine. t.FailNow uses runtime.Goexit. I wonder if there's been any

[go-nuts] how to force tests to run on main C thread?

2018-03-08 Thread Jason E. Aten
I see how to make the main program run on the main C thread, using runtime.LockOSThread() https://groups.google.com/d/msg/golang-nuts/IiWZ2hUuLDA/SNKYYZBelsYJ But I wonder how to do the same for blah_test.go test code... I need to start my tests running on the main C thread. Thanks! J --

[go-nuts] Re: golang tcp transport just like nc

2018-03-08 Thread suconghou
It works like a charm, thank you very much ! 在 2018年3月8日星期四 UTC+8上午11:17:03,苏聪厚写道: > > > > linux nc command port to golang > > > in nc , we can do this > > echo 'my id is 1' > /tmp/1 > echo 'my id is 3' > /tmp/3 > rm -rf /tmp/2 /tmp/4 > > > > server > > nc -l 19090 < /tmp/1 > /tmp/2 > > ( if

Re: [go-nuts] Re: [ANN] Get Programming with Go

2018-03-08 Thread Nathan Youngman
Yup. The "about this book" section in the front matter does suggest that seasoned C/C++ programmers look elsewhere, though perhaps it could be written more directly, or maybe in more places? Here's a quote from the front matter: "If you are a polyglot programmer who understands the merits of

[go-nuts] Re: [Advice needed] How to vendor common dependencies for plugins

2018-03-08 Thread Michael Andersen
I am interested in this problem too, especially dealing with golang.org/x/net/trace which is used by grpc which is used by multiple packages I import. On Wednesday, March 7, 2018 at 10:03:37 PM UTC-8, Jay Guo wrote: > > Golang gurus, > > I'm currently trying to modularize my project with the

[go-nuts] Re: Debugging unit tests in go

2018-03-08 Thread ralphdoncaster
On Thursday, 8 March 2018 12:32:42 UTC-4, Parthasarathi Kundu wrote: > > Hi, > How can I debug the unit tests in go ? Normal executible I debug with gdb > or delve. > I am running from command prompt go test -v ./test/... -run Test_Connect. > > Any thing better with ide ? > > Thanks > > I use

[go-nuts] Re: [ANN] Get Programming with Go

2018-03-08 Thread ralphdoncaster
On Wednesday, 7 March 2018 10:46:58 UTC-4, Nathan Youngman wrote: > > Learn about error handling and concurrent state in the latest release of > Get Programming with Go, available from Manning Books. > > The first draft is complete. If you have any feedback, now’s the time to > get it in, as we

[go-nuts] Re: telling apart errors returned by database/sql

2018-03-08 Thread Zach
The `pq.PGError` class appears to be deprecated and it's now suggested to use `pq.Error`. Here's a more concrete example of an insert failing due to a constraint violation (on conflict clause...) if err, ok := err.(*pq.Error); ok &&

Re: [go-nuts] glr support in goyacc?

2018-03-08 Thread Jan Mercl
On Thu, Mar 8, 2018 at 7:44 PM David Wahlstedt < david.wahlstedt@gmail.com> wrote: > So, if golang has been bootstrapped, compiled with itself, how did they write the parser? > By hand, or by using an LR parser and tweaking the grammar? Go authors initially used a modified grammar (distilled

[go-nuts] glr support in goyacc?

2018-03-08 Thread David Wahlstedt
Hi, I wonder if there are any plans to add the "glr" option to goyacc (it doesn't look as if this is the case) ? According to this thread, https://stackoverflow.com/questions/25976394/how-to-resolve-ambiguity-in-the-definition-of-an-lr1-grammar golang is "not LALR(1), nor LR(k) for any k". So,

Re: [go-nuts] Are the semicolons rules some weird?

2018-03-08 Thread digg
On Thursday, March 8, 2018 at 12:36:19 PM UTC-5, Ian Lance Taylor wrote: > > On Thu, Mar 8, 2018 at 9:13 AM, > wrote: > > > > On Thursday, March 8, 2018 at 11:49:18 AM UTC-5, Ian Lance Taylor wrote: > >> > >> On Thu, Mar 8, 2018 at 8:43 AM,

Re: [go-nuts] Are the semicolons rules some weird?

2018-03-08 Thread Ian Lance Taylor
On Thu, Mar 8, 2018 at 9:14 AM, wrote: > btw, are there any cases a semicolon may be omitted before a closing ")"? var ( a = 1 ) Ian > On Thursday, March 8, 2018 at 11:49:18 AM UTC-5, Ian Lance Taylor wrote: >> >> On Thu, Mar 8, 2018 at 8:43 AM,

Re: [go-nuts] Are the semicolons rules some weird?

2018-03-08 Thread Ian Lance Taylor
On Thu, Mar 8, 2018 at 9:13 AM, wrote: > > On Thursday, March 8, 2018 at 11:49:18 AM UTC-5, Ian Lance Taylor wrote: >> >> On Thu, Mar 8, 2018 at 8:43 AM, wrote: >> > >> > There are two semicolon rules in Go spec: >> >

Re: [go-nuts] Are the semicolons rules some weird?

2018-03-08 Thread digg
btw, are there any cases a semicolon may be omitted before a closing ")"? On Thursday, March 8, 2018 at 11:49:18 AM UTC-5, Ian Lance Taylor wrote: > > On Thu, Mar 8, 2018 at 8:43 AM, > wrote: > > > > There are two semicolon rules in Go spec: > >

Re: [go-nuts] Are the semicolons rules some weird?

2018-03-08 Thread digg
On Thursday, March 8, 2018 at 11:49:18 AM UTC-5, Ian Lance Taylor wrote: > > On Thu, Mar 8, 2018 at 8:43 AM, > wrote: > > > > There are two semicolon rules in Go spec: > > https://golang.org/ref/spec#Semicolons > > The first one states how a semicolon will be

[go-nuts] Is there anyone using gomobile in production ?

2018-03-08 Thread irmakserdar
Hi, Gomobile is in maintenance mode, has lots of open issues and it's usage seems decreasing on surveys. Is there anyone using it in production ? What do you think about the future of gomobile ? My Best, Serdar -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] Are the semicolons rules some weird?

2018-03-08 Thread Ian Lance Taylor
On Thu, Mar 8, 2018 at 8:43 AM, wrote: > > There are two semicolon rules in Go spec: > https://golang.org/ref/spec#Semicolons > The first one states how a semicolon will be automatically inserted, > however, the second one states how a semicolon can be omitted. > Isn't more

[go-nuts] Re: Building Go

2018-03-08 Thread matthewjuran
While an old Go program will compile with new versions, new Go programs may not compile with old versions due to added standard library APIs. Matt On Thursday, March 8, 2018 at 10:32:35 AM UTC-6, Krzysztof Kwiatkowski wrote: > > Hi, > > > I've quite newbe question, but I would like to

Re: [go-nuts] Debugging unit tests in go

2018-03-08 Thread Ian Lance Taylor
On Thu, Mar 8, 2018 at 4:41 AM, wrote: > > How can I debug the unit tests in go ? Normal executible I debug with gdb or > delve. > I am running from command prompt go test -v ./test/... -run Test_Connect. Run `go -test c PKG` to get an executable for the package

Re: [go-nuts] Building Go

2018-03-08 Thread Ian Lance Taylor
On Thu, Mar 8, 2018 at 3:53 AM, Krzysztof Kwiatkowski wrote: > > > I've quite newbe question, but I would like to double-check my understanding > before doing something stupid. > > > I'm building a toolchain for which I need to compile go from sources (I > modify

[go-nuts] Are the semicolons rules some weird?

2018-03-08 Thread digg
There are two semicolon rules in Go spec: https://golang.org/ref/spec#Semicolons The first one states how a semicolon will be automatically inserted, however, the second one states how a semicolon can be omitted. Isn't more consistent to modify the second one to the following description? To

[go-nuts] Building Go

2018-03-08 Thread Krzysztof Kwiatkowski
Hi, I've quite newbe question, but I would like to double-check my understanding before doing something stupid. I'm building a toolchain for which I need to compile go from sources (I modify the sources). In order to compile Go I need some version of Go to be installed on my system.

[go-nuts] Is gomobile have future and is there anyone using it in production ?

2018-03-08 Thread sirmak
Hi, Gomobile is in maintenance mode, has lots of open issues and it's usage seems decreasing on surveys. Is there any development plan/future for gomobile? And is there anyone using it on production ? My Best, Serdar -- Follow us:

[go-nuts] Debugging unit tests in go

2018-03-08 Thread parthasarathi . kundu
Hi, How can I debug the unit tests in go ? Normal executible I debug with gdb or delve. I am running from command prompt go test -v ./test/... -run Test_Connect. Any thing better with ide ? Thanks -- You received this message because you are subscribed to the Google Groups "golang-nuts"

Re: [go-nuts] golang tcp transport just like nc

2018-03-08 Thread Jamil Djadala
On Wed, 7 Mar 2018 19:16:33 -0800 (PST) sucong...@gmail.com wrote: > > > linux nc command port to golang > > > in nc , we can do this > > echo 'my id is 1' > /tmp/1 > echo 'my id is 3' > /tmp/3 > rm -rf /tmp/2 /tmp/4 > > > > server > > nc -l 19090 < /tmp/1 > /tmp/2 > > ( if you are in

Re: [go-nuts] Re: [ANN] Get Programming with Go

2018-03-08 Thread matthewjuran
> > I'm not sure if "in English" really describes Go. Languages like Ruby > purport to offer English-like syntax (see "Beautiful Code: Leading > Programmers Explain How They Think") through metaprogramming tricks. On the > other hand, Go strives for simplicity and, in my opinion, clarity --

Re: [go-nuts] fast small prime checker

2018-03-08 Thread ralphdoncaster
It does look interesting, though I think I have a solution using git submodules. On Monday, 5 March 2018 02:26:53 UTC-4, Michael Jones wrote: > > ...if that's how you feel, you'll enjoy the current discussion of vgo. > > On Sun, Mar 4, 2018 at 10:24 PM, > wrote: > >> >>

Re: [go-nuts] Re: Channels vs Actors

2018-03-08 Thread Jesper Louis Andersen
On Thu, Mar 8, 2018 at 10:37 AM Haddock wrote: > The fundamental problem with asynchronous programming is that asynchronous > messages that depend on each other from the application logic "may not > meet" and miss each other. Let's say, several threads start to search > through a

Re: [go-nuts] golang tcp transport just like nc

2018-03-08 Thread Peter Waller
Once you've read all of os.Stdin, and the io.Copy finishes, you need to call conn.CloseWrite(), to signal to the other side that it won't receive any more bytes. Otherwise each side is blocked in io.Copy(os.Stdout, conn) waiting for more bytes to arrive from the other side. -- You received this

Re: [go-nuts] How to integrate ckeditor and ckfinder for golang website ?

2018-03-08 Thread Lutz Horn
I'm designing a golang website, You need to integrate ckeditor and ckfinder for your website. Thank you very much. Do you mean the tools provided by https://ckeditor.com/? You integrate them into your web site by following the documentation of these products: *

[go-nuts] How to integrate ckeditor and ckfinder for golang website ?

2018-03-08 Thread thanhsang . dang
I'm designing a golang website, You need to integrate ckeditor and ckfinder for your website. Thank you very much. -- 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

Re: [go-nuts] Re: Channels vs Actors

2018-03-08 Thread Haddock
> > > >> Actors have an advantage when used for distributed systems. If two actors >> on different boxes communicate with each other it is not a problem to make >> communication work without data loss through the principle of supervision. >> Supervision is the idea Joe Armstrong (the creator

Re: [go-nuts] Re: Channels vs Actors

2018-03-08 Thread Haddock
Am Donnerstag, 8. März 2018 10:17:02 UTC+1 schrieb Anto Aravinth: > > Thanks everyone and thanks Haddock for such a detailed response. Few > questions: > > On Thu, Mar 8, 2018 at 2:32 PM, Haddock > wrote: > >> The main difference is that goroutines do blocking takes from

Re: [go-nuts] Re: Channels vs Actors

2018-03-08 Thread Anto Aravinth
Thanks everyone and thanks Haddock for such a detailed response. Few questions: On Thu, Mar 8, 2018 at 2:32 PM, Haddock wrote: > The main difference is that goroutines do blocking takes from channels > whereas actors receive asynchronous events. This means that actors have to >

[go-nuts] Re: Channels vs Actors

2018-03-08 Thread Haddock
The main difference is that goroutines do blocking takes from channels whereas actors receive asynchronous events. This means that actors have to deal with all the situations in asynchronous programming that are inherently difficult to deal with (inherently means there is no general way to