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

using EnvironmentResult #94

Closed
dodizzle opened this issue Jun 6, 2017 · 1 comment
Closed

using EnvironmentResult #94

dodizzle opened this issue Jun 6, 2017 · 1 comment

Comments

@dodizzle
Copy link

dodizzle commented Jun 6, 2017

I'm hoping to use Environments.List to simply list all of the environments.
It appears that the EnvironmentsResult object is of the type map[string]string
However when I attempt to access it via:

environments, err := client.Environments.List()
fmt.Println(environments["foo"])

I get this error
"invalid operation: environments["foo"] (type *chef.EnvironmentResult does not support indexing)"

I am new to go so maybe I am not using correctly.
Is EnvironmentsResult not a map?

@spheromak
Copy link
Member

the result is a pointer, and you probably need to deref the pointer to get at the key fmt.Println(*environments["foo"])

The error from the compiler could be easier here, but it is effectively saying pointers aren't maps :)

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