dominikbraun / graph

A library for creating generic graph data structures and modifying, analyzing, and visualizing them.
https://graph.dominikbraun.io
Apache License 2.0
1.77k stars 95 forks source link

go1.20.5 type problem #138

Open kangkang333 opened 1 year ago

kangkang333 commented 1 year ago

Cannot use '&directed[K, T]{ hash: hash, traits: traits, store: store, }' (type "github.com/dominikbraun/graph".directed[K, T]) as the type "github.com/dominikbraun/graph".directed[K, T]

dominikbraun commented 1 year ago

Do the new graph versions work for you?

robinje commented 5 months ago

The issue persists in 1.21.5

dominikbraun commented 4 months ago

The issue persists in 1.21.5

@robinje @kangkang333 Interesting that this isn't being catched by the tests, but I would need a more detailed description to reproduce this error. Doesn't v0.23.0 work either?

akzincsystems commented 3 months ago
import (
   dbgraph "github.com/dominikbraun/graph"
)
type Template struct {
   dbg    dbgraph.Graph
}
func (t *Template) DBGraph() {
   t.dbg = dbgraph.New(dbgraph.StringHash, dbgraph.Directed(), dbgraph.PreventCycles())
}

Error on build: cannot use generic type graph.Graph[K comparable, T any] without instantiation. I think this is the same problem as reported by @kangkang333. Using Go V1.21.