Re: [go-nuts] The usage of method call syntax for regular functions as a way to have "generic methods"

2024-10-28 Thread 'Axel Wagner' via golang-nuts
The chained syntax does not contain a package name. There are three possibilities 1. It only works if the function is defined in the same package as its used, or you'd need to use dot-imports. Neither is likely to be acceptable. 2. There would be an ambiguity, if multiple imported packages define a

[go-nuts] The usage of method call syntax for regular functions as a way to have "generic methods"

2024-10-28 Thread Mark Mavzon
As we all know Go doesn't have generic methods. The FAQ states: * "We do not anticipate that Go will ever add generic methods".* Also the FAQ lists 4 options out of which the last one seems reasonable: * Define that generic methods cannot be used to satisfy

Re: [go-nuts] HTML templates - recommendations to unset ?

2024-10-28 Thread Harmen
On Mon, Oct 28, 2024 at 02:15:05PM +0200, Marc Coquand wrote: > > Hey! > > Currently I use gin as my framework and write my HTML markup together > with go templates. > > It happens every so often that I miss to set variables, and so I was > wondering if there are any best practices or tooling to

Re: [go-nuts] Can not convert a generic struct type to a generic interface type in golang

2024-10-28 Thread Jason Phillips
And by "interface signatures" I of course meant method signatures in the corresponding interface method sets. On Monday, October 28, 2024 at 4:39:35 PM UTC-4 Jason Phillips wrote: > The Go FAQ has another, perhaps slightly more applicable, entry: > > https://go.dev/doc/faq#t_and_equal_interface

Re: [go-nuts] Can not convert a generic struct type to a generic interface type in golang

2024-10-28 Thread Jason Phillips
The Go FAQ has another, perhaps slightly more applicable, entry: https://go.dev/doc/faq#t_and_equal_interface Basically, even though *packet satisfies the Packet interface, interface { Get() *packet } Is different than interface { Get() Packet } And one isn't d

[go-nuts] Re: HTML templates - recommendations to unset ?

2024-10-28 Thread Nico Braun
On Monday 28 October 2024 at 13:47:38 UTC+1 Marc Coquand wrote: > I was wondering if there are any best practices or tooling to help you > make sure that all variables are set? You can pass an the "missingkey=error" option to the template. See https://pkg.go.dev/html/template#Template.Option. --

Re: [go-nuts] Can not convert a generic struct type to a generic interface type in golang

2024-10-28 Thread Marvin Renich
* Log4bob [241028 08:47]: > > > Given there's a generic interface: > type Packet interface { Content() int } type Recycler[T any] interface { > Get() *T } > > and their implementation: > type packet struct { content int } type BaseRecycler[T any] struct { t T } > > its impossible to convert

[go-nuts] Can not convert a generic struct type to a generic interface type in golang

2024-10-28 Thread Log4bob
Given there's a generic interface: type Packet interface { Content() int } type Recycler[T any] interface { Get() *T } and their implementation: type packet struct { content int } type BaseRecycler[T any] struct { t T } its impossible to convert the implementation to the interface: r := &Bas

[go-nuts] HTML templates - recommendations to unset ?

2024-10-28 Thread Marc Coquand
Hey! Currently I use gin as my framework and write my HTML markup together with go templates. It happens every so often that I miss to set variables, and so I was wondering if there are any best practices or tooling to help you make sure that all variables are set? Thanks, Marc -- You receiv

[go-nuts] Are you actively using fuzz testing?

2024-10-28 Thread Alex Pliutau
Do you use fuzz testing, and if yes, what are you testing with it? Our latest article shows how to do fuzz testing in Go, specifically for HTTP services. https://packagemain.tech/p/fuzzing-http-services-golang -- You received this message because you are subscribed to the Google Groups "golang

[go-nuts] sync.Pool wrapper with stats

2024-10-28 Thread Diego Augusto Molina
Hi, everyone! Thank you for reading. I wanted to share a pet project I started a few weeks ago in my free time, it's a wrapper around sync.Pool that has limited set of online statistics about the memory cost (arbitrarily defined by the user) for two reasons: (1) to know whether it wants it or n