Re: [go-nuts] Re: API patterns for a function with a single argument that is rarely needed

2017-07-07 Thread Dave Cheney
Yeah, that's my concern with creating an API which accepts a variadic number of arguments, but strongly encourages you to present at most one. Relying on documentation for thistriction is frankly, lame. Given the set of options, a second function for the uncommon invocation sounds like a reasonabl

Re: [go-nuts] Re: API patterns for a function with a single argument that is rarely needed

2017-07-07 Thread Sam Whited
On Fri, Jul 7, 2017 at 10:24 PM, Dave Cheney wrote: > Iff there is only one possible option and it's only used infrequently, I'd be > inclined to try something like this > > // Foo returns a new Bar > func Foo() Bar > > // FooWithQuxx returns a new Bar using the underlying Quxx > func FooWithQuxx

Re: [go-nuts] Re: API patterns for a function with a single argument that is rarely needed

2017-07-07 Thread Dave Cheney
The variadic pattern is pretty good imo, but it does permit the caller to pass more than 1 value which implies you need to decide on the bahviour (first value wins, last value wins,etc ...), the document and add tests for the possible states. Iff there is only one possible option and it's only

Re: [go-nuts] Will Go 1.9 have entirely concurrent Garbage Collection?

2017-07-07 Thread voidlogic
>"Library functions that used to trigger stop-the-world garbage collection now trigger concurrent garbage collection" I wonder if there is still a way to manually trigger a complete GC pass? I have hundreds of unit benches in my code bases that call runtime.GC() before t.ResetTimer() (and t.Rep

Re: [go-nuts] Re: API patterns for a function with a single argument that is rarely needed

2017-07-07 Thread Sam Whited
On Fri, Jul 7, 2017 at 12:05 PM, peterGo wrote: > Perhaps it's like packages fmt and log: a default output and a user defined > output. For example fmt.Print, fmt.Fprint. I'm starting to think I'm overthinking this (no idea why I'm hung up on this one particular weird API issue) and I should just

[go-nuts] Initializing aliased map

2017-07-07 Thread Kevin Malachowski
Note that the zero value of "aliased" is "nil". If you meant "an empty, newly initialized value" then, as previously mentioned, `make(aliased)` will do it for you, as would `aliased{}`. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubsc

Re: [go-nuts] Initializing aliased map

2017-07-07 Thread Nigel Tao
On Sat, Jul 8, 2017 at 8:08 AM, wrote: > How do I initialize `b` here to have the zero value of `aliased`? To be precise, b is already initialized by default to its zero value, which is nil. If you want a non-nil but empty map, then as Shawn said, you can use "b: make(aliased),". -- You recei

[go-nuts] infinite loop in gotpl

2017-07-07 Thread Andrew Pennebaker
Enjoy, yall! https://play.golang.org/p/SgUnPeiQgE 🐹🤙 -- 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,

Re: [go-nuts] Initializing aliased map

2017-07-07 Thread Shawn Milochik
b: make(aliased) -- 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://groups.google.com/d/opt

[go-nuts] Initializing aliased map

2017-07-07 Thread krishnan . k . iyer
I was coding something and I just realized that I have a rookie question: type aliased map[string]*Concept type element struct { a bool b aliased } temp := &element{ a: false, b: ?? } How do I initialize `b` here to have the zero value of `aliased`? -- You received this me

[go-nuts] [ANN] astitodo: a TODO parser written in GO

2017-07-07 Thread Asticode
Hey guys, I'm happy to announce astitodo, a TODO parser written in GO: https://github.com/asticode/go-astitodo I know most IDEs already parse TODOs but they usually have problems with multi line TODOs, can't parse assignees, etc. This is also a good start for people who want to use AST. Che

[go-nuts] How accurate is the ticker over a long period of time

2017-07-07 Thread Tamás Gulácsi
Why would there be a drift? The ticker does not skew by receivement time, just skips slow receivers. -- 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+

[go-nuts] How accurate is the ticker over a long period of time

2017-07-07 Thread mariusmeschter99
Hey, so I've been running some benchmarks with a ticker in a one-second interval for about 30-40 minutes. For what I could see, it was running without much of a drift. Something tiny in the millisecond area which wouldn't be a problem. However, is there a possibility of a bigger shift occurring

Re: [go-nuts] Re: API patterns for a function with a single argument that is rarely needed

2017-07-07 Thread Sam Whited
On Fri, Jul 7, 2017 at 12:05 PM, peterGo wrote: > Good naming is such a key part of a good API that the use of sterile names > like Foo and Bar during design is doomed to failure. It sure is; my function is not of course actually named "Foo", I just didn't want people to get hung up on the proble

[go-nuts] Re: API patterns for a function with a single argument that is rarely needed

2017-07-07 Thread peterGo
Sam, Good naming is such a key part of a good API that the use of sterile names like Foo and Bar during design is doomed to failure. Perhaps it's like packages fmt and log: a default output and a user defined output. For example fmt.Print, fmt.Fprint. You have two functions. Peter On Friday,

Re: [go-nuts] slow Mod function in math/big, a better way?

