[go-nuts] Re: Making concurrent programs to run parallely in Go

2022-06-16 Thread 'Anderson Queiroz' via golang-nuts
You will need a barrier, the wait Group in your case, to guarantee the main goroutine will only continue after all the others have finished their work. Besides if any of your goroutines blocks due to IO the Go scheduler will look for another goroutine to run while the blocked one waits. Another

Re: [go-nuts] Re: Windows Binaries and stdout

2022-05-02 Thread 'Anderson Queiroz' via golang-nuts
You could log to a file. If you're willing to take in a -log flag, you could take a path as well and log to this file. That way you don't need 2 binaries, however you'd need to tail the file, which seems to me better than 2 binaries. Best, Anderson On Friday, April 29, 2022 at 2:47:06 PM

[go-nuts] Re: Spam email

2022-03-16 Thread Anderson Queiroz
It could also be your SMTP server, are you able to send the same email, and not having it marked as span, through another client? On Wednesday, 16 March 2022 at 00:12:43 UTC+1 Rick wrote: > An email is designated as Spam by a heuristic. The heuristic takes into > account the name of the server

Re: [go-nuts] "src" folder changed to "pkg"

2021-09-15 Thread Anderson Queiroz
If I'm not mistaken `$GOPATH/pkg/mod` where go modules keeps the downloaded modules, looking up `$GOPATH/pkg/mod` is to look for a module downloaded in module aware mode and `$GOPATH/src` is for gopath mode. Are you working with go modules or on the legacy go path mode? On Tuesday, 14

[go-nuts] Re: error help

2021-07-12 Thread Anderson Queiroz
Could you be more specific about what you're doing, which library you're using? For the error message looks like whatever you're trying to connect to is refusing the connection. Only with this error and stacktrace is really difficult to understand what is happening. On Monday, 12 July 2021 at

[go-nuts] Re: Finding a small memory leak

2021-07-06 Thread Anderson Queiroz
Hi, Christian, Whereas pprof seems to be the way to go, have you tried to plot a chart of memory usage over time? Depending where you're running it, it might me easy to get this info. Once I had to chase a small "CPU leak ", slowly over a long time (days-weeks) the program CPU consumption

[go-nuts] Re: Golang assertion issues

2021-02-01 Thread Anderson Queiroz
Hi, Well, you are using a 3th party lib for assertion, and you haven't told which one, so it's hard to reason about it. one idea is to check the library's docs to ensure it's ding the comparison as you expect. 2 things would help to get some insight on your problem are: - format the code,

[go-nuts] Re: How to apply concurrency in golang to pass multiple app metrics to datadog

2020-11-25 Thread Anderson Queiroz
I didn't have much time to look at it, but try to rebind the `app` variable: for _, app := range appName { // Calculate the Epoch Time app := app // rebidding app a short, and not quite formal, explanation is that the loop variable is reused during the iterations, and when a loop variable is

Re: [go-nuts] How to detect HTTP client stop polling at the server side

2020-11-17 Thread Anderson Queiroz
Just one thing to keep in mind. Likely you have more than one serve instance running to process the requests. Thus it might happen the client will poll a different server on every request. Just imagine you have servers A, B, C behind a load balance and the domain example.com. As the client is

[go-nuts] Re: go get not downloading a module under a repository from BitBucket

2020-11-10 Thread Anderson Queiroz
Not trying to doubt you, but are you sure it's a silent failure? Where are you invoking `go get`? Is it running on module aware mode, being called within a go module? Try to run go get with "-v" to see if you get more information about what is happening. On Monday, 9 November 2020 at 03:03:09

[go-nuts] Re: [generics] Bugs + something else

2020-09-02 Thread Anderson Queiroz
you cannot mix parenthesis and square brackets for type parameters in the same file, you did it on your first example. On Tuesday, 1 September 2020 at 18:12:35 UTC+2 jake...@gmail.com wrote: > > On Monday, August 31, 2020 at 8:49:00 PM UTC-4, p...@pjebs.com.au wrote: >> >> 1. >> For this Go 2

Re: [go-nuts] Re: [ generics] Moving forward with the generics design draft

2020-08-24 Thread Anderson Queiroz
I liked the 'any' idea. It always felt to me a bit odd/not so clear interface{} means anything. Still, interfaces with type parameters for non generic code seems a mix of behaviour and implementation description. In all, looking forward to see these changes implemented to try them out :) On

[go-nuts] Re: mark pointer methods on interface type definitiion, not function?

2020-06-24 Thread Anderson Queiroz
I see your point, but the interfaces do not deal with the implementation details, they only specify a behaviour. In your proposal the interface definition would constrain how it can be implemented. Whoever is implementing the interface is responsible for the constraints related to the

