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ö
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
for
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 http
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 gro
I've tried this but srv.TLSConfig is always non-nil.
package main
import (
"log"
"net/http"
"time"
)
func main() {
srv := &http.Server{Addr: ":8080"}
go srv.ListenAndServe()
time.Sleep(25 * time.Millisecond)
if srv.TLSConfig == nil {
log.Println("Started HTTP Server on ", srv.Addr)
} else {
log
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 wrote:
>
> currently all relative directories are completed with the `./` prefix, Does
> it make any problems?
--
You received th
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 wrote:
This is awesome. I've immediately started working on
https://github.com/magiconair/consulcomplete :)
Frank
--
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