[go-nuts] Re: What are test binaries?

2017-09-04 Thread Volker Dobler
A "test binary" is a normal binary compiled by go test including the test function from the *_test.go files which executes the tests when run.. V. On Tuesday, 5 September 2017 06:30:05 UTC+2, st ov wrote: > > And how do they differ from normal binaries? > -- You received this message because

[go-nuts] golang preempt schedule how work ?

2017-09-04 Thread 刘桂祥
I have a question about golang preempt schedule, here is my example code; I doubt why the bar groutine don't happen preempt schedule? (I build with -gcflags “-N -l” to stop func inline) More if my server with one or two cpu bound worker goroutine runing, when the gc need stop the world,

[go-nuts] What are test binaries?

2017-09-04 Thread st ov
And how do they differ from normal binaries? -- 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 options, visit

[go-nuts] 『Q』How to make hugepagesize work with Go?

2017-09-04 Thread Linker
Hi, Guys! I have a lot of docker running go micro-services which have a big-heap. My question is how to make go work with hugepagesize in linux/amd64 ? Thanks, -- *Regards,Linker linlinker.m@gmail.com * -- You received this message because you are subscribed to

[go-nuts] Re: Best way to launch/monitor several go process in production

2017-09-04 Thread Miki Tebeka
I've used http://supervisord.org/ in the past, very easy to set up and you can get notified when a process exits. On Monday, September 4, 2017 at 12:35:30 AM UTC+3, emarti...@gmail.com wrote: > > Hello, > > I am looking for the 'best' way to launch and monitor several go > processes. Doing it

Re: [go-nuts] Extending image.Image with Set

2017-09-04 Thread James
I think your ImageSetter is already in the standard library https://golang.org/pkg/image/draw/#Image It's a little bit subtle because different packages have the immutable Image and mutable Image It might save you some work by using golang.org/x/image library which already has affine transforms.

Re: [go-nuts] A question about evaluation of channel’s send statement