2017-07-07 Thread Andy Balholm
That’s normal for languages like Python. The code that is actually running in Python is slow, but library functions are fast, because they are written in C. Andy > On Jul 7, 2017, at 4:51 AM, jeff.templon.nik...@gmail.com wrote: > > Hi > > Exploring Go, 1st project is to port over my favourite

[go-nuts] Re: API patterns for a function with a single argument that is rarely needed

2017-07-07 Thread pierre . curto
Hello, I personally like the variadic version, which is very well described here and here . Le vendredi 7 juillet 2017 17:18:14 UTC+2

[go-nuts] API patterns for a function with a single argument that is rarely needed

2017-07-07 Thread Sam Whited
Hi all, I have an API that I'm not satisfied with and wanted to see what others do. I have a function in my API, the details don't really matter so let's call it Foo and say it returns type Bar (the return type we can't mess with): Foo() Bar Most of the time we have all the information we ne

Re: [go-nuts] Checking for expired certificates

2017-07-07 Thread Shawn Milochik
Happy Friday. https://play.golang.org/p/gU-wTqYqlv -- 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, vi

Re: [go-nuts] Meet the Gogland dev team @ GopherCon

2017-07-07 Thread Sameer Ajmani
Awesome! Looking forward to meeting you all. On Fri, Jul 7, 2017 at 10:13 AM Florin Pățan wrote: > Hi all, > > > As this tweet mentions: > https://twitter.com/GoglandIDE/status/883294868260474880, the Gogland dev > team will be at GopherCon 2017 and they are looking forward to talk with > you. >

[go-nuts] Meet the Gogland dev team @ GopherCon

2017-07-07 Thread Florin Pățan
Hi all, As this tweet mentions: https://twitter.com/GoglandIDE/status/883294868260474880, the Gogland dev team will be at GopherCon 2017 and they are looking forward to talk with you. If you have any feedback, questions or what to learn more about the IDE, make sure to drop by their booth or

[go-nuts] Gophercon Diversity Forum Questionnaire

2017-07-07 Thread Sameer Ajmani
Hello, Gophers, On Saturday, July 15, 3:30pm-4:15pm, the Go team will be hosting a Diversity Forum at the Gophercon community day. It is very important to me, personally, that the Go community be inclusive and welcoming to people of all sorts. I grew up in Texas as the child of Indian immigrants

Re: [go-nuts] does Go memory model guarantee this program always prints 1?

2017-07-07 Thread Marvin Renich
* T L [170707 01:32]: > Then how about this? > > package main > > import "fmt" > import "sync/atomic" > > func main() { > var x, y int32 > go func() { > atomic.AddInt32(&x, 1) > atomic.AddInt32(&y, 1) > }() > > if atomic.LoadInt32(&y) == 1 { > fmt.Pr

[go-nuts] Checking for expired certificates

2017-07-07 Thread gwhelbig via golang-nuts
The golang net/http package currently does not detect an expired SSL certificate. I need to detect and expired certificate (it's used in an http.Put fuction eventually) and report an error (flag the data back from the put as not secure) Any idea how to go about doing this? TIA, Gary. For ex

[go-nuts] slow Mod function in math/big, a better way?

2017-07-07 Thread jeff . templon . nikhef
Hi Exploring Go, 1st project is to port over my favourite playground (prime number factorisation) from Python to Go. Aside: I was a big Oberon-2 fan back in the day, so I'm pretty excited about Go making possible what never was in Oberon. Back to business: I was disappointed that Go is only

Re: [go-nuts] does Go memory model guarantee this program always prints 1?

2017-07-07 Thread peterGo
T L, No: https://github.com/golang/go/issues/19182 Peter On Friday, July 7, 2017 at 5:31:33 AM UTC, T L wrote: > > > > On Friday, July 7, 2017 at 3:26:24 AM UTC+8, Lars Seipel wrote: >> >> On Thu, Jul 06, 2017 at 12:19:05PM -0700, T L wrote: >> > >> > package main >> > >> > import "fmt" >>

Re: [go-nuts] Latency spike during GC

2017-07-07 Thread Francis
When you describe the first and second half of gc are you referring to the mark and sweep phases? -- 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+un

[go-nuts] Re: In which case does compiler not able to get the address of a value?

2017-07-07 Thread Peng
Thanks Dave & TL. Regards, Peng 在 2017年7月7日星期五 UTC+8上午9:44:55,Dave Cheney写道: > > This is a really interesting corner case of the syntactic sugar of the > language. > > The first piece of sugar is that methods are just functions with a > predefined first parameter, or to say that another way, a

[go-nuts] Re: In which case does compiler not able to get the address of a value?

2017-07-07 Thread Peng
Thanks Dave&TL, I understand constant values and literal values are not addressable, from the reference link ( http://www.tapirgames.com/blog/golang-summaries#not-addressable

Re: [go-nuts] How does gccgo compile with my own package imported?

2017-07-07 Thread ajee . cai
Hi Ian, Thanks for your reply. Although I am a seasoned c programmer I am a go beginner. So, is it strange that gccgo can't compile if the main.go imports some non-standard library package? Is it meaning with gccgo, we have to write a single go file to contain everything, or just import only