{"componentChunkName":"component---src-templates-tag-js","path":"/tags/maps/","result":{"data":{"site":{"siteMetadata":{"title":"LoginRadius Blog"}},"allMarkdownRemark":{"totalCount":1,"edges":[{"node":{"fields":{"slug":"/engineering/golang-maps/"},"html":"<p>Golang Maps is a compilation of unordered key-value pairs. It is commonly used because it offers simple searches and values with the aid of keys that can be retrieved, modified or deleted. It is a reference to a table with a hash.</p>\n<p>This blog will cover the basic use of maps in Go, and how a newcomer to the language may utilize them for their applications.</p>\n<h2 id=\"what-is-a-map\" style=\"position:relative;\"><a href=\"#what-is-a-map\" aria-label=\"what is a map permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What is a Map?</h2>\n<p>Maps (also called dictionaries) are a very useful tool in helping to store and organize objects to be accessed in an efficient method. </p>\n<p>Most basic implementations of a map involve using a key to access a value in the map, resulting in key-value pairs, in which one key is associated with a specific value in the map. Within Golang, maps follow this definition.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 66.61538461538463%; position: relative; bottom: 0; left: 0; background-image: url('data:image/jpeg;base64,/9j/2wBDABALDA4MChAODQ4SERATGCgaGBYWGDEjJR0oOjM9PDkzODdASFxOQERXRTc4UG1RV19iZ2hnPk1xeXBkeFxlZ2P/2wBDARESEhgVGC8aGi9jQjhCY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2P/wgARCAANABQDASIAAhEBAxEB/8QAGAAAAwEBAAAAAAAAAAAAAAAAAAUGAQP/xAAVAQEBAAAAAAAAAAAAAAAAAAAAAf/aAAwDAQACEAMQAAABX9m+SypSB//EABsQAAIDAAMAAAAAAAAAAAAAAAEDAAITBBEh/9oACAEBAAEFAlLLCeKzozPzG0yqJ//EABQRAQAAAAAAAAAAAAAAAAAAABD/2gAIAQMBAT8BP//EABQRAQAAAAAAAAAAAAAAAAAAABD/2gAIAQIBAT8BP//EAB8QAAEDAwUAAAAAAAAAAAAAAAABAhEQEiEiMTNxkf/aAAgBAQAGPwKGk4poWzo5XGyeH//EABsQAAICAwEAAAAAAAAAAAAAAAERACExQWFx/9oACAEBAAE/IS4LWXqNdPZQzRbyouEoVXghqEnUn//aAAwDAQACAAMAAAAQI8//xAAVEQEBAAAAAAAAAAAAAAAAAAAAEf/aAAgBAwEBPxBH/8QAFxEAAwEAAAAAAAAAAAAAAAAAAAERQf/aAAgBAgEBPxBTSn//xAAdEAEAAgICAwAAAAAAAAAAAAABABEhMUGhYYGR/9oACAEBAAE/EB6oWlQPLKixTjdr1AKICNMyasFjP0QgDBrf1GrDyrHqf//Z'); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"Dictionary\"\n        title=\"Dictionary\"\n        src=\"/static/d9d54b7f1e01c89b7af93a3e87f2eec9/212bf/dictionary.jpg\"\n        srcset=\"/static/d9d54b7f1e01c89b7af93a3e87f2eec9/6aca1/dictionary.jpg 650w,\n/static/d9d54b7f1e01c89b7af93a3e87f2eec9/212bf/dictionary.jpg 768w,\n/static/d9d54b7f1e01c89b7af93a3e87f2eec9/670dc/dictionary.jpg 1650w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<h2 id=\"how-to-create-a-map\" style=\"position:relative;\"><a href=\"#how-to-create-a-map\" aria-label=\"how to create a map permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>How to create a map?</h2>\n<p>Initialization of a map can be done using the <code>make</code> command. This is similar to the initialization of a slice:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"go\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk12\">mapObject</span><span class=\"mtk1\"> := </span><span class=\"mtk11\">make</span><span class=\"mtk1\">(</span><span class=\"mtk4\">map</span><span class=\"mtk1\">[</span><span class=\"mtk10\">string</span><span class=\"mtk1\">]</span><span class=\"mtk10\">string</span><span class=\"mtk1\">)</span></span></code></pre>\n<p>In this case, <code>mapObject</code> is a map that uses strings as a key to map to another string. When creating a map, the key type must be a type that is <code>Comparable</code>, or more specifically types that can be compared using the <code>==</code> operator.</p>\n<p>Examples of valid key types include booleans, numbers, strings and several other primitives can be used as keys. </p>\n<p>One more thing to note is that structs can be used as a key, provided that all the properties of the struct are <code>Comparable</code>.</p>\n<p>Maps can also be created using a map literal. For an empty map:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"go\" data-index=\"1\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk12\">mapObject</span><span class=\"mtk1\"> := </span><span class=\"mtk4\">map</span><span class=\"mtk1\">[</span><span class=\"mtk10\">string</span><span class=\"mtk1\">]</span><span class=\"mtk10\">string</span><span class=\"mtk1\">{}</span></span></code></pre>\n<p>Or for a map with initial data:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"go\" data-index=\"2\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk12\">mapObject</span><span class=\"mtk1\"> := </span><span class=\"mtk4\">map</span><span class=\"mtk1\">[</span><span class=\"mtk10\">string</span><span class=\"mtk1\">]</span><span class=\"mtk10\">string</span><span class=\"mtk1\">{</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">\t“Key1”: “Value1”,</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">\t“Key2”: “Value2”,</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">\t“Key3”: “Value3”,</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<h2 id=\"how-to-use-go-maps-with-examples\" style=\"position:relative;\"><a href=\"#how-to-use-go-maps-with-examples\" aria-label=\"how to use go maps with examples permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>How to use Go Maps (with Examples)</h2>\n<h3 id=\"setting\" style=\"position:relative;\"><a href=\"#setting\" aria-label=\"setting permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Setting</h3>\n<p>Interaction with Go maps are similar to the dictionaries and maps of other languages. A simple way to return a value associated with the key is to use bracket notation. For example, to set a string value mapped to a string key:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"go\" data-index=\"3\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">mapObject[“test”] = “test_value”</span></span></code></pre>\n<h3 id=\"fetching\" style=\"position:relative;\"><a href=\"#fetching\" aria-label=\"fetching permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Fetching</h3>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 56.30769230769231%; position: relative; bottom: 0; left: 0; background-image: url('data:image/jpeg;base64,/9j/2wBDABALDA4MChAODQ4SERATGCgaGBYWGDEjJR0oOjM9PDkzODdASFxOQERXRTc4UG1RV19iZ2hnPk1xeXBkeFxlZ2P/2wBDARESEhgVGC8aGi9jQjhCY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2P/wgARCAALABQDASIAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAgD/xAAWAQEBAQAAAAAAAAAAAAAAAAABAAT/2gAMAwEAAhADEAAAAQGs4Km//8QAGBAAAwEBAAAAAAAAAAAAAAAAAAEREEH/2gAIAQEAAQUC5XREz//EABQRAQAAAAAAAAAAAAAAAAAAABD/2gAIAQMBAT8BP//EABQRAQAAAAAAAAAAAAAAAAAAABD/2gAIAQIBAT8BP//EABYQAQEBAAAAAAAAAAAAAAAAAAEAIP/aAAgBAQAGPwKTP//EABoQAQEAAgMAAAAAAAAAAAAAAAEAETEhcaH/2gAIAQEAAT8hHoxlhny4dkSQ7Jv/2gAMAwEAAgADAAAAECvP/8QAFBEBAAAAAAAAAAAAAAAAAAAAEP/aAAgBAwEBPxA//8QAFhEBAQEAAAAAAAAAAAAAAAAAARAR/9oACAECAQE/ENCf/8QAGxABAAICAwAAAAAAAAAAAAAAAQAhETFBUWH/2gAIAQEAAT8QJougqFIABOURMiPpNrEuwU7IAan/2Q=='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"Fetching\"\n        title=\"Fetching\"\n        src=\"/static/292ea3839b19a996d8a3c5aea66193b0/212bf/fetching.jpg\"\n        srcset=\"/static/292ea3839b19a996d8a3c5aea66193b0/6aca1/fetching.jpg 650w,\n/static/292ea3839b19a996d8a3c5aea66193b0/212bf/fetching.jpg 768w,\n/static/292ea3839b19a996d8a3c5aea66193b0/1cf64/fetching.jpg 1778w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<p>Retrieving a value uses the same format.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"go\" data-index=\"4\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk12\">result</span><span class=\"mtk1\"> := mapObject[“test”]</span></span></code></pre>\n<p>The value of <code>result</code> will be the value assigned to <code>“test”</code> in the map. In the case where no key is found, the zero value of the type is returned instead. In this case, if there is no associated value with <code>“test”</code>, an empty string is returned.</p>\n<p>A boolean that returns the key’s existence can also be returned if two arguments are assigned from the retrieval. For example:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"go\" data-index=\"5\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk12\">result</span><span class=\"mtk1\">, </span><span class=\"mtk12\">exists</span><span class=\"mtk1\"> := mapObject[“test”]</span></span></code></pre>\n<p>If <code>“test”</code> exists in the map, <code>result</code> will be the value associated with <code>“test”</code> and <code>exists</code> will be true. If <code>“test”</code> does not exist, <code>result</code> will be an empty string and <code>exists</code> will be false. This is useful when the map being used contains zero-values to distinguish between existence or whether the value is just zero.</p>\n<h3 id=\"deleting\" style=\"position:relative;\"><a href=\"#deleting\" aria-label=\"deleting permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Deleting</h3>\n<p>Using Go’s built in delete method, key-value pairs can be deleted off the map. To delete the previous <code>“test”</code> key from the map, the following can be called:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"go\" data-index=\"6\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk11\">delete</span><span class=\"mtk1\">(mapObject, </span><span class=\"mtk8\">&quot;test&quot;</span><span class=\"mtk1\">)</span></span></code></pre>\n<p>The delete method does not have a return value, so if the key does not exist in the map, nothing will happen.\nLength</p>\n<p>The number of key-value pairs of a map can be found using the len method:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"go\" data-index=\"7\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk12\">length</span><span class=\"mtk1\"> := </span><span class=\"mtk11\">len</span><span class=\"mtk1\">(mapObject)</span></span></code></pre>\n<h3 id=\"iterating\" style=\"position:relative;\"><a href=\"#iterating\" aria-label=\"iterating permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Iterating</h3>\n<p>Using Go’s range keyword, a map can be iterated through.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"go\" data-index=\"8\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk15\">for</span><span class=\"mtk1\"> </span><span class=\"mtk12\">key</span><span class=\"mtk1\">, </span><span class=\"mtk12\">value</span><span class=\"mtk1\"> := </span><span class=\"mtk15\">range</span><span class=\"mtk1\"> m {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    fmt.</span><span class=\"mtk11\">Println</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;Key:&quot;</span><span class=\"mtk1\">, key, </span><span class=\"mtk8\">&quot;Value:&quot;</span><span class=\"mtk1\">, value)</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p>There is no specific order in which the map is iterated. If a specific order is needed, a slice or other data structure can be used to store or hold data which can then be sorted and iterated through.</p>\n<h3 id=\"concurrency\" style=\"position:relative;\"><a href=\"#concurrency\" aria-label=\"concurrency permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Concurrency</h3>\n<p>Although Go has a lot of support for concurrency through the use of goroutines and channels, maps alone are not a reliable approach to handling data in a concurrent setting. </p>\n<p>To work with maps that support concurrency, a separate synchronization method should be used, like <code>sync.RWMutex</code>. Alternatively, an open source map package which implements the synchronizations can be used.</p>\n<h2 id=\"conclusion\" style=\"position:relative;\"><a href=\"#conclusion\" aria-label=\"conclusion permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Conclusion</h2>\n<p>With the market space and number of applications being created by Go increasing, hopefully this blog will help touch onto the basics of one of the major structures in Go.</p>\n<p>Although it doesn’t support concurrency, maps in Go are still a useful tool in most applications developed in Go, to reliably access and manage data.</p>\n<p>If you want to learn more about golang here is a quick guide on, <a href=\"/sending-emails-with-golang/\">how to send email with golang</a>. If you like what you read leave a comment or any question and will communicate further. </p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n  .dark-default-dark .mtk12 { color: #9CDCFE; }\n  .dark-default-dark .mtk1 { color: #D4D4D4; }\n  .dark-default-dark .mtk11 { color: #DCDCAA; }\n  .dark-default-dark .mtk4 { color: #569CD6; }\n  .dark-default-dark .mtk10 { color: #4EC9B0; }\n  .dark-default-dark .mtk8 { color: #CE9178; }\n  .dark-default-dark .mtk15 { color: #C586C0; }\n</style>","frontmatter":{"date":"September 25, 2020","updated_date":null,"title":"Golang Maps - A Beginner’s Guide","tags":["Go","dictionaries","maps"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1.5037593984962405,"src":"/static/30bb9b9901e76f3498d68913a0675ea9/ee604/index.png","srcSet":"/static/30bb9b9901e76f3498d68913a0675ea9/69585/index.png 200w,\n/static/30bb9b9901e76f3498d68913a0675ea9/497c6/index.png 400w,\n/static/30bb9b9901e76f3498d68913a0675ea9/ee604/index.png 800w,\n/static/30bb9b9901e76f3498d68913a0675ea9/f3583/index.png 1200w,\n/static/30bb9b9901e76f3498d68913a0675ea9/0dadc/index.png 1500w","sizes":"(max-width: 800px) 100vw, 800px"}}},"author":{"id":"Chris Yee","github":null,"avatar":null}}}}]}},"pageContext":{"tag":"maps"}},"staticQueryHashes":["1171199041","1384082988","2100481360","23180105","528864852"]}