[go-nuts] Re: The next layer of abstraction for Go development?

2020-06-15 Thread Anderson Queiroz
My opinion is that one of the reasons other languages need a framework is that the standard library is too hard to work with. So the frameworks take some of these burden and also take a lot of decisions for the you. In Go the standard library is powerful and simple enough to us to build the

[go-nuts] Re: I'm writing my website in golang but there is issue called 404 page not found

2020-03-09 Thread anderson . queiroz
please post the code as text. Either in a github/whatever repo or here, but please, as text and a runnable code. I don't see you registering any handler for */register.html*, you have one for */register* only. Also if the method is not POST, you should return *405 Method Not Allowed *instead

[go-nuts] Re: Updating golang.org/x/tools

2020-02-18 Thread anderson . queiroz
I'm no expert on it. However I'd try `GO111MODULE=on go install ...` outside a Go module. Anyway ensure you run `GO111MODULE=on go get ...` outside a Go module to get packages to go to your gopath. On Monday, 17 February 2020 00:59:16 UTC+1, Tong Sun wrote: > > Hi, > > My present from

[go-nuts] Re: rand.Rand.Seed() vs rand.NewSource()

2020-02-11 Thread anderson . queiroz
If you use the same seed the source will output the same pseudo-random output. Which is quite useful when you need to be able to replay/predict the random behaviour On Tuesday, 26 March 2019 19:48:27 UTC+1, Liam wrote: > > Could anyone clarify the difference between these two? > > r :=

[go-nuts] Re: A question !

2020-01-06 Thread anderson . queiroz
> > 2 - What is the fastest resource to learn Golang ( efficiently ) > For me the best thing was Effective Go https://golang.org/doc/effective_go.html Helps to understand "the go way"of coding and the main characteristics of the language -- You received this message because you are

[go-nuts] Re: golang tool for splitting long lines

2019-11-18 Thread anderson . queiroz
Hi Sankar, Not really, a easy trick is to use json.MarshalIndent. It helped me a lot :) playgound: https://play.golang.org/p/nfr2ANR6pPH type A struct { A int B string C map[int]string } func main() { aa := A{ A: 1, B: "2", C: map[int]string{3: "3"},

[go-nuts] Re: errors custom As

2019-10-28 Thread anderson . queiroz
The idea of As is to find an error in the wrapped errors, the error chain, which can be cast to the type you pass. I played a bit with them and made some examples: https://github.com/AndersonQ/go1_13_errors/blob/master/main.go#L103 Have a look in the implementation of As, it's nice and simple

Re: [go-nuts] json time format discrepancy

2019-10-09 Thread Anderson Queiroz
Indeed looks odd, but as Jakob showed, it looks fine. I was playing directly with the marshal/unmarshall and I didn't fine any problem either. My playground: https://play.golang.org/p/LLmQqxLKfME On Wednesday, 9 October 2019 07:29:29 UTC+2, Jakob Borg wrote: > > On 8 Oct 2019, at 19:27, Andrey

[go-nuts] Re: Full Commit Hashes in go.mod

2019-10-08 Thread anderson . queiroz
Hi Pranay, There is no option to change the pseudo-version format. However the last part is the prefix of the commit hash. You can see more here in the docs . Regarding to ask for this feature, you can file a issue on Go's github

[go-nuts] Re: Why not put contexts in structs?

2019-09-26 Thread anderson . queiroz
Well, one of the reasons is convention. The context should be passes as paramter and be the first paramter as is stated in the package documentation. For sure following the convention it's easier to know where the context came from, when it's available. Inside a struct it's somehow hidden,

[go-nuts] Re: How to propagate multiple errors using the new fmt.Errorf wrapping

2019-08-12 Thread anderson . queiroz
Hi Alex, I see your problem is more like merging errors rather than wrapping them. Indeed I don't see any way you could merge 2 errors with the new ` *fmt.Errorf*` I believe what you want is something which could hold 2 errors, like type myError struct { msg string // some additional msg

Re: [go-nuts] Replace modules from command line

2019-08-06 Thread anderson . queiroz
go mod edit does the trick. Try go mod edit -replace=github.com/foo/barr=github.com/bar/foo go mod edit -replace=github.com/foo/barr=github.com/bar/foo@12345567789 Best Anderson On Tuesday, 6 August 2019 07:26:45 UTC+2, Peter Feichtinger wrote: > > Thanks for that, this will come in

[go-nuts] Re: Replace modules from command line

2019-08-06 Thread anderson . queiroz
Ops, now really understood what you want... Well, a not really elegant way could be to have it pointing to a local folder and change the content on the local folder. But I believe the go.sum would spot the difference and break the build. But if you need to change the version, why cannot you