On Wed, Jan 18, 2023 at 8:08 PM Andrew Athan wrote:
>
> The remaining issue is that, irrespective of the "wideness" of the "any" type
> constraint, which apparently includes non-comparable types, the resolution of
> v's type is to a comparable type, yet the error is still emitted.
The body of t
@Rustam Abdullaev you're a lifesaver!! I was having this same issue with
rising CPU and was going crazy trying to find the resource leak until I saw
your comment - pulled up a heap dump and saw 75% time.NewTicker, found a
dangling ticker I was instantiating in a goroutine, added a defer
ticker.
Ian:
Thanks. The example I posted is a silly uber short simplification of my
usecase. In fact, have a complex struct with a large set of methods and
only one of the methods requires comparable types; it'd be nice to not have
to constrain to comparable at the struct level, and only have actual
By the way, what is the idiomatic way to assert that a variable that is
type constrained as "any" in the generic declaration, is in fact comparable
(if there is a way)?
I.e., in my example "Foo" function, is there a way for me to further
constrain (or rather, assert that) v's type is comparable
Thank you for the practical tip on how to avoid the error. The wording of
the error could be improved, IMHO, and there is a remaining issue I raised
which is not addressed by the suggestion to use the "comparable" constraint
(btw, the documentation I've so far been served up by duckduckgo when
On Wed, Jan 18, 2023 at 6:58 PM Christian Stewart wrote:
>
> On Wed, Jan 18, 2023 at 6:56 PM Ian Lance Taylor wrote:
> > > // IsEmpty checks if the interface is equal to nil.
> > > func IsEmpty[T Block](blk T) bool {
> > > var empty T
> > > return empty == blk
> > > }
> > >
> > > (I had b
On Wed, Jan 18, 2023 at 4:52 PM Andrew Athan wrote:
>
> (Possibly related to issues such as those discussed in
> https://groups.google.com/g/golang-nuts/c/pO2sclKEoQs/m/5JYjveKgCQAJ ?)
>
> If I do:
>
> ```
> func Foo[V any](v V)bool {
> return v==v
> }
> ```
>
> golang 1.19 reports:
>
> ```
> i
Hi Ian, all,
On Wed, Jan 18, 2023 at 6:56 PM Ian Lance Taylor wrote:
> > // IsEmpty checks if the interface is equal to nil.
> > func IsEmpty[T Block](blk T) bool {
> > var empty T
> > return empty == blk
> > }
> >
> > (I had blk Block before, instead of blk T).
> >
> > Comparing with emp
On Wed, Jan 18, 2023 at 6:28 PM 'Christian Stewart' via golang-nuts
wrote:
>
> Thing is an interface in the first example I gave:
>
> If you want to compare two interfaces:
>
> var foo1 Thing
> var foo2 Thing
>
> Ordinarily you can do foo1 == foo2 and it does pointer-wise comparison.
It's true th
Kurtis,
Thing is an interface in the first example I gave:
If you want to compare two interfaces:
var foo1 Thing
var foo2 Thing
Ordinarily you can do foo1 == foo2 and it does pointer-wise comparison.
This absolutely is the case: https://gotipplay.golang.org/p/ODG9xvyVEqs
Now, I understand the
On Wed, Jan 18, 2023 at 5:14 PM 'Christian Stewart' via golang-nuts <
golang-nuts@googlegroups.com> wrote:
> The thing I ran into with this today was, if you want to compare two
> interfaces:
>
> var foo1 Thing
> var foo2 Thing
>
> Ordinarily you can do foo1 == foo2 and it does pointer-wise compar
The thing I ran into with this today was, if you want to compare two interfaces:
var foo1 Thing
var foo2 Thing
Ordinarily you can do foo1 == foo2 and it does pointer-wise comparison.
But in a generic function, as an example:
// IsEmpty checks if the interface is equal to nil.
func IsEmpty[T Blo
On Wed, Jan 18, 2023 at 5:52 PM Andrew Athan wrote:
> (Possibly related to issues such as those discussed in
> https://groups.google.com/g/golang-nuts/c/pO2sclKEoQs/m/5JYjveKgCQAJ ?)
>
> If I do:
>
> ```
> func Foo[V any](v V)bool {
> return v==v
> }
> ```
>
> golang 1.19 reports:
>
> ```
> inv
(Possibly related to issues such as those discussed
in https://groups.google.com/g/golang-nuts/c/pO2sclKEoQs/m/5JYjveKgCQAJ ?)
If I do:
```
func Foo[V any](v V)bool {
return v==v
}
```
golang 1.19 reports:
```
invalid operation: v == v (incomparable types in type set)
```
There are two issu
golang.ru is a good name for such a site, but please keep in mind that the
language itself is called just Go, as the logo itself should make clear.
-rob
On Thu, Jan 19, 2023 at 4:05 AM Ian Lance Taylor wrote:
> On Wed, Jan 18, 2023 at 8:30 AM Василий Рузин wrote:
> >
> > Can I use the Golang
Hi all!
I've got a golang project that uses cgo to interface with an external C
library. So golang builds depend on that library's *.h and *.so files. Is
there a way to tell `gomobile bind` to embed these external shared
libraries into generated Android AAR or iOS Framework files?
Thanks.
--
On Wed, Jan 18, 2023 at 8:30 AM Василий Рузин wrote:
>
> Can I use the Golang logo on my site?
>
> My site will be dedicated to Golang. ( https://golang.ru )
>
> The site will have documentation, articles, videos, vacancies and jobs, free
> training.
>
> Perhaps in the future there will be paid t
Hello.
Can I use the Golang logo on my site?
My site will be dedicated to Golang. ( https://golang.ru )
The site will have documentation, articles, videos, vacancies and jobs,
free training.
Perhaps in the future there will be paid training, but I have not yet
decided whether to do it or not.
Kevin this is brilliant. It Works <3 <3
On Saturday, 4 December 2021 at 04:29:57 UTC+5 Kevin Mathew S wrote:
> This works perfectly for me
>
> func newReq(method, path, body string, vars map[string]string)
> *http.Request {
> r := httptest.NewRequest(method, path, strings.NewReader(body))
> retu
Thanks, solved my problem
在2023年1月17日星期二 UTC+8 00:49:03 写道:
> On Mon, Jan 16, 2023 at 8:43 AM j2gg0s wrote:
> >
> > As a newbie of golang's assembly, i cant understand why we MOVQ DX CX
> twice in runtime.gogo. WHY?
>
> I don't see any MOVQ DX, CX instructions here. Can you clarify by
> saying
20 matches
Mail list logo