[{"data":1,"prerenderedAt":2154},["ShallowReactive",2],{"blog-golang-maps":3,"blog-all-for-related":1660},{"id":4,"title":5,"author":6,"body":7,"cardAlt":5,"categories":1645,"description":1648,"draft":1649,"extension":1650,"headerImage":1651,"keywords":1652,"meta":1653,"name":1654,"navigation":185,"path":1655,"seo":1656,"series":6,"stem":1657,"updated":6,"year":1658,"__hash__":1659},"blog\u002Fblog\u002Fgolang-maps.md","Learn Maps in Golang (with examples)",null,{"type":8,"value":9,"toc":1632},"minimark",[10,14,17,1628],[11,12,13],"p",{},"In this article, we will be covering the basics of map. We will cover how to create maps, add and remove items, iterating through them and even explore equality in maps. After this, you will be ready to use maps in your Golang programs.",[11,15,16],{},"Let’s begin!",[18,19,20,23,28,31,33,37,40,45,94,105,141,151,225,229,236,359,362,391,393,397,400,415,418,525,528,552,558,560,564,571,584,587,712,714,718,724,733,836,838,842,845,1066,1069,1102,1104,1108,1131,1138,1278,1280,1284,1291,1448,1451,1499],"ads",{},[21,22],"hr",{},[24,25,27],"h2",{"id":26},"what-is-a-map","What is a map?",[11,29,30],{},"A map is basically a collection of key-value pairs. If you are coming from Python, map is basically a dictionary. Maps are used for fast lookups, retrieval, and deletion of data using the keys. Each key in a map is unique and acts as a identifier to retrieve values. In Golang, maps are a built-in datatype and they are unordered.",[21,32],{},[24,34,36],{"id":35},"creating-maps","Creating maps",[11,38,39],{},"Creating maps in go is pretty straightforward. Here we see how to declare and initialise maps.",[41,42,44],"h3",{"id":43},"declaration","Declaration",[46,47,52],"pre",{"className":48,"code":49,"language":50,"meta":51,"style":51},"language-go shiki shiki-themes github-light github-dark","\u002F\u002F Declaring a map\nvar name_of_map map[key_datatype]value_datatype{}\n","go","",[53,54,55,64],"code",{"__ignoreMap":51},[56,57,60],"span",{"class":58,"line":59},"line",1,[56,61,63],{"class":62},"sJ8bj","\u002F\u002F Declaring a map\n",[56,65,67,71,75,78,81,85,88,91],{"class":58,"line":66},2,[56,68,70],{"class":69},"szBVR","var",[56,72,74],{"class":73},"sVt8B"," name_of_map ",[56,76,77],{"class":69},"map",[56,79,80],{"class":73},"[",[56,82,84],{"class":83},"sScJk","key_datatype",[56,86,87],{"class":73},"]",[56,89,90],{"class":83},"value_datatype",[56,92,93],{"class":73},"{}\n",[11,95,96,97,100,101,104],{},"Here’s an example where we create a map with ",[53,98,99],{},"string"," keys and ",[53,102,103],{},"integer"," value.",[46,106,108],{"className":48,"code":107,"language":50,"meta":51,"style":51},"\u002F\u002F userAge is a map which stores age of person.\n\u002F\u002F Name as key and Age as value.\nvar userAge map[string]int{}\n",[53,109,110,115,120],{"__ignoreMap":51},[56,111,112],{"class":58,"line":59},[56,113,114],{"class":62},"\u002F\u002F userAge is a map which stores age of person.\n",[56,116,117],{"class":58,"line":66},[56,118,119],{"class":62},"\u002F\u002F Name as key and Age as value.\n",[56,121,123,125,128,130,132,134,136,139],{"class":58,"line":122},3,[56,124,70],{"class":69},[56,126,127],{"class":73}," userAge ",[56,129,77],{"class":69},[56,131,80],{"class":73},[56,133,99],{"class":69},[56,135,87],{"class":73},[56,137,138],{"class":69},"int",[56,140,93],{"class":73},[11,142,143,144,147,148,150],{},"Go provides another way to declare maps with the ",[53,145,146],{},"make"," function. We create similar map as before but with ",[53,149,146],{}," command.",[46,152,154],{"className":48,"code":153,"language":50,"meta":51,"style":51},"\u002F\u002F Create map using make keyword\nmake(map[key_datatype]value_datatype)\n\n\u002F\u002F Example\nuserAge := make(map[string]int)\n\u002F\u002F fmt.Println(userAge) -> map[]\n",[53,155,156,161,181,187,193,219],{"__ignoreMap":51},[56,157,158],{"class":58,"line":59},[56,159,160],{"class":62},"\u002F\u002F Create map using make keyword\n",[56,162,163,165,168,170,172,174,176,178],{"class":58,"line":66},[56,164,146],{"class":83},[56,166,167],{"class":73},"(",[56,169,77],{"class":69},[56,171,80],{"class":73},[56,173,84],{"class":83},[56,175,87],{"class":73},[56,177,90],{"class":83},[56,179,180],{"class":73},")\n",[56,182,183],{"class":58,"line":122},[56,184,186],{"emptyLinePlaceholder":185},true,"\n",[56,188,190],{"class":58,"line":189},4,[56,191,192],{"class":62},"\u002F\u002F Example\n",[56,194,196,199,202,205,207,209,211,213,215,217],{"class":58,"line":195},5,[56,197,198],{"class":73},"userAge ",[56,200,201],{"class":69},":=",[56,203,204],{"class":83}," make",[56,206,167],{"class":73},[56,208,77],{"class":69},[56,210,80],{"class":73},[56,212,99],{"class":69},[56,214,87],{"class":73},[56,216,138],{"class":69},[56,218,180],{"class":73},[56,220,222],{"class":58,"line":221},6,[56,223,224],{"class":62},"\u002F\u002F fmt.Println(userAge) -> map[]\n",[41,226,228],{"id":227},"initialisation","Initialisation",[11,230,231,232,235],{},"Now, we can initialise a key value pair in ",[53,233,234],{},"userAge"," map simply by separating with commas.",[46,237,239],{"className":48,"code":238,"language":50,"meta":51,"style":51},"package main\n\nimport (\n    “fmt”\n)\n\nfunc main() {\n    var userAge = map[string]int{\n        “mohit”:   24,\n        “nidhi”:   21,\n    }\n    fmt.Println(userAge)\n}\n",[53,240,241,249,253,261,266,270,274,286,311,324,335,341,353],{"__ignoreMap":51},[56,242,243,246],{"class":58,"line":59},[56,244,245],{"class":69},"package",[56,247,248],{"class":83}," main\n",[56,250,251],{"class":58,"line":66},[56,252,186],{"emptyLinePlaceholder":185},[56,254,255,258],{"class":58,"line":122},[56,256,257],{"class":69},"import",[56,259,260],{"class":73}," (\n",[56,262,263],{"class":58,"line":189},[56,264,265],{"class":73},"    “fmt”\n",[56,267,268],{"class":58,"line":195},[56,269,180],{"class":73},[56,271,272],{"class":58,"line":221},[56,273,186],{"emptyLinePlaceholder":185},[56,275,277,280,283],{"class":58,"line":276},7,[56,278,279],{"class":69},"func",[56,281,282],{"class":83}," main",[56,284,285],{"class":73},"() {\n",[56,287,289,292,294,297,300,302,304,306,308],{"class":58,"line":288},8,[56,290,291],{"class":69},"    var",[56,293,127],{"class":73},[56,295,296],{"class":69},"=",[56,298,299],{"class":69}," map",[56,301,80],{"class":73},[56,303,99],{"class":69},[56,305,87],{"class":73},[56,307,138],{"class":69},[56,309,310],{"class":73},"{\n",[56,312,314,317,321],{"class":58,"line":313},9,[56,315,316],{"class":73},"        “mohit”:   ",[56,318,320],{"class":319},"sj4cs","24",[56,322,323],{"class":73},",\n",[56,325,327,330,333],{"class":58,"line":326},10,[56,328,329],{"class":73},"        “nidhi”:   ",[56,331,332],{"class":319},"21",[56,334,323],{"class":73},[56,336,338],{"class":58,"line":337},11,[56,339,340],{"class":73},"    }\n",[56,342,344,347,350],{"class":58,"line":343},12,[56,345,346],{"class":73},"    fmt.",[56,348,349],{"class":83},"Println",[56,351,352],{"class":73},"(userAge)\n",[56,354,356],{"class":58,"line":355},13,[56,357,358],{"class":73},"}\n",[11,360,361],{},"Output for above code will be -",[46,363,365],{"className":48,"code":364,"language":50,"meta":51,"style":51},"map[mohit:24 nidhi:21]\n",[53,366,367],{"__ignoreMap":51},[56,368,369,371,373,376,379,381,384,386,388],{"class":58,"line":59},[56,370,77],{"class":69},[56,372,80],{"class":73},[56,374,375],{"class":83},"mohit",[56,377,378],{"class":73},":",[56,380,320],{"class":319},[56,382,383],{"class":83}," nidhi",[56,385,378],{"class":73},[56,387,332],{"class":319},[56,389,390],{"class":73},"]\n",[21,392],{},[24,394,396],{"id":395},"adding-key-value-to-map","Adding key-value to map",[11,398,399],{},"We can add kay-value pair to map using -",[46,401,403],{"className":48,"code":402,"language":50,"meta":51,"style":51},"your_map_name[key] = value\n",[53,404,405],{"__ignoreMap":51},[56,406,407,410,412],{"class":58,"line":59},[56,408,409],{"class":73},"your_map_name[key] ",[56,411,296],{"class":69},[56,413,414],{"class":73}," value\n",[11,416,417],{},"Here we declare a map and then add 2 key-value pair to it.",[46,419,421],{"className":48,"code":420,"language":50,"meta":51,"style":51},"package main\n\nimport (\n    “fmt”\n)\n\nfunc main() {\n    \u002F\u002F Declare a map\n    userAge := make(map[string]int)\n    \u002F\u002F Add key “mohit” with value 24\n    userAge[“mohit”] = 24\n    userAge[“nidhi”] = 21\n    fmt.Println(userAge)\n}\n",[53,422,423,429,433,439,443,447,451,459,464,487,492,502,512,520],{"__ignoreMap":51},[56,424,425,427],{"class":58,"line":59},[56,426,245],{"class":69},[56,428,248],{"class":83},[56,430,431],{"class":58,"line":66},[56,432,186],{"emptyLinePlaceholder":185},[56,434,435,437],{"class":58,"line":122},[56,436,257],{"class":69},[56,438,260],{"class":73},[56,440,441],{"class":58,"line":189},[56,442,265],{"class":73},[56,444,445],{"class":58,"line":195},[56,446,180],{"class":73},[56,448,449],{"class":58,"line":221},[56,450,186],{"emptyLinePlaceholder":185},[56,452,453,455,457],{"class":58,"line":276},[56,454,279],{"class":69},[56,456,282],{"class":83},[56,458,285],{"class":73},[56,460,461],{"class":58,"line":288},[56,462,463],{"class":62},"    \u002F\u002F Declare a map\n",[56,465,466,469,471,473,475,477,479,481,483,485],{"class":58,"line":313},[56,467,468],{"class":73},"    userAge ",[56,470,201],{"class":69},[56,472,204],{"class":83},[56,474,167],{"class":73},[56,476,77],{"class":69},[56,478,80],{"class":73},[56,480,99],{"class":69},[56,482,87],{"class":73},[56,484,138],{"class":69},[56,486,180],{"class":73},[56,488,489],{"class":58,"line":326},[56,490,491],{"class":62},"    \u002F\u002F Add key “mohit” with value 24\n",[56,493,494,497,499],{"class":58,"line":337},[56,495,496],{"class":73},"    userAge[“mohit”] ",[56,498,296],{"class":69},[56,500,501],{"class":319}," 24\n",[56,503,504,507,509],{"class":58,"line":343},[56,505,506],{"class":73},"    userAge[“nidhi”] ",[56,508,296],{"class":69},[56,510,511],{"class":319}," 21\n",[56,513,514,516,518],{"class":58,"line":355},[56,515,346],{"class":73},[56,517,349],{"class":83},[56,519,352],{"class":73},[56,521,523],{"class":58,"line":522},14,[56,524,358],{"class":73},[11,526,527],{},"Output for above code will be same as before -",[46,529,530],{"className":48,"code":364,"language":50,"meta":51,"style":51},[53,531,532],{"__ignoreMap":51},[56,533,534,536,538,540,542,544,546,548,550],{"class":58,"line":59},[56,535,77],{"class":69},[56,537,80],{"class":73},[56,539,375],{"class":83},[56,541,378],{"class":73},[56,543,320],{"class":319},[56,545,383],{"class":83},[56,547,378],{"class":73},[56,549,332],{"class":319},[56,551,390],{"class":73},[11,553,554,555],{},"We can update a key value pair same way as we add. Example - ",[53,556,557],{},"userAge[“mohit”] = 20",[21,559],{},[24,561,563],{"id":562},"removing-key-from-map","Removing key from map",[11,565,566,567,570],{},"We can delete a key-value from map using the ",[53,568,569],{},"delete()"," function",[46,572,574],{"className":48,"code":573,"language":50,"meta":51,"style":51},"delete(your_map_name, key_name)\n",[53,575,576],{"__ignoreMap":51},[56,577,578,581],{"class":58,"line":59},[56,579,580],{"class":83},"delete",[56,582,583],{"class":73},"(your_map_name, key_name)\n",[11,585,586],{},"An example for this -",[46,588,590],{"className":48,"code":589,"language":50,"meta":51,"style":51},"package main\n\nimport (\n    “fmt”\n)\n\nfunc main() {\n    \u002F\u002F Declare a map\n    userAge := make(map[string]int)\n    \u002F\u002F Add key “mohit” with value 24\n    userAge[“mohit”] = 24\n    userAge[“nidhi”] = 21\n    fmt.Println(“Before delete”, userAge)\n    delete(userAge, “mohit”)\n    fmt.Println(“After delete”, userAge)\n}\n",[53,591,592,598,602,608,613,617,621,629,633,656,661,670,679,689,697,707],{"__ignoreMap":51},[56,593,594,596],{"class":58,"line":59},[56,595,245],{"class":69},[56,597,248],{"class":83},[56,599,600],{"class":58,"line":66},[56,601,186],{"emptyLinePlaceholder":185},[56,603,604,606],{"class":58,"line":122},[56,605,257],{"class":69},[56,607,260],{"class":73},[56,609,610],{"class":58,"line":189},[56,611,612],{"class":73},"    “fmt”\n",[56,614,615],{"class":58,"line":195},[56,616,180],{"class":73},[56,618,619],{"class":58,"line":221},[56,620,186],{"emptyLinePlaceholder":185},[56,622,623,625,627],{"class":58,"line":276},[56,624,279],{"class":69},[56,626,282],{"class":83},[56,628,285],{"class":73},[56,630,631],{"class":58,"line":288},[56,632,463],{"class":62},[56,634,635,638,640,642,644,646,648,650,652,654],{"class":58,"line":313},[56,636,637],{"class":73},"    userAge ",[56,639,201],{"class":69},[56,641,204],{"class":83},[56,643,167],{"class":73},[56,645,77],{"class":69},[56,647,80],{"class":73},[56,649,99],{"class":69},[56,651,87],{"class":73},[56,653,138],{"class":69},[56,655,180],{"class":73},[56,657,658],{"class":58,"line":326},[56,659,660],{"class":62},"    \u002F\u002F Add key “mohit” with value 24\n",[56,662,663,666,668],{"class":58,"line":337},[56,664,665],{"class":73},"    userAge[“mohit”] ",[56,667,296],{"class":69},[56,669,501],{"class":319},[56,671,672,675,677],{"class":58,"line":343},[56,673,674],{"class":73},"    userAge[“nidhi”] ",[56,676,296],{"class":69},[56,678,511],{"class":319},[56,680,681,684,686],{"class":58,"line":355},[56,682,683],{"class":73},"    fmt.",[56,685,349],{"class":83},[56,687,688],{"class":73},"(“Before delete”, userAge)\n",[56,690,691,694],{"class":58,"line":522},[56,692,693],{"class":83},"    delete",[56,695,696],{"class":73},"(userAge, “mohit”)\n",[56,698,700,702,704],{"class":58,"line":699},15,[56,701,683],{"class":73},[56,703,349],{"class":83},[56,705,706],{"class":73},"(“After delete”, userAge)\n",[56,708,710],{"class":58,"line":709},16,[56,711,358],{"class":73},[21,713],{},[24,715,717],{"id":716},"retrieving-value-from-a-key","Retrieving value from a key",[11,719,720,721],{},"Once we add, we will also want to retrieve the value. This can be done with ",[53,722,723],{},"your_map_name[key]",[11,725,726,727,729,730,732],{},"Let’s extract value to key ",[53,728,375],{}," from ",[53,731,234],{}," map from before.",[46,734,736],{"className":48,"code":735,"language":50,"meta":51,"style":51},"package main\n\nimport (\n    “fmt”\n)\n\nfunc main() {\n    var userAge = map[string]int{\n        “mohit”:   24,\n        “nidhi”:   21,\n    }\n    fmt.Println(userAge[“mohit”])\n    \u002F\u002F Output - 24\n\n}\n",[53,737,738,744,748,754,758,762,766,774,794,802,810,814,823,828,832],{"__ignoreMap":51},[56,739,740,742],{"class":58,"line":59},[56,741,245],{"class":69},[56,743,248],{"class":83},[56,745,746],{"class":58,"line":66},[56,747,186],{"emptyLinePlaceholder":185},[56,749,750,752],{"class":58,"line":122},[56,751,257],{"class":69},[56,753,260],{"class":73},[56,755,756],{"class":58,"line":189},[56,757,265],{"class":73},[56,759,760],{"class":58,"line":195},[56,761,180],{"class":73},[56,763,764],{"class":58,"line":221},[56,765,186],{"emptyLinePlaceholder":185},[56,767,768,770,772],{"class":58,"line":276},[56,769,279],{"class":69},[56,771,282],{"class":83},[56,773,285],{"class":73},[56,775,776,778,780,782,784,786,788,790,792],{"class":58,"line":288},[56,777,291],{"class":69},[56,779,127],{"class":73},[56,781,296],{"class":69},[56,783,299],{"class":69},[56,785,80],{"class":73},[56,787,99],{"class":69},[56,789,87],{"class":73},[56,791,138],{"class":69},[56,793,310],{"class":73},[56,795,796,798,800],{"class":58,"line":313},[56,797,316],{"class":73},[56,799,320],{"class":319},[56,801,323],{"class":73},[56,803,804,806,808],{"class":58,"line":326},[56,805,329],{"class":73},[56,807,332],{"class":319},[56,809,323],{"class":73},[56,811,812],{"class":58,"line":337},[56,813,340],{"class":73},[56,815,816,818,820],{"class":58,"line":343},[56,817,346],{"class":73},[56,819,349],{"class":83},[56,821,822],{"class":73},"(userAge[“mohit”])\n",[56,824,825],{"class":58,"line":355},[56,826,827],{"class":62},"    \u002F\u002F Output - 24\n",[56,829,830],{"class":58,"line":522},[56,831,186],{"emptyLinePlaceholder":185},[56,833,834],{"class":58,"line":699},[56,835,358],{"class":73},[21,837],{},[24,839,841],{"id":840},"check-if-key-exists","Check if key exists?",[11,843,844],{},"We learned how to get value but what if try to retrieve a key which doesn’t exist in the map. In that case, we get zero value of the map. Check the example -",[46,846,848],{"className":48,"code":847,"language":50,"meta":51,"style":51},"package main\n\nimport (\n    “fmt”\n)\n\nfunc main() {\n    var userAge = map[string]int{\n        “mohit”: 24,\n    }\n    fmt.Println(“Zero value when key not present”, userAge[“nidhi”])\n\n    \u002F\u002F Check if key exists?\n    value, isPresent := userAge[“mohit”]\n    if isPresent {\n        fmt.Println(“Key present: mohit’s age - “, value)\n    } else {\n        fmt.Println(“Key not present”)\n    }\n\n    _, ok := userAge[“nidhi”]\n    if ok {\n        fmt.Println(“Key present”, value)\n    } else {\n        fmt.Println(“Key not found”)\n    }\n\n}\n",[53,849,850,856,860,866,870,874,878,886,906,915,919,928,932,937,947,955,971,983,993,998,1003,1014,1022,1032,1041,1051,1056,1061],{"__ignoreMap":51},[56,851,852,854],{"class":58,"line":59},[56,853,245],{"class":69},[56,855,248],{"class":83},[56,857,858],{"class":58,"line":66},[56,859,186],{"emptyLinePlaceholder":185},[56,861,862,864],{"class":58,"line":122},[56,863,257],{"class":69},[56,865,260],{"class":73},[56,867,868],{"class":58,"line":189},[56,869,612],{"class":73},[56,871,872],{"class":58,"line":195},[56,873,180],{"class":73},[56,875,876],{"class":58,"line":221},[56,877,186],{"emptyLinePlaceholder":185},[56,879,880,882,884],{"class":58,"line":276},[56,881,279],{"class":69},[56,883,282],{"class":83},[56,885,285],{"class":73},[56,887,888,890,892,894,896,898,900,902,904],{"class":58,"line":288},[56,889,291],{"class":69},[56,891,127],{"class":73},[56,893,296],{"class":69},[56,895,299],{"class":69},[56,897,80],{"class":73},[56,899,99],{"class":69},[56,901,87],{"class":73},[56,903,138],{"class":69},[56,905,310],{"class":73},[56,907,908,911,913],{"class":58,"line":313},[56,909,910],{"class":73},"        “mohit”: ",[56,912,320],{"class":319},[56,914,323],{"class":73},[56,916,917],{"class":58,"line":326},[56,918,340],{"class":73},[56,920,921,923,925],{"class":58,"line":337},[56,922,683],{"class":73},[56,924,349],{"class":83},[56,926,927],{"class":73},"(“Zero value when key not present”, userAge[“nidhi”])\n",[56,929,930],{"class":58,"line":343},[56,931,186],{"emptyLinePlaceholder":185},[56,933,934],{"class":58,"line":355},[56,935,936],{"class":62},"    \u002F\u002F Check if key exists?\n",[56,938,939,942,944],{"class":58,"line":522},[56,940,941],{"class":73},"    value, isPresent ",[56,943,201],{"class":69},[56,945,946],{"class":73}," userAge[“mohit”]\n",[56,948,949,952],{"class":58,"line":699},[56,950,951],{"class":69},"    if",[56,953,954],{"class":73}," isPresent {\n",[56,956,957,960,962,965,968],{"class":58,"line":709},[56,958,959],{"class":73},"        fmt.",[56,961,349],{"class":83},[56,963,964],{"class":73},"(“Key present: mohit’s age ",[56,966,967],{"class":69},"-",[56,969,970],{"class":73}," “, value)\n",[56,972,974,977,980],{"class":58,"line":973},17,[56,975,976],{"class":73},"    } ",[56,978,979],{"class":69},"else",[56,981,982],{"class":73}," {\n",[56,984,986,988,990],{"class":58,"line":985},18,[56,987,959],{"class":73},[56,989,349],{"class":83},[56,991,992],{"class":73},"(“Key not present”)\n",[56,994,996],{"class":58,"line":995},19,[56,997,340],{"class":73},[56,999,1001],{"class":58,"line":1000},20,[56,1002,186],{"emptyLinePlaceholder":185},[56,1004,1006,1009,1011],{"class":58,"line":1005},21,[56,1007,1008],{"class":73},"    _, ok ",[56,1010,201],{"class":69},[56,1012,1013],{"class":73}," userAge[“nidhi”]\n",[56,1015,1017,1019],{"class":58,"line":1016},22,[56,1018,951],{"class":69},[56,1020,1021],{"class":73}," ok {\n",[56,1023,1025,1027,1029],{"class":58,"line":1024},23,[56,1026,959],{"class":73},[56,1028,349],{"class":83},[56,1030,1031],{"class":73},"(“Key present”, value)\n",[56,1033,1035,1037,1039],{"class":58,"line":1034},24,[56,1036,976],{"class":73},[56,1038,979],{"class":69},[56,1040,982],{"class":73},[56,1042,1044,1046,1048],{"class":58,"line":1043},25,[56,1045,959],{"class":73},[56,1047,349],{"class":83},[56,1049,1050],{"class":73},"(“Key not found”)\n",[56,1052,1054],{"class":58,"line":1053},26,[56,1055,340],{"class":73},[56,1057,1059],{"class":58,"line":1058},27,[56,1060,186],{"emptyLinePlaceholder":185},[56,1062,1064],{"class":58,"line":1063},28,[56,1065,358],{"class":73},[11,1067,1068],{},"Output for the code above -",[46,1070,1072],{"className":48,"code":1071,"language":50,"meta":51,"style":51},"Zero value when key not present 0\nKey present - mohit’s age -  24\nKey not found\n",[53,1073,1074,1082,1097],{"__ignoreMap":51},[56,1075,1076,1079],{"class":58,"line":59},[56,1077,1078],{"class":73},"Zero value when key not present ",[56,1080,1081],{"class":319},"0\n",[56,1083,1084,1087,1089,1092,1094],{"class":58,"line":66},[56,1085,1086],{"class":73},"Key present ",[56,1088,967],{"class":69},[56,1090,1091],{"class":73}," mohit’s age ",[56,1093,967],{"class":69},[56,1095,1096],{"class":319},"  24\n",[56,1098,1099],{"class":58,"line":122},[56,1100,1101],{"class":73},"Key not found\n",[21,1103],{},[24,1105,1107],{"id":1106},"iterating-through-maps","Iterating through maps",[11,1109,1110,1111,1114,1115,1118,1119,1122,1123,1130],{},"We can use range keyword to loop through a map. ",[53,1112,1113],{},"range"," returns two variables - ",[53,1116,1117],{},"key"," and ",[53,1120,1121],{},"value"," ( obviously you can use any variable). Iteration order over maps is random and unstable i.e it may or may not be different when you run the same program multiple times. ",[1124,1125,1129],"a",{"href":1126,"rel":1127},"https:\u002F\u002Fgolang.org\u002Fref\u002Fspec#RangeClause",[1128],"nofollow","Details here","!",[11,1132,1133,1134,1137],{},"Although you can sort the map by using ",[53,1135,1136],{},"sort"," function.",[46,1139,1141],{"className":48,"code":1140,"language":50,"meta":51,"style":51},"package main\n\nimport (\n    “fmt”\n)\n\nfunc main() {\n    var userAge = map[string]int{\n        “mohit”: 24,\n        “nidhi”: 21,\n    }\n    for key, value := range userAge {\n        fmt.Println(key, value)\n    }\n}\n\n\u002F\u002F Output\nmohit 24\nnidhi 21\n",[53,1142,1143,1149,1153,1159,1163,1167,1171,1179,1199,1207,1216,1220,1236,1245,1249,1253,1257,1262,1270],{"__ignoreMap":51},[56,1144,1145,1147],{"class":58,"line":59},[56,1146,245],{"class":69},[56,1148,248],{"class":83},[56,1150,1151],{"class":58,"line":66},[56,1152,186],{"emptyLinePlaceholder":185},[56,1154,1155,1157],{"class":58,"line":122},[56,1156,257],{"class":69},[56,1158,260],{"class":73},[56,1160,1161],{"class":58,"line":189},[56,1162,612],{"class":73},[56,1164,1165],{"class":58,"line":195},[56,1166,180],{"class":73},[56,1168,1169],{"class":58,"line":221},[56,1170,186],{"emptyLinePlaceholder":185},[56,1172,1173,1175,1177],{"class":58,"line":276},[56,1174,279],{"class":69},[56,1176,282],{"class":83},[56,1178,285],{"class":73},[56,1180,1181,1183,1185,1187,1189,1191,1193,1195,1197],{"class":58,"line":288},[56,1182,291],{"class":69},[56,1184,127],{"class":73},[56,1186,296],{"class":69},[56,1188,299],{"class":69},[56,1190,80],{"class":73},[56,1192,99],{"class":69},[56,1194,87],{"class":73},[56,1196,138],{"class":69},[56,1198,310],{"class":73},[56,1200,1201,1203,1205],{"class":58,"line":313},[56,1202,910],{"class":73},[56,1204,320],{"class":319},[56,1206,323],{"class":73},[56,1208,1209,1212,1214],{"class":58,"line":326},[56,1210,1211],{"class":73},"        “nidhi”: ",[56,1213,332],{"class":319},[56,1215,323],{"class":73},[56,1217,1218],{"class":58,"line":337},[56,1219,340],{"class":73},[56,1221,1222,1225,1228,1230,1233],{"class":58,"line":343},[56,1223,1224],{"class":69},"    for",[56,1226,1227],{"class":73}," key, value ",[56,1229,201],{"class":69},[56,1231,1232],{"class":69}," range",[56,1234,1235],{"class":73}," userAge {\n",[56,1237,1238,1240,1242],{"class":58,"line":355},[56,1239,959],{"class":73},[56,1241,349],{"class":83},[56,1243,1244],{"class":73},"(key, value)\n",[56,1246,1247],{"class":58,"line":522},[56,1248,340],{"class":73},[56,1250,1251],{"class":58,"line":699},[56,1252,358],{"class":73},[56,1254,1255],{"class":58,"line":709},[56,1256,186],{"emptyLinePlaceholder":185},[56,1258,1259],{"class":58,"line":973},[56,1260,1261],{"class":62},"\u002F\u002F Output\n",[56,1263,1264,1267],{"class":58,"line":985},[56,1265,1266],{"class":73},"mohit ",[56,1268,1269],{"class":319},"24\n",[56,1271,1272,1275],{"class":58,"line":995},[56,1273,1274],{"class":73},"nidhi ",[56,1276,1277],{"class":319},"21\n",[21,1279],{},[24,1281,1283],{"id":1282},"check-if-two-maps-are-equal","Check if two maps are equal?",[11,1285,1286,1287,1290],{},"Maps cannot be directly compared using ",[53,1288,1289],{},"=="," operator. Equality operator only works when both maps are empty. Though you can check if each key has same value in both maps by iterating through them.",[46,1292,1294],{"className":48,"code":1293,"language":50,"meta":51,"style":51},"package main\n\nimport (\n    “fmt”\n)\n\nfunc main() {\n    userAge1 := map[string]int{\n        “mohit”: 24,\n    }\n\n    userAge2 := map[string]int{\n        “mohit”: 24,\n    }\n\n    if userAge1 == userAge2 {\n        fmt.Println(“Maps are equal”)\n    } else {\n        fmt.Println(“Maps are unequal”)\n    }\n}\n",[53,1295,1296,1302,1306,1312,1316,1320,1324,1332,1351,1359,1363,1367,1386,1394,1398,1402,1414,1423,1431,1440,1444],{"__ignoreMap":51},[56,1297,1298,1300],{"class":58,"line":59},[56,1299,245],{"class":69},[56,1301,248],{"class":83},[56,1303,1304],{"class":58,"line":66},[56,1305,186],{"emptyLinePlaceholder":185},[56,1307,1308,1310],{"class":58,"line":122},[56,1309,257],{"class":69},[56,1311,260],{"class":73},[56,1313,1314],{"class":58,"line":189},[56,1315,612],{"class":73},[56,1317,1318],{"class":58,"line":195},[56,1319,180],{"class":73},[56,1321,1322],{"class":58,"line":221},[56,1323,186],{"emptyLinePlaceholder":185},[56,1325,1326,1328,1330],{"class":58,"line":276},[56,1327,279],{"class":69},[56,1329,282],{"class":83},[56,1331,285],{"class":73},[56,1333,1334,1337,1339,1341,1343,1345,1347,1349],{"class":58,"line":288},[56,1335,1336],{"class":73},"    userAge1 ",[56,1338,201],{"class":69},[56,1340,299],{"class":69},[56,1342,80],{"class":73},[56,1344,99],{"class":69},[56,1346,87],{"class":73},[56,1348,138],{"class":69},[56,1350,310],{"class":73},[56,1352,1353,1355,1357],{"class":58,"line":313},[56,1354,910],{"class":73},[56,1356,320],{"class":319},[56,1358,323],{"class":73},[56,1360,1361],{"class":58,"line":326},[56,1362,340],{"class":73},[56,1364,1365],{"class":58,"line":337},[56,1366,186],{"emptyLinePlaceholder":185},[56,1368,1369,1372,1374,1376,1378,1380,1382,1384],{"class":58,"line":343},[56,1370,1371],{"class":73},"    userAge2 ",[56,1373,201],{"class":69},[56,1375,299],{"class":69},[56,1377,80],{"class":73},[56,1379,99],{"class":69},[56,1381,87],{"class":73},[56,1383,138],{"class":69},[56,1385,310],{"class":73},[56,1387,1388,1390,1392],{"class":58,"line":355},[56,1389,910],{"class":73},[56,1391,320],{"class":319},[56,1393,323],{"class":73},[56,1395,1396],{"class":58,"line":522},[56,1397,340],{"class":73},[56,1399,1400],{"class":58,"line":699},[56,1401,186],{"emptyLinePlaceholder":185},[56,1403,1404,1406,1409,1411],{"class":58,"line":709},[56,1405,951],{"class":69},[56,1407,1408],{"class":73}," userAge1 ",[56,1410,1289],{"class":69},[56,1412,1413],{"class":73}," userAge2 {\n",[56,1415,1416,1418,1420],{"class":58,"line":973},[56,1417,959],{"class":73},[56,1419,349],{"class":83},[56,1421,1422],{"class":73},"(“Maps are equal”)\n",[56,1424,1425,1427,1429],{"class":58,"line":985},[56,1426,976],{"class":73},[56,1428,979],{"class":69},[56,1430,982],{"class":73},[56,1432,1433,1435,1437],{"class":58,"line":995},[56,1434,959],{"class":73},[56,1436,349],{"class":83},[56,1438,1439],{"class":73},"(“Maps are unequal”)\n",[56,1441,1442],{"class":58,"line":1000},[56,1443,340],{"class":73},[56,1445,1446],{"class":58,"line":1005},[56,1447,358],{"class":73},[11,1449,1450],{},"The code above gives an error -",[46,1452,1456],{"className":1453,"code":1454,"language":1455,"meta":51,"style":51},"language-bash shiki shiki-themes github-light github-dark","invalid operation: userAge1 == userAge2 (map can only be compared to nil)\n","bash",[53,1457,1458],{"__ignoreMap":51},[56,1459,1460,1463,1467,1470,1473,1476,1479,1482,1485,1488,1491,1494,1497],{"class":58,"line":59},[56,1461,1462],{"class":83},"invalid",[56,1464,1466],{"class":1465},"sZZnC"," operation:",[56,1468,1469],{"class":1465}," userAge1",[56,1471,1472],{"class":1465}," ==",[56,1474,1475],{"class":1465}," userAge2",[56,1477,1478],{"class":73}," (map ",[56,1480,1481],{"class":1465},"can",[56,1483,1484],{"class":1465}," only",[56,1486,1487],{"class":1465}," be",[56,1489,1490],{"class":1465}," compared",[56,1492,1493],{"class":1465}," to",[56,1495,1496],{"class":1465}," nil",[56,1498,180],{"class":73},[18,1500,1501,1503,1507,1541,1543,1547,1570,1574,1597,1600,1609,1611,1614,1623],{},[21,1502],{},[24,1504,1506],{"id":1505},"bonus-on-maps","Bonus on maps",[1508,1509,1510,1521,1529,1535],"ul",{},[1511,1512,1513,1514,1517,1518],"li",{},"You can get length of map using ",[53,1515,1516],{},"len()"," function. Eg. ",[53,1519,1520],{},"len(your_map)",[1511,1522,1523,1524,1528],{},"Maps are ",[1525,1526,1527],"strong",{},"reference types"," i.e if you change map instance then changes will be reflected wherever that map is used.",[1511,1530,1531,1532],{},"Maps are not ",[1525,1533,1534],{},"thread-safe",[1511,1536,1537,1538],{},"You can clear a map by simply assigning it to empty map. Eg. ",[53,1539,1540],{},"your_map = map[string]bool{}",[21,1542],{},[24,1544,1546],{"id":1545},"resources","Resources",[1508,1548,1549,1556,1563],{},[1511,1550,1551],{},[1124,1552,1555],{"href":1553,"rel":1554},"https:\u002F\u002Fdave.cheney.net\u002F2018\u002F05\u002F29\u002Fhow-the-go-runtime-implements-maps-efficiently-without-generics",[1128],"How map is implemented",[1511,1557,1558],{},[1124,1559,1562],{"href":1560,"rel":1561},"https:\u002F\u002Fblog.golang.org\u002Fmaps",[1128],"Official Go blog on maps",[1511,1564,1565],{},[1124,1566,1569],{"href":1567,"rel":1568},"https:\u002F\u002Fwww.mohitkhare.com\u002Fcategories\u002Fgolang",[1128],"Explore other Go articles",[41,1571,1573],{"id":1572},"books-to-learn-golang","Books to learn Golang",[1508,1575,1576,1583,1590],{},[1511,1577,1578],{},[1124,1579,1582],{"href":1580,"rel":1581},"https:\u002F\u002Famzn.to\u002F3fYLCqz",[1128],"Go Programming Language",[1511,1584,1585],{},[1124,1586,1589],{"href":1587,"rel":1588},"https:\u002F\u002Famzn.to\u002F3s7fWS3",[1128],"Learning Go",[1511,1591,1592],{},[1124,1593,1596],{"href":1594,"rel":1595},"https:\u002F\u002Famzn.to\u002F3t6PM37",[1128],"Go in Action",[11,1598,1599],{},"Awesome! You just learned how to use maps in Go. There is lot more to maps, will be covering more in other tutorials.",[11,1601,1602,1603,1608],{},"Liked the article? Consider ",[1124,1604,1607],{"href":1605,"rel":1606},"https:\u002F\u002Fwww.buymeacoffee.com\u002FchHAzigTb",[1128],"supporting me"," ☕️",[21,1610],{},[11,1612,1613],{},"I hope you learned something new. Feel free to suggest improvements ✔️",[11,1615,1616,1617,1622],{},"I share regular updates and resources on ",[1124,1618,1621],{"href":1619,"rel":1620},"https:\u002F\u002Ftwitter.com\u002Fmkfeuhrer",[1128],"Twitter",". Let's connect!",[11,1624,1625],{},[1525,1626,1627],{},"Keep exploring 🔎 Keep learning 🚀",[1629,1630,1631],"style",{},"html pre.shiki code .sJ8bj, html code.shiki .sJ8bj{--shiki-default:#6A737D;--shiki-dark:#6A737D}html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}",{"title":51,"searchDepth":66,"depth":66,"links":1633},[1634,1635,1639,1640,1641,1642,1643,1644],{"id":26,"depth":66,"text":27},{"id":35,"depth":66,"text":36,"children":1636},[1637,1638],{"id":43,"depth":122,"text":44},{"id":227,"depth":122,"text":228},{"id":395,"depth":66,"text":396},{"id":562,"depth":66,"text":563},{"id":716,"depth":66,"text":717},{"id":840,"depth":66,"text":841},{"id":1106,"depth":66,"text":1107},{"id":1282,"depth":66,"text":1283},[1646,1647],"Golang","Programming","A complete guide to maps in Golang: creating maps, adding and removing items, iterating, and how map equality works.",false,"md","blog\u002Fgolang-maps\u002Fgolang-maps-card.webp","golang maps, golang map literal, golang key value pair, golang iterate map, golang map keys, golang map delete",{},"golang-maps","\u002Fblog\u002Fgolang-maps",{"title":5,"description":1648},"blog\u002Fgolang-maps","2020-09-10","bTcqmrtUDi_UDLEtgmbNvJ4vXyCCXYi3_-qGDqfU634",[1661,1668,1674,1682,1691,1698,1705,1712,1718,1724,1730,1736,1742,1752,1758,1765,1772,1779,1785,1792,1798,1804,1810,1816,1822,1828,1834,1840,1847,1854,1856,1862,1868,1874,1880,1886,1892,1898,1904,1910,1916,1922,1928,1935,1941,1947,1953,1960,1966,1972,1979,1986,1992,1999,2005,2012,2018,2025,2031,2037,2043,2049,2055,2061,2067,2073,2079,2085,2091,2097,2104,2110,2117,2123,2129,2135,2142,2148],{"path":1662,"title":1663,"description":1664,"categories":1665,"draft":185,"year":1667,"series":6},"\u002Fblog\u002Fai-assisted-workstation","Building an AI-Assisted Personal Workstation","How I built a personal AI workstation: markdown knowledge base, portable agent skills, handoff-driven sessions. What worked, what broke, what I would change.",[1666,1647],"Productivity","2026-08-26",{"path":1669,"title":1670,"description":1671,"categories":1672,"draft":1649,"year":1673,"series":6},"\u002Fblog\u002Faws-s3-golang","Uploading images to AWS S3 in Golang","In this tutorial I cover how to upload, fetch and manage other operations for objects on AWS S3 in Golang",[1646,1647],"2020-01-12",{"path":1675,"title":1676,"description":1677,"categories":1678,"draft":1649,"year":1681,"series":6},"\u002Fblog\u002Fbooks-for-engineers","Best Books for Software Engineers","Best Books to help you build you software engineering career - ranging from fundamentats, interview prep to productivity.",[1679,1680],"Books","Life","2021-12-26",{"path":1683,"title":1684,"description":1685,"categories":1686,"draft":1649,"year":1690,"series":6},"\u002Fblog\u002Fbuilding-acrons","Building Acrons 🚀","Building Acrons, a one-stop tool to decode everyday acronyms like DIY, FOMO, and BRB without losing your flow.",[1687,1688,1689],"Side Projects","Web","Tools","2020-05-26",{"path":1692,"title":1693,"description":1694,"categories":1695,"draft":1649,"year":1697,"series":6},"\u002Fblog\u002Fcap-theorem","CAP Theorem Explained","Learn the concept and misconceptions around popular CAP theorem in system design.",[1696,1647],"System Design","2021-07-26",{"path":1699,"title":1700,"description":1701,"categories":1702,"draft":1649,"year":1704,"series":6},"\u002Fblog\u002Fcode-reviews","Code Review Checklist","Why code reviews matter, and best practices that catch bugs early and keep code quality high before merge.",[1703],"Engineering Principles","2020-07-20",{"path":1706,"title":1707,"description":1708,"categories":1709,"draft":1649,"year":1711,"series":6},"\u002Fblog\u002Fdark-mode","Add Dark mode to websites","Dark mode is ❤️️ Add it to your websites with little CSS and JS",[1710,1688],"Javascript","2020-07-04",{"path":1713,"title":1714,"description":1715,"categories":1716,"draft":1649,"year":1717,"series":6},"\u002Fblog\u002Fdate-time-golang","Working with Date and Time in Go","Learn how to use time in Golang - Multiple formats, locations and using date.",[1646,1647],"2020-10-09",{"path":1719,"title":1720,"description":1721,"categories":1722,"draft":1649,"year":1723,"series":6},"\u002Fblog\u002Fdefer-in-golang","Understanding Defer In Golang","Learn about defer keyword in golang and how it can help you avoid panics due to bugs.",[1646,1647],"2021-05-05",{"path":1725,"title":1726,"description":1727,"categories":1728,"draft":1649,"year":1729,"series":6},"\u002Fblog\u002Fenums-golang","Implementing Enums in Golang","Enums are a way to defined set of constant values. Learn how to implement enums in Go using iota with examples.",[1646,1647],"2021-12-18",{"path":1731,"title":1732,"description":1733,"categories":1734,"draft":1649,"year":1735,"series":6},"\u002Fblog\u002Fenvironment-variable-golang","Guide to Environment variables in Go","Learn what are environment variables and how to use them in Go",[1646,1647],"2020-08-14",{"path":1737,"title":1738,"description":1739,"categories":1740,"draft":1649,"year":1741,"series":6},"\u002Fblog\u002Ferror-handling-golang","Handle errors the right way — Golang","How to handle errors in golang to make your life easy",[1646,1647],"2020-01-30",{"path":1743,"title":1744,"description":1745,"categories":1746,"draft":185,"year":1749,"series":1750},"\u002Fblog\u002Ffile-attack-document-macros","File Attack Deep Dives, Part 3: Document Macros","How malicious VBA hides in vbaProject.bin, which AutoOpen entry points fire it, and the sandbox signals that catch it.",[1747,1748],"Security","Systems","2026-09-17",{"name":1751,"part":122},"File Attack Deep Dives",{"path":1753,"title":1754,"description":1755,"categories":1756,"draft":1649,"year":1667,"series":1757},"\u002Fblog\u002Ffile-attack-field-guide","How File-Based Attacks Land: A Detection Engineer's Field Guide","A practical taxonomy of how malware and phishing arrive as files, why classic controls miss them, and how detection should think.",[1747,1748],{"name":1751,"part":59},{"path":1759,"title":1760,"description":1761,"categories":1762,"draft":185,"year":1763,"series":1764},"\u002Fblog\u002Ffile-attack-html-smuggling","File Attack Deep Dives, Part 2: HTML Smuggling","How attackers assemble malware inside the browser with Blob URLs, and the URL and script tells that catch it.",[1747,1748],"2026-09-10",{"name":1751,"part":66},{"path":1766,"title":1767,"description":1768,"categories":1769,"draft":185,"year":1770,"series":1771},"\u002Fblog\u002Ffile-attack-lnk-iso","File Attack Deep Dives, Part 5: LNK and ISO Smuggling","How ISO containers and weaponized shortcuts bypass Mark of the Web, and the forensic fields that catch them.",[1747,1748],"2026-10-01",{"name":1751,"part":195},{"path":1773,"title":1774,"description":1775,"categories":1776,"draft":185,"year":1777,"series":1778},"\u002Fblog\u002Ffile-attack-pdf-url-actions","File Attack Deep Dives, Part 4: PDF URL Actions","How PDF OpenAction, Launch, and URI actions turn opening a document into a phishing click, and the action audit that catches them.",[1747,1748],"2026-09-24",{"name":1751,"part":189},{"path":1780,"title":1781,"description":1782,"categories":1783,"draft":1649,"year":1784,"series":6},"\u002Fblog\u002Ffile-upload-golang","Uploading Files in Golang with Multipart Request","Learn how to upload files from your client to server as a multipart request in Golang.",[1646,1647],"2021-03-13",{"path":1786,"title":1787,"description":1788,"categories":1789,"draft":1649,"year":1791,"series":6},"\u002Fblog\u002Fgit-branch","Git Branch 101","Branching is a new path of development that makes it a lot easier to build features. Learn why and how to use branching in git.",[1790,1647],"Git","2022-03-20",{"path":1793,"title":1794,"description":1795,"categories":1796,"draft":1649,"year":1797,"series":6},"\u002Fblog\u002Fgit-pull-request-template","Guide to Pull Request Templates","Improve collaboration and code reviews with pull request templates. Blog include PR template and how to create one on github\u002Fgitlab",[1790,1647],"2023-08-24",{"path":1799,"title":1800,"description":1801,"categories":1802,"draft":1649,"year":1803,"series":6},"\u002Fblog\u002Fgit-remove-sensitive-info","Securing Git: Remove Sensitive Information","Protect your code from security breaches by using BFG tool to remove sensitive information from Git history. Learn how to do it in this comprehensive guide.",[1790,1647],"2023-10-16",{"path":1805,"title":1806,"description":1807,"categories":1808,"draft":1649,"year":1809,"series":6},"\u002Fblog\u002Fgit-tags-explained","Git tags : Explained","What Git tags are, why and when to use them, and how to start tagging releases in your own projects.",[1790,1647],"2020-06-18",{"path":1811,"title":1812,"description":1813,"categories":1814,"draft":1649,"year":1815,"series":6},"\u002Fblog\u002Fgo-dependency-injection","Dependency Injection in Go using Wire","Learn about dependency injection, its benefits and how to implement it in Go services using wire",[1646,1647],"2022-11-26",{"path":1817,"title":1818,"description":1819,"categories":1820,"draft":1649,"year":1821,"series":6},"\u002Fblog\u002Fgo-generics","Introduction to Generics in Go","Learn about generics in Golang, it's benefits and how to implement it in applications.",[1646,1647],"2022-11-27",{"path":1823,"title":1824,"description":1825,"categories":1826,"draft":1649,"year":1827,"series":6},"\u002Fblog\u002Fgo-in-memory-cache","Building In-Memory Cache in Go","Learn about in-memory caching in Golang, it's benefits and how to implement it with and without generics with a TTL(expiry).",[1646,1647],"2024-03-28",{"path":1829,"title":1830,"description":1831,"categories":1832,"draft":1649,"year":1833,"series":6},"\u002Fblog\u002Fgo-makefile","Ultimate Makefile for Golang","Boost your productivity and save time with ultimate Makefile for Golang projects.",[1646,1647],"2024-06-10",{"path":1835,"title":1836,"description":1837,"categories":1838,"draft":1649,"year":1839,"series":6},"\u002Fblog\u002Fgo-middleware","Mastering Middlewares in Golang","Learn about middlewares, their use cases and how to implement them in Golang applications",[1646,1647],"2022-03-13",{"path":1841,"title":1842,"description":1843,"categories":1844,"draft":1649,"year":1846,"series":6},"\u002Fblog\u002Fgo-naming-conventions","Naming Conventions in Golang","Why naming conventions matter in Go, with best practices and practical examples for clear, readable, maintainable code.",[1646,1647,1845],"Code Quality","2023-05-19",{"path":1848,"title":1849,"description":1850,"categories":1851,"draft":1649,"year":1853,"series":6},"\u002Fblog\u002Fgo-with-redis","Go with Redis","A practical introduction to using Redis with Golang to make your applications faster with in-memory data storage.",[1646,1852,1647],"Database","2020-05-03",{"path":1655,"title":5,"description":1648,"categories":1855,"draft":1649,"year":1658,"series":6},[1646,1647],{"path":1857,"title":1858,"description":1859,"categories":1860,"draft":1649,"year":1861,"series":6},"\u002Fblog\u002Fguide-to-cdn","Guide to Content Delivery Network","CDN is one of the backbone of modern world internet infrastructure. Learn about Content Delivery Network, it's working, types and benefits.",[1696,1647],"2022-01-23",{"path":1863,"title":1864,"description":1865,"categories":1866,"draft":1649,"year":1867,"series":6},"\u002Fblog\u002Fguide-to-rule-engines","Guide to Rule Engines","Rule Engines help in solving changing business requirements with ease. Learn all about Rule engines, it's working, benefits and how to implement one in Golang",[1646,1647],"2022-09-12",{"path":1869,"title":1870,"description":1871,"categories":1872,"draft":1649,"year":1873,"series":6},"\u002Fblog\u002Fhexagonal-architecture","Guide to Hexagonal Architecture","Learn how to design efficient application with hexagonal architecture with practical example",[1696,1647],"2020-12-13",{"path":1875,"title":1876,"description":1877,"categories":1878,"draft":1649,"year":1879,"series":6},"\u002Fblog\u002Fhttp-status-codes","Learn HTTP Status Codes","A tour of HTTP response status codes, what each class means, and when to use which code in your applications.",[1688,1647],"2020-07-30",{"path":1881,"title":1882,"description":1883,"categories":1884,"draft":1649,"year":1885,"series":6},"\u002Fblog\u002Fintroduction-to-goroutines","Introduction to Goroutines","Understand the basics of concurrency and learn how to work with Goroutines in golang.",[1646,1647],"2021-04-10",{"path":1887,"title":1888,"description":1889,"categories":1890,"draft":1649,"year":1891,"series":6},"\u002Fblog\u002Fjson-in-postgres-with-golang","Storing JSON in Postgres with Golang","Learn how to store JSON objects in Postgres and how to implement it in Golang.",[1647,1852,1646],"2021-02-13",{"path":1893,"title":1894,"description":1895,"categories":1896,"draft":1649,"year":1897,"series":6},"\u002Fblog\u002Fjson-web-token","Complete Guide to JWT","JSON Web Tokens are a very compact way to carry information. Learn about JWTs in depth, from its structure to when to use it.",[1647,1688],"2021-11-20",{"path":1899,"title":1900,"description":1901,"categories":1902,"draft":1649,"year":1903,"series":6},"\u002Fblog\u002Flearn-to-say-no","Learning to say No","Learn why it's important to say 'NO'. How it helps in increasing productivity and explore strategies for saying No",[1680,1679],"2022-04-09",{"path":1905,"title":1906,"description":1907,"categories":1908,"draft":1649,"year":1909,"series":6},"\u002Fblog\u002Flearn-unlearn-relearn","Learn - Unlearn - Relearn","Unlearning things to learn new is the way to grow. Discover how to do that!",[1666,1680],"2020-09-25",{"path":1911,"title":1912,"description":1913,"categories":1914,"draft":1649,"year":1915,"series":6},"\u002Fblog\u002Flinting-in-golang","Introduction to Linting in Go","Introduction to improving code quality using linting. Learn how to add linting in your Go projects.",[1646,1647],"2021-07-07",{"path":1917,"title":1918,"description":1919,"categories":1920,"draft":1649,"year":1921,"series":6},"\u002Fblog\u002Fload-balancing","Load Balancing 101","Complete guide on load balancers explaining the internal working and how does it help in making applications efficient.",[1696,1647],"2021-05-29",{"path":1923,"title":1924,"description":1925,"categories":1926,"draft":1649,"year":1927,"series":6},"\u002Fblog\u002Fmaking-decisions-the-right-way","Making Decisions: The right way","Decisions are hard! Learn how to make the right decisions always",[1666,1680],"2020-06-07",{"path":1929,"title":1930,"description":1931,"categories":1932,"draft":1649,"year":1934,"series":6},"\u002Fblog\u002Fmanage-logs-with-logrotate","Using Logrotate to manage logs","Learn how to use logrotate system utility to manage logs with example",[1933,1647],"Linux","2020-09-08",{"path":1936,"title":1937,"description":1938,"categories":1939,"draft":1649,"year":1940,"series":6},"\u002Fblog\u002Fmarshal-structs-golang","Marshal structs the right way: Golang","Why Golang marshals empty structs into your JSON instead of null, and how to marshal structs the right way.",[1646,1647],"2020-03-31",{"path":1942,"title":1943,"description":1944,"categories":1945,"draft":1649,"year":1946,"series":6},"\u002Fblog\u002Fnotes-almanack-naval","Book Notes : Almanack of Naval Ravikant","My notes\u002Fhighlights from Almanack of Naval Ravikant book by Eric Jorgenson",[1679,1680],"2020-10-17",{"path":1948,"title":1949,"description":1950,"categories":1951,"draft":1649,"year":1952,"series":6},"\u002Fblog\u002Fnotes-anything-you-want","Book Notes : Anything you want","My notes\u002Fhighlights from Anything you want book by Derek Sivers",[1679,1680],"2021-09-25",{"path":1954,"title":1955,"description":1956,"categories":1957,"draft":1649,"year":1959,"series":6},"\u002Fblog\u002Fnotes-getting-real","Book Notes : Getting Real","My notes and highlights from Getting Real by Jason Fried and David Heinemeier Hansson on building web applications.",[1679,1958],"Startups","2020-11-03",{"path":1961,"title":1962,"description":1963,"categories":1964,"draft":1649,"year":1965,"series":6},"\u002Fblog\u002Fnotes-hell-yeah-or-no","Book Notes : Hell Yeah or No","My notes\u002Fhighlights from Hell Yeah or No book by Derek Sivers",[1679,1680],"2020-09-16",{"path":1967,"title":1968,"description":1969,"categories":1970,"draft":1649,"year":1971,"series":6},"\u002Fblog\u002Fnotes-how-to-be-a-capitalist","Book Notes : How to Be a Capitalist Without Any Capital","My notes\u002Fhighlights from How to Be a Capitalist Without Any Capital by Nathan Latka",[1679,1958],"2020-01-07",{"path":1973,"title":1974,"description":1975,"categories":1976,"draft":1649,"year":1978,"series":6},"\u002Fblog\u002Fnotes-lean-b2b","Book Notes : Lean B2B","My notes and highlights from Lean B2B by Étienne Garbugli on assessing markets, building MVPs, and selling to businesses.",[1679,1977],"Entrepreneurship","2022-07-02",{"path":1980,"title":1981,"description":1982,"categories":1983,"draft":1649,"year":1985,"series":6},"\u002Fblog\u002Fnotes-lets-talk-money","Book Notes : Let's Talk Money","My notes and highlights from Let's Talk Money by Monica Halan on managing personal finances and savings.",[1679,1984],"Personal Finance","2021-02-26",{"path":1987,"title":1988,"description":1989,"categories":1990,"draft":1649,"year":1991,"series":6},"\u002Fblog\u002Fnotes-obviously-awesome","Book Notes : Obviously Awesome","My notes and highlights from Obviously Awesome by April Dunford on product positioning and marketing strategy.",[1679,1958],"2020-04-26",{"path":1993,"title":1994,"description":1995,"categories":1996,"draft":1649,"year":1998,"series":6},"\u002Fblog\u002Fnotes-refactoring-ui","Book Notes: Refactoring UI","My notes and highlights from Refactoring UI by Adam Wathan and Steve Schoger, full of practical design tips for engineers.",[1679,1997],"Design","2020-05-09",{"path":2000,"title":2001,"description":2002,"categories":2003,"draft":1649,"year":2004,"series":6},"\u002Fblog\u002Fnotes-rework","Book Notes: Rework","My notes and highlights from Rework by Jason Fried and David Heinemeier Hansson on a better way to succeed in business.",[1679,1958],"2021-04-14",{"path":2006,"title":2007,"description":2008,"categories":2009,"draft":1649,"year":2011,"series":6},"\u002Fblog\u002Fone-on-one-meetings","Guide to Effective 1:1 Meetings","One on One meetings are important for your personal & professional growth. Learn how to master 1:1s with your manager and peers.",[2010,1666],"Career","2023-03-05",{"path":2013,"title":2014,"description":2015,"categories":2016,"draft":1649,"year":2017,"series":6},"\u002Fblog\u002Fpersonal-okrs","Personal OKRs for Success","Why one should set personal OKRs and how to achieve success with them",[1666,1680],"2020-06-27",{"path":2019,"title":2020,"description":2021,"categories":2022,"draft":1649,"year":2024,"series":6},"\u002Fblog\u002Fpoker-tips","Poker Tips: Johns Hopkins Poker Class","Notes from Johns Hopkins poker course. This guide will help you improve in Poker and win some large pots.",[1680,2023],"Poker","2020-06-13",{"path":2026,"title":2027,"description":2028,"categories":2029,"draft":1649,"year":2030,"series":6},"\u002Fblog\u002Fpomodoro","Get work done: The Pomo Way","Learn to focus and get productive by following the Pomodoro Technique",[1666],"2020-10-24",{"path":2032,"title":2033,"description":2034,"categories":2035,"draft":1649,"year":2036,"series":6},"\u002Fblog\u002Fpostgres-constraints","Postgres Constraints","Constraints are line of defense for database. Explore various types of constrainsts in postgres",[1852,1647],"2020-11-07",{"path":2038,"title":2039,"description":2040,"categories":2041,"draft":1649,"year":2042,"series":6},"\u002Fblog\u002Fppf-explained","PPF Explained","Learn basics about Public Provident Fund and why you should invest",[1680,1984],"2020-12-24",{"path":2044,"title":2045,"description":2046,"categories":2047,"draft":1649,"year":2048,"series":6},"\u002Fblog\u002Fproductivity-chrome-extensions","Boost Productivity with Chrome Extensions","Utitizing chrome extensions to boost your productivity!",[1666,1689,1688],"2020-04-24",{"path":2050,"title":2051,"description":2052,"categories":2053,"draft":1649,"year":2054,"series":6},"\u002Fblog\u002Fproductivity-in-vscode","Improve your productivity with VS Code","Key VS Code features like the integrated terminal, shortcuts, and extensions that improved my everyday productivity.",[1666,1647],"2020-03-12",{"path":2056,"title":2057,"description":2058,"categories":2059,"draft":1649,"year":2060,"series":6},"\u002Fblog\u002Freading-101","Improving Reading 101","Why reading matters, how to build a reading habit, and what to read next - from my own journey into books.",[1679,1680],"2020-04-04",{"path":2062,"title":2063,"description":2064,"categories":2065,"draft":1649,"year":2066,"series":6},"\u002Fblog\u002Freverse-proxy","Understanding Reverse Proxy","Learn about reverse proxy, how it is different from forward proxy and explore advantages of using it in system design.",[1696,1647],"2021-10-03",{"path":2068,"title":2069,"description":2070,"categories":2071,"draft":1649,"year":2072,"series":6},"\u002Fblog\u002Frunning-periodic-background-task-golang","Running periodic background tasks in Golang","How to run periodic background tasks in Golang by combining cron-style scheduling with background execution.",[1646,1647],"2019-11-21",{"path":2074,"title":2075,"description":2076,"categories":2077,"draft":1649,"year":2078,"series":6},"\u002Fblog\u002Fsessions-in-golang","Sessions using Golang and Redis","How cookies and sessions work, and how to implement persistent login sessions in Golang using Redis.",[1646,1852,1647],"2020-02-25",{"path":2080,"title":2081,"description":2082,"categories":2083,"draft":1649,"year":2084,"series":6},"\u002Fblog\u002Fsolid-dry-kiss-yagni","Solid Dry Kiss Yagni","An introduction to the SOLID, DRY, KISS, and YAGNI principles and how they help you write cleaner, robust code.",[1703],"2020-07-17",{"path":2086,"title":2087,"description":2088,"categories":2089,"draft":1649,"year":2090,"series":6},"\u002Fblog\u002Fstack-in-golang","Implement Stack in Golang","Learn how to implement stack data structure in Golang (Full code)",[1646,1647],"2020-09-14",{"path":2092,"title":2093,"description":2094,"categories":2095,"draft":1649,"year":2096,"series":6},"\u002Fblog\u002Fstart-oss-today","Start your Open Source journey today","Start your OSS journey with intro to GIT. Participate in Hacktoberfest!",[1790,1647],"2020-09-19",{"path":2098,"title":2099,"description":2100,"categories":2101,"draft":1649,"year":2103,"series":6},"\u002Fblog\u002Fsticky-social-bar","Sticky social share component in HTML","Learn how to build a social media sharing component in HTML and add it to your website.",[1647,2102],"Frontend","2021-02-05",{"path":2105,"title":2106,"description":2107,"categories":2108,"draft":1649,"year":2109,"series":6},"\u002Fblog\u002Fterm-insurance","Term insurance Simplified","Everything you need to know before you buy a term insurance.",[1680,1984],"2020-11-29",{"path":2111,"title":2112,"description":2113,"categories":2114,"draft":1649,"year":2116,"series":6},"\u002Fblog\u002Fterminal-output-with-redirection","Handling terminal outputs with Redirection","Learn how to handle terminal outputs with Redirection and saving it to files",[1933,2115,1647],"Terminal","2020-09-06",{"path":2118,"title":2119,"description":2120,"categories":2121,"draft":1649,"year":2122,"series":6},"\u002Fblog\u002Fthink-and-grow-rich","Book Notes: Think and Grow Rich","My notes and highlights from Think and Grow Rich by Napoleon Hill, covering its process for building wealth.",[1679,1680],"2020-05-19",{"path":2124,"title":2125,"description":2126,"categories":2127,"draft":1649,"year":2128,"series":6},"\u002Fblog\u002Ftransactions-postgres-golang","Transactions on Postgres with Golang","Performing Postgres database operations in Golang with GORM, from basic queries to full transaction support.",[1646,1852,1647],"2020-03-18",{"path":2130,"title":2131,"description":2132,"categories":2133,"draft":1649,"year":2134,"series":6},"\u002Fblog\u002Fwaitgroups-in-golang","WaitGroups in Golang","Learn about WaitGroups in golang and how to use them to perform concurrent operations without blocking the main thread.",[1646,1647],"2022-05-31",{"path":2136,"title":2137,"description":2138,"categories":2139,"draft":1649,"year":2141,"series":6},"\u002Fblog\u002Fwhat-i-use","What I Use: Products and Softwares","List of what I use in my day to day life ranging from terminal, editors, softwares, devices to accessories",[1680,2140],"Tech","2024-06-01",{"path":2143,"title":2144,"description":2145,"categories":2146,"draft":1649,"year":2147,"series":6},"\u002Fblog\u002Fyear-in-review-2020","Year in Review: 2020","It's a wrap! 2020 was a crazy year, See how my year went!",[1680],"2020-12-31",{"path":2149,"title":2150,"description":2151,"categories":2152,"draft":1649,"year":2153,"series":6},"\u002Fblog\u002Fyear-in-review-2021","Year in Review: 2021","It's a wrap! 2021 was a mixed bag, full of ups and downs. Key Goal for 2022: Start now!",[1680],"2021-12-31",1788773187955]