Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Go Language Go Language Overview Data Structures Maps

Gina Orton
Gina Orton
1,805 Points

what does the error "missing key in map literal" mean?

I created a main function and within it I created a map named pricelist. To pricelist, I assigned the original pricelist {"OCKOPROG": 89.99, "ALBOÖMME": 129.99, "TRAALLÅ", 49.99}. I then call the HalfPriceSale function and pass it pricelist. When I preview what I've done thus far I am getting an error for the line of code where I've created the pricelist map that states "missing key in map literal". What does this mean and any ideas why I am getting this error?

1 Answer

Steven Parker
Steven Parker
229,732 Points

You might be confusing the validation mechanism. For best results, always follow the instructions and avoid doing anything extra.

For this challenge, you only need to fill in the function body. You won't need a "main" or to define any literals.

Gina Orton
Gina Orton
1,805 Points

I was thrown off by this, "The HalfPriceSale function should receive a map with product name strings as its keys, and corresponding prices as its values, like this:"...which made me think that the HalfPriceSale function was called somewhere else and the map was passed to it.