elliotchance / orderedmap

🔃 An ordered map in Go with amortized O(1) for Set, Get, Delete and Len.
MIT License
817 stars 62 forks source link

invalid operation: cannot index orderedmap.NewOrderedMap #39

Open officialasishkumar opened 3 months ago

officialasishkumar commented 3 months ago

I am trying to migrate to orderedmap. I am getting an error that says

invalid operation: cannot index orderedmap.NewOrderedMap (value of type func() *"github.com/elliotchance/orderedmap".OrderedMap)
newDeps := pkg.Dependencies{
    Deps: orderedmap.NewOrderedMap[string, pkg.Dependency](),
}

My Dependencies looks like:

type Dependencies struct {
    Deps *orderedmap.OrderedMap[string, Dependency] `json:"packages" toml:"dependencies,omitempty"`
}
elliotchance commented 3 months ago

OrderedMap cannot be serialized (ie json encoded) you will need to handle that encoding/decoding yourself

officialasishkumar commented 3 months ago

I removed the json:"packages" toml:"dependencies,omitempty" but I am still getting the same error:

image

elliotchance commented 3 months ago

I did a quick google search and I don't think that's even a Go error, perhaps it's a custom linter or something?