Re: [go-nuts] Is it weird?

2016-07-25 Thread Ian Lance Taylor
On Mon, Jul 25, 2016 at 10:40 AM, Matt Harden wrote: > The syntax is &type{...}. &42 does not match this syntax. What Jan was > describing is specific to that syntax, not to the use of & in general; in > fact let's try it for &x: > > tmp := x > &tmp > > This gives a very different and not useful v

[go-nuts] Anyone aware of a CVSS v3 parser & score computation library?

2016-07-25 Thread 'Eric Johnson' via golang-nuts
go-search.org and Google just found CVSS v2 implementations. Anyone have any tips? Eric. -- 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...

Re: [go-nuts] Will go compiler do optimization here if "bytes" is a global variable?

2016-07-25 Thread 'Keith Randall' via golang-nuts
Yes, it is. The optimization occurs for any occurrence of m[string(expression of type []byte)]. Where the byte slice came from (global or otherwise) is irrelevant. On Monday, July 25, 2016 at 8:37:03 AM UTC-7, T L wrote: > > @Randall, thanks for answer. > You mean the answer is yes, right? --

[go-nuts] Re: Someone reads req.Body even after client.Do ends in an http request,

2016-07-25 Thread James Bardin
To put it another way, excluding error conditions, the request isn't done until you've consumed the response body and closed it. On Monday, July 25, 2016 at 3:11:01 PM UTC-4, fabian@gmail.com wrote: > > Hi, > > first, two points on the more obvious aspects: > >- The ContentLength header

[go-nuts] Re: Is there a way to implement this C macro in Go?

2016-07-25 Thread Val
This code "does the trick" (except in Playground) : https://play.golang.org/p/kJAfNFZUev $ go run macro.go dump(a + b) = 14 dump(b * a) = 40 $ go build -o macro $ ./macro dump(a + b) = 14 dump(b * a) = 40 Read current stacktrace, extract source file path, read source file, extract textual (u

Re: [go-nuts] pprof where is my time going

