[go-nuts] Re: I don't know about callbacks in Golang

2018-05-07 Thread Louki Sumirniy
To use callbacks in Go you must follow Functional Programming rules about shared data. In simple terms, you cannot share data. You can pass pointers to shared data structures, and likely will have to but as soon as you start using also goroutines you will end up with race conditions. To solve th

Re: [go-nuts] Re: I don't know about callbacks in Golang

2018-05-07 Thread Linker
Callback let user to handle context Coroutine let runtime to handle context On Mon, May 7, 2018 at 3:03 PM, Louki Sumirniy < louki.sumirniy.stal...@gmail.com> wrote: > To use callbacks in Go you must follow Functional Programming rules about > shared data. In simple terms, you cannot sh

Re: [go-nuts] I don't know about callbacks in Golang

2018-05-07 Thread Jan Mercl
On Sat, May 5, 2018 at 2:52 AM Eduardo Moseis Fuentes wrote: > HI everyone I´m Eduardo from Guatemala and I'm beginer. I'm interesting in all scope golang in fact I was download a little book about it, but I need learn more about callbacks because the book don´t has > enough information on callba

[go-nuts] Re: fallthrough for select

2018-05-07 Thread matthewjuran
The proposal I opened for this was declined recently: https://github.com/golang/go/issues/23196 Matt On Saturday, May 5, 2018 at 11:35:08 PM UTC-5, Simon Chevrier wrote: > > Hi, I know this is kind of old and I'm not sure anyone will answer, but > even after the previous discussion I feel like

Re: [go-nuts] [ANN] GoKi Trees and GoGi GUI

2018-05-07 Thread matthewjuran
> > I’m pretty sure you can just type "go get …” and it finds all the > dependencies automatically, and they are likely to change over time, so I’m > not sure it is conventional to list them? You may want to vendor them (https://golang.org/cmd/go/#hdr-Vendor_Directories) so if they ever go aw

Re: [go-nuts] Re: I don't know about callbacks in Golang

2018-05-07 Thread florent giraud
Hello louki. Can you give us a little example about what you mean. I don't really understand this sentence for me "don't share state to communicate, communicate to share state." Thanks a lot for all your answears 2018-05-07 9:03 GMT+02:00 Louki Sumirniy : > To use callbacks in Go you must follow

Re: [go-nuts] cross-compile mac to linux

2018-05-07 Thread Rohit Jain
*GOOS=linux GOARCH=amd64 go build* Try this? On Mon, May 7, 2018 at 8:56 AM, Steven Roth wrote: > Can anyone point me to a recipe or guidance on how to set up a > cross-compilation environment on a Mac that will allow me to build > CGO-enabled Go code to run on Ubuntu? The program I'm building

Re: [go-nuts] cross-compile mac to linux

2018-05-07 Thread Michael Banzon
It was specifically stated that the code was CGO - this approach won’t work unless there is a C compiler that is crosscompile enabled installed already - I’m guessing the question is how to do that. In my experience the (by far) easiest way to do this is to set up a (Docker) container or a VM w

[go-nuts] Re: I don't know about callbacks in Golang

2018-05-07 Thread matthewjuran
Callbacks in Go can be done with a func argument to a func, or a similar effect can be made with channels by triggering a callback action by waiting on a blocking channel in the application. This Wikipedia article describes the pattern: https://en.wikipedia.org/wiki/Callback_(computer_programmin

Re: [go-nuts] cross-compile mac to linux

2018-05-07 Thread alex . rou . sg
There's a tool for that, and yeah it uses docker. https://github.com/karalabe/xgo On Monday, 7 May 2018 22:32:00 UTC+8, mbanzon wrote: > > It was specifically stated that the code was CGO - this approach won’t > work unless there is a C compiler that is crosscompile enabled installed > already

[go-nuts] Re: I don't know about callbacks in Golang

2018-05-07 Thread matthewjuran
Corrected mistake: func SignalsCallback(arg1 int, arg2 string, callback chan<- struct{}) SignalsCallback will only write to callback, not read. Matt On Monday, May 7, 2018 at 10:08:27 AM UTC-5, matthe...@gmail.com wrote: > > Callbacks in Go can be done with a func argument to a func, or a simil

Re: [go-nuts] [ANN] GoKi Trees and GoGi GUI

2018-05-07 Thread Steven Wiley
You are probably right about go get. I was pulling the repos into my workspace so I could check out the code more easily. That, plus just informing the user as to what is involved, is why you might want to list dependencies. Gradients are coming soon to oksvg. On Monday, May 7, 2018 at 6:33:10

Re: [go-nuts] Re: I don't know about callbacks in Golang

2018-05-07 Thread florent giraud
ok matthew so what you propose is sync method callback right ? 2018-05-07 17:24 GMT+02:00 : > Corrected mistake: > > func SignalsCallback(arg1 int, arg2 string, callback chan<- struct{}) > > SignalsCallback will only write to callback, not read. > > Matt > > On Monday, May 7, 2018 at 10:08:27 AM

[go-nuts] Behavior of DotReader

2018-05-07 Thread julianweise
Hey guys, I am not quite sure whether the following behavior is intended or not. Therefore, I am seeking for your advice. Using DotReader's Read() function from the textproto package requires me to provide an predefined buffer to fill in processed data (as usual for Read() functions). Let's co

Re: [go-nuts] Re: I don't know about callbacks in Golang

