Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invalid operation: cannot index orderedmap.NewOrderedMap #39

Open
officialasishkumar opened this issue Jun 1, 2024 · 3 comments
Open

Comments

@officialasishkumar
Copy link

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
Copy link
Owner

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

@officialasishkumar
Copy link
Author

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

image

@elliotchance
Copy link
Owner

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants