[go-nuts] looking for example of CloseRead in production code

2017-02-04 Thread Matej Baćo
Try using sourcegraph.com, it has feature I think it is called external references that search github public repos for the function call. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails fr

[go-nuts] Does my gofmt work wrongly or I don't understand something ?

2017-02-04 Thread fsn761304
How it was: package main import "fmt" func main() { fmt.Printf("hello, world\n") } After: gofmt -r 'h -> H' -w "hello.go" Become: package H import "fmt" func H() { H } -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubsc

[go-nuts] Re: Are external test packages recommended?

2017-02-04 Thread Dave Cheney
On Sunday, 5 February 2017 15:39:55 UTC+11, so.q...@gmail.com wrote: > I generally favor "external test packages", that is having "_test" as a > suffix to my test package names. > For example, "package foo" (foo.go) would have a test file (foo_test.go) > named "package foo_test" > > > I do so

Re: [go-nuts] About 64bits alignment

2017-02-04 Thread Ian Lance Taylor
On Sat, Feb 4, 2017 at 2:38 PM, Axel Wagner wrote: > On Sat, Feb 4, 2017 at 11:13 PM, Ian Lance Taylor wrote: >> >> The spec does not say that unsafe.Alignof(s.B) will return 8. In >> fact, on 32-bit targets, with the gc toolchain, it will return 4. > > > To me, that seems to contradict the comb

[go-nuts] Go package/version management, vendoring, dep, gb, etc...

2017-02-04 Thread jeffkayser3
I can’t seem to converge on a decent package/version management scheme. I asked Dave Cheney, and he recommended that I email this list. I’ve written a Go project. I started with a directory tree like this: $GOPATH/src/project/objects/agent_v1/agent_v1.go (import “project/objects/agent

[go-nuts] Re: How to run go testing code with "go run"

2017-02-04 Thread Tong Sun
On Saturday, February 4, 2017 at 5:59:34 PM UTC-5, Tong Sun wrote: > > I know all go testing code are invoked with "*go test*", however, I want > to easily test out some of the test code of the package I'm trying, so the > easiest way is to test them out as-is, but with "*go run*" instead. Is i

[go-nuts] Are external test packages recommended?

2017-02-04 Thread so . query
I generally favor "external test packages", that is having "_test" as a suffix to my test package names. For example, "package foo" (foo.go) would have a test file (foo_test.go) named "package foo_test" I do so under the belief that it forces me to test against my package's public interface and

Re: [go-nuts] How to idiomatically display chained errors?

2017-02-04 Thread so . query
I don't see an "Errors" subsection under the Methods chapter (6). Could you write a short example? On Saturday, February 4, 2017 at 3:50:49 PM UTC-8, oso wrote: > > You should avoid to put newline. I recommend you to have a look at > "Errors" (which is under Method section) section of http://www

Re: [go-nuts] Problems drawing on frames of an animated gif

2017-02-04 Thread Nigel Tao
On Mon, Jan 23, 2017 at 6:03 AM, kalekold via golang-nuts wrote: > Hmm.. the source gif I'm using must be compressed. Doesn't Go handle > compressed gifs in the same way? When you say 'I may get unexpected results' > is that because the current gif package doesn't support compression? A GIF image

Re: [go-nuts] How to idiomatically display chained errors?

2017-02-04 Thread oso
You should avoid to put newline. I recommend you to have a look at "Errors" (which is under Method section) section of http://www.gopl.io/ book. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving e

Re: [go-nuts] Go Fonts: request for feedback

2017-02-04 Thread Nigel Tao
On Sun, Feb 5, 2017 at 12:40 AM, Konstantin Khomoutov wrote: > Compare this to how a set of ubiquitous fonts from Microsoft is > rendered with the same settings: ms-alias-none-no-hinting.png -- they > look just great. Yeah, I believe that Microsoft put a *lot* of work into those fonts, a couple o

[go-nuts] How to run go testing code with "go run"

2017-02-04 Thread Tong Sun
I know all go testing code are invoked with "*go test*", however, I want to easily test out some of the test code of the package I'm trying, so the easiest way is to test them out as-is, but with "*go run*" instead. Is it possible, or how can I make such thing possible? For e.g., here is a pie

Re: [go-nuts] Go Fonts: request for feedback

2017-02-04 Thread Nigel Tao
On Sat, Feb 4, 2017 at 12:12 PM, roger peppe wrote: > More unicode coverage would also be nice. Selfishly I'd like characters for > all those in plan 9's lib/keyboard file > (https://github.com/0intro/plan9/blob/master/lib/keyboard) so I can read the > characters that I can easily type. :-) I can

Re: [go-nuts] About 64bits alignment

2017-02-04 Thread 'Axel Wagner' via golang-nuts
On Sat, Feb 4, 2017 at 11:13 PM, Ian Lance Taylor wrote: > On Sat, Feb 4, 2017 at 7:33 AM, Axel Wagner > wrote: > > > > I believe, that fields do not necessarily need to be properly aligned > > (explaining 599). However, *structs* have a necessary alignment, as > required > > by their fields. So

Re: [go-nuts] About 64bits alignment

2017-02-04 Thread 'Axel Wagner' via golang-nuts
Basically, to most of your disagreements: I'm wildly guessing, trying to make sense of the information I do have :) Just one specific answer: On Sat, Feb 4, 2017 at 11:05 PM, Matt Harden wrote: > > Wait, I don't think you've explained why expvar.Float would be aligned > even if embedded in anothe

Re: [go-nuts] About 64bits alignment

2017-02-04 Thread Ian Lance Taylor
On Sat, Feb 4, 2017 at 7:33 AM, Axel Wagner wrote: > > I believe, that fields do not necessarily need to be properly aligned > (explaining 599). However, *structs* have a necessary alignment, as required > by their fields. So, if you do > type S struct { > A uint32 > B uint64 > } > then th

Re: [go-nuts] About 64bits alignment

2017-02-04 Thread Matt Harden
On Sat, Feb 4, 2017 at 7:34 AM 'Axel Wagner' via golang-nuts < golang-nuts@googlegroups.com> wrote: > I find this an inappropriate answer. Yes, they need care, but it should at > least be possible to figure out how to use them from reading documentation > (carefully). I tend to agree, that neither

Re: [go-nuts] Re: Google Grumpy (Python->Go)

2017-02-04 Thread 'simon place' via golang-nuts
cool, i'll keep an eye on that. On Saturday, 4 February 2017 04:35:43 UTC, Dylan Trotter wrote: > > The compiler cannot yet run under Grumpy because it uses standard > libraries that aren't yet supported. The most substantial unsupported > library is the ast module. Once https://github.com/googl

Re: [go-nuts] VERY weird timezone behavior

2017-02-04 Thread Andy Balholm
Note the date that is printed with the times. Since Jan. 1 of year zero (1 BC?) predates the establishment of standard time zones, Go converting from 1:00 PM mean solar time at Stockholm to 12:53 PM mean solar time at Berlin. (Or is the time used at Stockholm something different? It doesn’t seem

Re: [go-nuts] How to idiomatically display chained errors?

2017-02-04 Thread so . query
So put each on a newline? On Saturday, February 4, 2017 at 12:17:45 AM UTC-8, Sander van Harmelen wrote: > > Did you check the errors package: https://godoc.org/github.com/pkg/errors > ? > > It offers a great way to wrap chained

[go-nuts] VERY weird timezone behavior

2017-02-04 Thread legolord208
I am very confused... Please take a look at this... https://play.golang.org/p/_mnELD1nCv I am trying to convert "1PM" Swedish time (12PM GMT) to German time. In this case also 1PM... But no, not according to Golang. -- You received this message because you are subscribed to the Google Groups "

[go-nuts] Shall I use same js/styles used in Go talk slides in my website ?

2017-02-04 Thread pankaj rai
Shall I use same js/styles used in Go talk slides in my website golangWorld.com (this website is for golang's tutorial purpose) -- 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, sen

[go-nuts] Really weird timezone behavior.

2017-02-04 Thread LEGOlord208
Trying to convert timezones. Works nearly, but they have some minutes off! For example, these timezones should be equals: https://play.golang.org/p/_mnELD1nCv They aren't. Fun fact: Because of the way time is built, I can't just simply round it. So this isn't going very well -- You receive

[go-nuts] Proposal: Export "C-type" aliases from syscall-packages

2017-02-04 Thread 'Axel Wagner' via golang-nuts
Hey, I'd like to propose that we use the new type aliases to add C-types (so, aliases for "unsigned long" and the like) to the x/sys/… packages. They already contain build-tagged files for types, because the interpretation of "

Re: [go-nuts] About 64bits alignment

2017-02-04 Thread 'Axel Wagner' via golang-nuts
I find this an inappropriate answer. Yes, they need care, but it should at least be possible to figure out how to use them from reading documentation (carefully). I tend to agree, that neither the spec nor the documentation of the atomic package is particularly helpful about these questions; at lea

Re: [go-nuts] About 64bits alignment

2017-02-04 Thread Lars Seipel
On Sat, Feb 04, 2017 at 01:30:49AM -0800, T L wrote: > Get it. This is quite bug prone to write programs on 64bit OSes and the > programs are expected to run on 32bit OSes too. Well, there's a reason the sync/atomic package docs have this statement right at the top: > These functions require gre

Re: [go-nuts] Go Fonts: request for feedback

2017-02-04 Thread Konstantin Khomoutov
On Fri, 3 Feb 2017 11:25:20 +1100 Nigel Tao wrote: > Bigelow & Holmes, the designers of the Go Fonts, are preparing an > update to those fonts. [...] > If you have any other bug reports, feature requests, or just like to > comment in general, please reply to the discussion group here, and > I'll

Re: [go-nuts] About 64bits alignment

2017-02-04 Thread T L
On Saturday, February 4, 2017 at 6:32:52 PM UTC+8, Axel Wagner wrote: > > The spec says this: > https://golang.org/ref/spec#Size_and_alignment_guarantees > Now, I can't really read from this whether this applies to fields or not. > If it does, it would seem to me, that, indeed, WaitGroup wouldn

Re: [go-nuts] About 64bits alignment

2017-02-04 Thread 'Axel Wagner' via golang-nuts
The spec says this: https://golang.org/ref/spec#Size_and_alignment_guarantees Now, I can't really read from this whether this applies to fields or not. If it does, it would seem to me, that, indeed, WaitGroup wouldn't need to use the trick it does. For the example you name: It isn't particularly t

Re: [go-nuts] About 64bits alignment

2017-02-04 Thread T L
On Saturday, February 4, 2017 at 2:18:44 PM UTC+8, Matt Harden wrote: > > https://play.golang.org/p/VWysBwbPCu > > The above program prints 64-bit aligned addresses on the playground, but > that's a 64 bit platform (with 32 bit pointers). On a 32 bit platform x.j > is not guaranteed to be 64-bi

Re: [go-nuts] About 64bits alignment

2017-02-04 Thread T L
On Saturday, February 4, 2017 at 5:56:30 PM UTC+8, T L wrote: > > > > On Saturday, February 4, 2017 at 5:40:25 PM UTC+8, T L wrote: >> >> >> >> On Friday, February 3, 2017 at 10:44:26 PM UTC+8, Ian Lance Taylor wrote: >>> >>> On Fri, Feb 3, 2017 at 5:38 AM, T L wrote: >>> > Why does WaitGroup.s

Re: [go-nuts] About 64bits alignment

2017-02-04 Thread T L
On Saturday, February 4, 2017 at 5:40:25 PM UTC+8, T L wrote: > > > > On Friday, February 3, 2017 at 10:44:26 PM UTC+8, Ian Lance Taylor wrote: >> >> On Fri, Feb 3, 2017 at 5:38 AM, T L wrote: >> > Why does WaitGroup.state method check 64-bit alignment at run time? >> > Why not make the state

Re: [go-nuts] About 64bits alignment

2017-02-04 Thread T L
On Friday, February 3, 2017 at 10:44:26 PM UTC+8, Ian Lance Taylor wrote: > > On Fri, Feb 3, 2017 at 5:38 AM, T L > > wrote: > > Why does WaitGroup.state method check 64-bit alignment at run time? > > Why not make the state field as the first word of WaitGroup struct? > > > > // https://gola

Re: [go-nuts] About 64bits alignment

2017-02-04 Thread T L
On Saturday, February 4, 2017 at 2:51:53 PM UTC+8, Axel Wagner wrote: > > On Sat, Feb 4, 2017 at 5:49 AM, T L > > wrote: > >> On Saturday, February 4, 2017 at 11:03:11 AM UTC+8, Matt Harden wrote: >>> >>> Never mind; I just realized that a WaitGroup is not necessarily at the >>> start of an all

Re: [go-nuts] How to idiomatically display chained errors?

2017-02-04 Thread Sander van Harmelen
Did you check the errors package: https://godoc.org/github.com/pkg/errors ? It offers a great way to wrap chained errors. Sander On 4 Feb 2017, at 09:08, so.qu...@gmail.com wrote: Is there a idiomatic recommendation for generally displaying errors resulting from chained methods? The followin

[go-nuts] How to idiomatically display chained errors?

2017-02-04 Thread so . query
Is there a idiomatic recommendation for generally displaying errors resulting from chained methods? The following would print out "ERROR: Foo() ERROR: Bar() ERROR: stdlib.Func() something went wrong with this standard function call", which feels obviously wrong. func main() { if err := F