2016-07-25 Thread ajay aggarwal
Thanks Ian. But Its not clear how to get execution trace from that document (https://golang.org/s/go15trace). When I list profiles for my application, I get following list block,goroutine,heap,threadcreate And when I try to curl to http://my-app/debug/pprof/trace?seconds=30"; for my applicati

[go-nuts] Re: [ANN] [HOWTO] go-github-release: release, package, deploy for windows, rpm, deb with ease!

2016-07-25 Thread mhhcbon
A last though on that topic, fedora and ubuntu are now pushing new package formats (flatpack / snap). (sarcasm, Once again everybody s doing its own sauce) I m not clear about flatpack, but snap is definitely a binary package format. Let s see what will happen in coming releases. Le dimanche 2

[go-nuts] Re: [ANN] [HOWTO] go-github-release: release, package, deploy for windows, rpm, deb with ease!

2016-07-25 Thread mhhcbon
> > This is for a single-exe release right? > A tiny bit more as you can have extra files along your bin, setup icon for menu launchers, define env variables, and for deb/rpm have pre/post script where you can install services or do more fun stuff. Msi support is definitely missing that last

[go-nuts] Re: Someone reads req.Body even after client.Do ends in an http request,

2016-07-25 Thread fabian . staeber
Hi, first, two points on the more obvious aspects: - The ContentLength header is just a hint for the server. Nothing prevents you from setting the content length to some value (like 1896240) and then sending a request body with a different size. The resulting request might not be a

[go-nuts] Re: nodemon style tool

2016-07-25 Thread Daniel Theophanes
If you are looking for a file watch tool where you can do those things, you could look at modd: https://github.com/cortesi/modd#quick-start On Monday, July 25, 2016 at 10:36:18 AM UTC-7, KLR wrote: > > Hi, is there a nodemon style tool for go (or less bulky) or has anyone a > recommendation for

Re: [go-nuts] Is it weird?

2016-07-25 Thread Matt Harden
The syntax is &type{...}. &42 does not match this syntax. What Jan was describing is specific to that syntax, not to the use of & in general; in fact let's try it for &x: tmp := x &tmp This gives a very different and not useful value for &x. &T{...} is an exceptional syntactic sugar for grabbing

[go-nuts] nodemon style tool

2016-07-25 Thread KLR
Hi, is there a nodemon style tool for go (or less bulky) or has anyone a recommendation for server restart after code changes bash script for that and watching several files .go and polymer (.html)? Thanks, Karl -- You received this message because you are subscribed to the Google Groups "gola

Re: [go-nuts] Is it weird?

2016-07-25 Thread Konstantin Khomoutov
On Mon, 25 Jul 2016 15:54:02 + Jan Mercl <0xj...@gmail.com> wrote: > > If T{} is like 42, why “(&T{})" is legal? > > Because > > &T{...} > > is syntactic sugar for > > tmp := T{...} // behind the scenes > &tmp > > and &tmp is an okay receiver in the OP. But by the

Re: [go-nuts] Is it weird?

2016-07-25 Thread T L
@Matt Harden, the recursive reason listens quite reasonable. @all, thanks for paticipating this discussion. -- 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 golan

[go-nuts] Re: [ANN] [HOWTO] go-github-release: release, package, deploy for windows, rpm, deb with ease!

2016-07-25 Thread Tong Sun
Looks good, Thanks. This is for a single-exe release right? Any plan to have share lib support for multiple-tool releases? I.e., to allow many small tools written in GO to use the same shared lib, instead of each carrying the full set of Go libs. On Sunday, July 24, 2016 at 12:18:42 PM UTC-

Re: [go-nuts] Is it weird?

2016-07-25 Thread Sam Whited
On Mon, Jul 25, 2016 at 11:23 AM, T L wrote: > It doesn't work. The receiver should be a pointer in function definition. > > https://play.golang.org/p/fQbbeDhB9O Oh I see, I misunderstood. If the receiver is a pointer it's probably so that you can modify the value, but in this case you are immedi

Re: [go-nuts] Is it weird?

2016-07-25 Thread Matt Harden
On Mon, Jul 25, 2016 at 9:10 AM Sam Whited wrote: > On Mon, Jul 25, 2016 at 11:05 AM, T L wrote: > > Then why > > > > T{...} > > > > can't be a syntactic sugar for > > > > tmp := T{...} > > tmp > > > > and tmp is an okay receiver. > > :P > > It is (effectively) Not so.

Re: [go-nuts] Is it weird?

2016-07-25 Thread T L
It doesn't work. The receiver should be a pointer in function definition. https://play.golang.org/p/fQbbeDhB9O -- 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

Re: [go-nuts] Is it weird?

2016-07-25 Thread Sam Whited
On Mon, Jul 25, 2016 at 11:05 AM, T L wrote: > Then why > > T{...} > > can't be a syntactic sugar for > > tmp := T{...} > tmp > > and tmp is an okay receiver. > :P It is (effectively); that works just fine: https://play.golang.org/p/SF2lznWaRj eg. (T{}).f() should work.

Re: [go-nuts] Is it weird?

2016-07-25 Thread T L
Then why T{...} can't be a syntactic sugar for tmp := T{...} tmp and tmp is an okay receiver. :P -- 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

Re: [go-nuts] Is it weird?

2016-07-25 Thread Jan Mercl
On Mon, Jul 25, 2016 at 5:50 PM T L wrote: > If T{} is like 42, why “(&T{})" is legal? Because &T{...} is syntactic sugar for tmp := T{...} // behind the scenes &tmp and &tmp is an okay receiver in the OP. -- -j -- You received this message because you are subs

Re: [go-nuts] Is it weird?

2016-07-25 Thread T L
If T{} is like 42, why “(&T{})" is legal? -- 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 https:

Re: [go-nuts] Is it weird?

2016-07-25 Thread Jan Mercl
On Mon, Jul 25, 2016 at 5:34 PM T L wrote: I cannot see a problem. > (&t).f() // ok &t is a pointer, no problem here. > t.f() // ok t is adressable, again, no problem. > (&T{}).f() // ok &T{} is already a pointer, no surprise it's ok as a receiver of a pointer method. > T{}.f() // cannot c

Re: [go-nuts] Will go compiler do optimization here if "bytes" is a global variable?

2016-07-25 Thread T L
@Randall, thanks for answer. You mean the answer is yes, right? -- 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

[go-nuts] Is it weird?

2016-07-25 Thread T L
package main type T struct{} func (t *T) f() {} func main() { t := T{} (&t).f() // ok t.f() // ok (&T{}).f() // ok T{}.f() // cannot call pointer method on T literal // cannot take the address of T literal } -- You received this

[go-nuts] net.Conn.Read() performance

2016-07-25 Thread anton . gavrik
Hello, I'm trying to understand whether net.Conn.Read() is expected to use a lot more CPU than reading using the lower level socket interface or if I am doing something wrong(or perhaps comparing apples to oranges)? Consumer and producer apps are running on two different Linux machines, in "to

[go-nuts] Someone reads req.Body even after client.Do ends in an http request,

2016-07-25 Thread Feng Liyuan
Set a io.Reader in http.NewRequest and do a http request, I found that someone reads the io.Reader even after the http request done. Is it a correct behaviour? And is it documented? My client code is package main import ( "log" "net/http" "time") type reader struct{} func (r reade

[go-nuts] Re: syscall.Read() with timeout: syscall.Select() vs golang's select statement

2016-07-25 Thread fabian . staeber
Nice! I wasn't aware that the select statement is also for writing to channels, most examples only show reading from channels. Thanks a lot! On Monday, July 25, 2016 at 5:12:48 AM UTC+2, Alex Bucataru wrote: > > Hi Fabian, > > You could add a signal channel to tell your goroutine to exit. Editing

Re: [go-nuts] What dependency management tool do you use?

2016-07-25 Thread Johann Höchtl
On 2016-07-25 12:35, roger peppe wrote: On 24 July 2016 at 13:14, Johann Höchtl wrote: Instead of thanking all reporters individually I'll do it here. I didn't expect a clear winner but some of the rationales for prefering one dependency mgmt tool over the other became more clear to me. To

[go-nuts] Re: How to capture stderr/stdout of cgo calls?

2016-07-25 Thread Uli Kunitz
Your program doesn't work because changing os.Stdout and os.Stdin has no effect on stdio stdin and stdout. Stdio stdout will still reference fd 1 and stderr fd 2. I recommend following three solutions: 1. The simplest approach could be not to use cgo at all and run the C code in a sepa

Re: [go-nuts] What dependency management tool do you use?

2016-07-25 Thread roger peppe
On 24 July 2016 at 13:14, Johann Höchtl wrote: > Instead of thanking all reporters individually I'll do it here. I didn't > expect a clear winner but some of the rationales for prefering one dependency > mgmt tool over the other became more clear to me. > > To sum it up: I'll stick with godeps.

[go-nuts] How to capture stderr/stdout of cgo calls?

2016-07-25 Thread Markus Zimmermann
Given the following code https://play.golang.org/p/1_Q9SFIPjr one can see that stdout of Go and cgo are piped to two different descriptors. a.) Is it possible to redirect stderr/stdout of cgo calls directly to os.Stderr/os.Stdout? Am I overlooking some argument or options of cgo so that is done