Re: [go-nuts] Generic func to transform []*x to []X if *x implements iface X?

2022-08-26 Thread Frank Schröder
Thank you. Are there plans to add a type constraint which would allow this? Maybe something like this? func slice[From implements To, To any](from []From) []To { ... } On Wednesday, August 24, 2022 at 7:30:22 AM UTC+2 Ian Lance Taylor wrote: > On Tue, Aug 23, 2022 at 8:27 PM Frank Schrö

[go-nuts] Generic func to transform []*x to []X if *x implements iface X?

2022-08-23 Thread Frank Schröder
Is it possible to write a generic function which converts a slice of a concrete type to a slice of an interface that type implements? Something like this... // generic version of []*x -> []X (does not compile) func gslice[From interface{ ~To }, To any](from []From) []To { var to []To

Re: [go-nuts] Re: How can I tell if a http.Server has a TLS listener?

2017-05-24 Thread Frank Schröder
Only for exported types. tls.listener isn't -- 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] Re: How can I tell if a http.Server has a TLS listener?

2017-05-24 Thread Frank Schröder
This works but it is somewhat ugly ... // l is either a tls.listener or a TCPListener if strings.Contains("*tls.listener", fmt.Sprintf("%T", l)) { srv.proto = "https" } -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this

[go-nuts] How can I tell if a http.Server has a TLS listener?

2017-05-24 Thread Frank Schröder
I've tried this but srv.TLSConfig is always non-nil. package main import ( "log" "net/http" "time" ) func main() { srv := {Addr: ":8080"} go srv.ListenAndServe() time.Sleep(25 * time.Millisecond) if srv.TLSConfig == nil { log.Println("Started HTTP Server on ", srv.Addr) } else {

Re: [go-nuts] New fully featured bash completion for go - written in go

2017-05-14 Thread Frank Schröder
It's not how other completions work, it's redundant and makes it harder to read. Frank Schröder > On 14. May 2017, at 09:04, Eyal Posener <pose...@gmail.com> wrote: > > currently all relative directories are completed with the `./` prefix, Does > it make any problems?

Re: [go-nuts] New fully featured bash completion for go - written in go

2017-05-14 Thread Frank Schröder
I'll look into this. So far I've spent 30 min on this. :) which dir pattern should I use for directory completions so that the suggestions don't start with ./ ? Eg consul agent -server -data-dir ./data Frank Schröder > On 14. May 2017, at 07:46, Eyal Posener <pose...@gmail.com&