2017-09-04 Thread Jesse McNelis
On Tue, Sep 5, 2017 at 10:34 AM, Marlon Che wrote: > Hi everyone! > Please help me figure out the two different results of following code: > > package main > > import ( > "fmt" > "time" > ) > > func main() { > var num = 10 > var p = > > c := make(chan

Re: [go-nuts] Same code different result?

2017-09-04 Thread Tong Sun
Thanks a lot Jakob for trying it out for me. *Problem solved*! All thanks to Florian Florensen's help! I turned this bunch of code, https://github.com/go-dedup/text/blob/3d0d998bef3db3937496933778c55e4f01cab5e4/text.go#L37-L60 into a single simple line, and now the problem is gone:

Re: [go-nuts] Re: Splitting CamelCaseWords in Go

2017-09-04 Thread Tong Sun
Oh thanks a lot Florian! I wished I had received it earlier (my email header said, Created at: Sun, Sep 3, 2017 at 6:03 PM (Delivered after 89531 seconds)), because my own version is embarrassingly complicated:

[go-nuts] Re: Dave Cheney's "Practical Go" book

2017-09-04 Thread chou
I want to buy one, is it released out? 在 2017年9月5日星期二 UTC+8上午7:41:36,st ov写道: > > Any information on the contents and a release date? > > Couldn't find any details on O'reilly, Amazon or dave.cheney.net. > -- You received this message because you are subscribed to the Google Groups

[go-nuts] Re: error handling needs syntactical sugar

2017-09-04 Thread Dorival Pedroso
I forgot (again) to say that in this case the error would just be returned. In other words, `watch err` would just check if `err != nil` and then return. The other cases (test, main) would be as explained earlier (FailNow(), Exit(1)) On Tuesday, September 5, 2017 at 10:14:16 AM UTC+10,

[go-nuts] Re: error handling needs syntactical sugar

2017-09-04 Thread Dorival Pedroso
Hi, the `watch err` could also work in "APIs" that already return "error". For instance: package myapi func First() (err error) { watch err err = internalFunction(1,2,3) err = internalFunction(3,2,1) err = internalFunction(1,3,2) } On Tuesday, September 5, 2017 at 4:27:20 AM

[go-nuts] Re: os/exec CreateProcessAsUser

2017-09-04 Thread brainman
On Tuesday, 5 September 2017 08:56:24 UTC+10, Daniel Smith wrote: > > > Is there is any way to have os/exec call CreateProcessAsUser or > CreateProcessWithLogon? > I've tried calling ImpersonateLoggedOnUser, as well as replacing the user > token after the process is spawned, and neither route

[go-nuts] Dave Cheney's "Practical Go" book

2017-09-04 Thread st ov
Any information on the contents and a release date? Couldn't find any details on O'reilly, Amazon or dave.cheney.net. -- 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

[go-nuts] Re: error handling needs syntactical sugar

2017-09-04 Thread Dorival Pedroso
by the way, above, I was thinking of `watch` as a counterpart of `var`... On Tuesday, September 5, 2017 at 8:56:24 AM UTC+10, Dorival Pedroso wrote: > > Hi, > > Error management in Go is perfect! > > But I like the idea of `watch` (may we drop the `if`?) > > So, `watch` would work in the context

[go-nuts] os/exec CreateProcessAsUser

2017-09-04 Thread Daniel Smith
Is there is any way to have os/exec call CreateProcessAsUser or CreateProcessWithLogon? I've tried calling ImpersonateLoggedOnUser, as well as replacing the user token after the process is spawned, and neither route has the desired effect. All I can come up with is copying the whole os/exec

Re: [go-nuts] "find" for Slices like "append"

2017-09-04 Thread marode
Ian, thanks for the "generic" function. I appreciate. I think such a function would provide beautiful symmetry to the already existing "append" function Go has. Martin On Wednesday, August 9, 2017 at 5:53:45 PM UTC+2, Ian Lance Taylor wrote: > > Here is a generic Find function that works

[go-nuts] Re: error handling needs syntactical sugar

2017-09-04 Thread Dorival Pedroso
Hi, Error management in Go is perfect! But I like the idea of `watch` (may we drop the `if`?) So, `watch` would work in the context of a function like `defer`. However, this would effectively become a `catcher` for errors (instead of `panics`) within the `defer` function, right? Also, I

[go-nuts] Re: mgo r2015.12.06 is out

2017-09-04 Thread celerno herrera
Thank you so much. On Thursday, January 19, 2017 at 10:10:31 PM UTC-6, Davis Ford wrote: > > Just in case anyone else lands here, Mongo doesn't support mixed mode > replica set with 2.6.x and 3.2.x -- I learned that the hard way, adding a > new 3.2 member to the replica set to work on

[go-nuts] Re: Splitting CamelCaseWords in Go

2017-09-04 Thread Florian Florensen
Hi, two approaches would be: func camelAppend(str string) string { w := []rune(str) for i := len(w) - 1; i > 1; i-- { if unicode.IsUpper(w[i]) { w = append(w[:i], append([]rune{' '}, w[i:]...)...) } } return string(w) } func camelRegexp(str string) string { re :=

[go-nuts] Extending image.Image with Set

2017-09-04 Thread Florian Florensen
Hello, I'd like to rotate, scale, ... images by moving pixels using affine transformations. For example, the get a points x, y position after a translating it by m, n pixels, you can just add m resp n to x and y: x' = x + m y' = y + n So the task is basically just to iterate over the images

[go-nuts] Re: Best way to launch/monitor several go process in production

2017-09-04 Thread Gernot Reisinger
For the monitoring part I can recommend https://www.dynatrace.com/technologies/golang-monitoring (https://www.dynatrace.com/blog/introducing-fully-automated-support-for-go-based-application-monitoring/). Am Sonntag, 3. September 2017 23:35:30 UTC+2 schrieb emarti...@gmail.com: > > Hello, > > I

Re: [go-nuts] net/http: Redirect writes HTML for GET requests without setting Content-Type, how come?

2017-09-04 Thread Dmitri Shuralyov
Quick followup note here. The CL that resolves this issue has been merged, and should be a part of Go 1.10 release. On Saturday, July 22, 2017 at 11:46:40 PM UTC-4, Dmitri Shuralyov wrote: > > Thanks Matt, that corroborates with my understanding too. > > I've sent a CL

[go-nuts] [ANN] Gogland EAP 13 has been released

2017-09-04 Thread Florin Pățan
Hi all, The JetBrains Go IDE Codename Gogland just got a new upgrade, EAP 13. There are a lot of performance improvements, fixes and new features. Among the new features, there's an inspection for shadowed identifiers. It's not enabled by default but please try it and if you can offer any

Re: [go-nuts] error handling needs syntactical sugar

2017-09-04 Thread 'Axel Wagner' via golang-nuts
See, e.g. here or here for previous discussions of very similar (even mostly identical) proposals. What I always dislike about these kinds of proposals is,

[go-nuts] error handling needs syntactical sugar

2017-09-04 Thread Tamás Gulácsi
Why do you Prepare a statement if you don't reuse it? Just use a db.Exec. But concretes aside: error handling IS important! But if such code bothers you, create some helper type / function: see one Andy+Brad pair programming video where they create an errWriter struct which is an io.Writer, and

[go-nuts] error handling needs syntactical sugar

2017-09-04 Thread martin . rode
Hi guys, at first I though I really like the idea of how Go deals with error management and handling, but the more Go code I look at or try to program, the more I get scared about checking errors every second line in every given block of code. Take a look at this example here from "Build Web

Re: [go-nuts] Same code different result?

2017-09-04 Thread Jakob Borg
Then I can't guess. I checked out your code, and the tests fail for me in the same way as on travis. //jb > On 4 Sep 2017, at 15:12, Tong Sun wrote: > > Yes, we can say it is calculating hashes in some manner. However, all the > test content so far are pure ascii,

Re: [go-nuts] Same code different result?

2017-09-04 Thread Tong Sun
Yes, we can say it is calculating hashes in some manner. However, all the test content so far are pure ascii, which would not change regardless how you are looking at it (unlike unicode), and the hashes is done on only words, i.e., spaces and line endings will not affect the hashing. Thanks a lot

Re: [go-nuts] public interface with private method: totally dubious ? In which case is it useful ?

2017-09-04 Thread Ian Davis
It's a pattern that can be used to prevent external implementations of the interface. Another example is the text/template package in the standard library: https://github.com/golang/go/blob/master/src/text/template/parse/node.go#L21 On Mon, 4 Sep 2017, at 01:21 PM, mhhc...@gmail.com wrote: > hi,

[go-nuts] public interface with private method: totally dubious ? In which case is it useful ?

2017-09-04 Thread mhhcbon
hi, in this code https://github.com/conformal/gotk3/blob/7a6ce3ecbc883d4d6a7aa1821bbc9633751fd67e/gtk/gtk.go#L7926 a public interface with a private method is declared. At first read, totally dubious. yeah? A bit more testing, and i wonder in which case this is suitable, a basic example

[go-nuts] Re: Best way to launch/monitor several go process in production

2017-09-04 Thread Diego Medina
This https://github.com/jpillora/overseer may do what you need or at least give you an idea of what you can do. The way oveerseer works is, you start your app, when you send a particular kill signal, it keeps the running app running and it spawns a duplicate, it passes new http requests to the

[go-nuts] Re: Best way to launch/monitor several go process in production

2017-09-04 Thread Christian Joergensen
On Sunday, September 3, 2017 at 11:35:30 PM UTC+2, emarti...@gmail.com wrote: > > I am looking for the 'best' way to launch and monitor several go > processes. Doing it with just 1 is easy enough, using monit or systemctl > should do the trick, however since our app takes a while to start, we

Re: [go-nuts] Question about plugins & types

2017-09-04 Thread Miki Tebeka
Thanks Axel On Sunday, September 3, 2017 at 2:30:48 PM UTC+3, Axel Wagner wrote: > > type MathFunc func(int, int) int declares a *new* type, called MathFunc, > with underlying type func(int, int) int, which is why the type-assertion > fails - you are checking whether the type is *exactly*

Re: [go-nuts] golang gc stop the world how to stop cpu busy goroutine?

2017-09-04 Thread 刘桂祥
But I build with -gcflags "-N -l" here is gdb code: (gdb) Dump of assembler code for function main.main: 0x2100 <+0>: mov%gs:0x8a0,%rcx 0x2109 <+9>: cmp0x10(%rcx),%rsp 0x210d <+13>: jbe0x216c 0x210f <+15>:

Re: [go-nuts] golang gc stop the world how to stop cpu busy goroutine?

2017-09-04 Thread 刘桂祥
Yes, I just want to let the bar func goroutine run first or replace runtime.Gosched() with time.Sleep, But I still doubt why add1 in bar func don't happen preempt schedule ? 在 2017年9月4日星期一 UTC+8下午3:25:04,John Souvestre写道: > > I think that you put the call to runtime.Gosched() in the wrong

RE: [go-nuts] Re: Running Go binary on a 56 core VM

2017-09-04 Thread John Souvestre
There are lots of variables, but even with a directly connected SSD drive (SATA bus, in my case) I can pretty well top out the file i/o, just doing sequential file reads, with about 3 – 4 CPUs. So increasing GOMAXPROCS (in this case) doesn’t help. John John Souvestre - New Orleans LA

RE: [go-nuts] golang gc stop the world how to stop cpu busy goroutine?

2017-09-04 Thread John Souvestre
Although a goroutine isn’t pre-emptible by the Go scheduler, there is an opportunity whenever it does something which blocks or when it calls a non-inlined function. So generally the GC’s STW can take place pretty quickly. But if you are doing something with is totally compute bound then it

Re: [go-nuts] Same code different result?

2017-09-04 Thread Jakob Borg
Hi, It's not especially clear from your mail what your tool does, exactly. But assuming that it calculates hashes of content in some manner, my first guess would be that your test data character set and/or line endings get changed by the git checkin/checkout procedure. //jb > On 4 Sep 2017,