2018-05-07 Thread matthewjuran
The first approach with a func argument to a func can be synchronous (which is what I was thinking at the time) or it could be asynchronous by using the go keyword on the callback. Matt On Monday, May 7, 2018 at 11:48:20 AM UTC-5, florent giraud wrote: > > ok matthew so what you propose is sync

[go-nuts] Re: go 1 on Ubuntu 18.04

2018-05-07 Thread Ankit Gupta
Updating Go is simply a matter of removing old Go installation directory and replace it with new one. For your particular use case - Remove the go folder under /usr/lib (the /usr/bin/go just holds the binary). Install the new go version to /usr/local as mentioned on golang installation manua

Re: [go-nuts] Re: go 1 on Ubuntu 18.04

2018-05-07 Thread Shawn Milochik
On Mon, May 7, 2018 at 3:32 PM, Ankit Gupta wrote: > > Updating Go is simply a matter of removing old Go installation directory > and replace it with new one. For your particular use case - > > A better solution (in my opinion) is to decompress the new Go tarball to a new location (preferably in

Re: [go-nuts] Re: go 1 on Ubuntu 18.04

2018-05-07 Thread Ankit Gupta
Different school of thoughts I guess. I would personally prefer my software installs to go under one of either /usr or /opt (certainly when I have root permission). Feels safer and idiomatic that way. On Tuesday, May 8, 2018 at 1:07:16 AM UTC+5:30, Shawn Milochik wrote: > > On Mon, May 7, 2018 a

Re: [go-nuts] Re: go 1 on Ubuntu 18.04

2018-05-07 Thread Dave Cheney
Top tip: you never need to set GOROOT. Please don’t set GOROOT, it’ll just cause confusing errors for you in the future. -- 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 e

Re: [go-nuts] go tool trace: --> filtering/modifying

2018-05-07 Thread Hyang-Ah Hana Kim
Have you tried the new annotation api in the tip? tip.golang.org/pkg/runtime/trace? Please see if annotating in the source code with Region or Task would work for your case. On Wed, May 2, 2018 at 8:59 AM, wrote: > High level goal: > >- I have an application with significant number of gorou

[go-nuts] Re: [go/types] Implements doesn't work for types from different packages when the interface signature has types from the package where the interface lies.

2018-05-07 Thread Denis Cheremisov
This library are not supposed to be used that way. Importer should be used directly: package main import ( "fmt" "go/importer" "go/types" ) var imprt = importer.For("source", nil) func main() { p1, err := imprt.Import("awesome/pkg1") if err != nil { panic(err) } p2,

[go-nuts] httplex missing

2018-05-07 Thread Josh Harshman
Came across this issue today while adding packages into govendor. ➜ platform-ci git:(develop) ✗ go get golang.org/x/net/lex/httplex (ops/platform-vault) package golang.org/x/net/lex/httplex: cannot find package "golang.org

Re: [go-nuts] httplex missing

2018-05-07 Thread Sebastien Binet
It has been moved/merged into httpguts. sent from my droid On Tue, May 8, 2018, 00:33 Josh Harshman wrote: > Came across this issue today while adding packages into govendor. > > ➜ platform-ci git:(develop) ✗ go get golang.org/x/net/lex/httplex >

Re: [go-nuts] httplex missing

2018-05-07 Thread Josh Harshman
Ahh okay thanks :) On Monday, May 7, 2018 at 3:35:54 PM UTC-7, Sebastien Binet wrote: > > It has been moved/merged into httpguts. > > sent from my droid > > On Tue, May 8, 2018, 00:33 Josh Harshman > > wrote: > >> Came across this issue today while adding packages into govendor. >> >> ➜ platfor

[go-nuts] multiple vendored x/net causing trouble (x/net/trace panic)

2018-05-07 Thread Alex Buchanan
This panic has caused me trouble many times over the last year: panic: http: multiple registrations for /debug/requests goroutine 1 [running]: net/http.(*ServeMux).Handle(0x5c47ba0, 0x511cbc5, 0xf, 0x5223160, 0x515f730) /usr/local/go/src/net/http/server.go:2353 +0x239 net/http.(*ServeMux).Handle

Re: [go-nuts] Re: Go could really use a while statement

2018-05-07 Thread Rob Pike
The original suggestion (using while instead of for) may be the first time someone has complained that Go is not verbose enough. -rob -- 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 i

Re: [go-nuts] globals defined by stringer utility

2018-05-07 Thread Rob Pike
I don't see that it matters much either way. It's clean enough as it is. It's generated code, after all, and therefore is allowed to be ugly. Its merit is not in the prettiness of the code it generates but in other aspects, such as efficiency of both machine and programmer. There may be one small

Re: [go-nuts] go tool trace: --> filtering/modifying

2018-05-07 Thread Tarmigan
In addition to the documentation that Hana pointed to, she also just gave a great talk that included a walk through of the new features and how they may be used to view high latency events: https://www.youtube.com/watch?v=FJQjUueBJ2A It's worth watching if you are interested in tracing and latency

Re: [go-nuts] Re: go 1 on Ubuntu 18.04

2018-05-07 Thread Jan Mercl
On Mon, May 7, 2018 at 10:02 PM Dave Cheney wrote: > Top tip: you never need to set GOROOT. Please don’t set GOROOT, it’ll just cause confusing errors for you in the future. The formulation quoted above is not correct because of the word 'never'. Most people do not need to ever set GOROOT, that'