[Golang] Specify an array in the value of map

Overview

I wanted Go to put an array in value in the map, so my memo

Implementation

package main

import "fmt"

type Hoge struct {
	Say string
}

func main()  {
	a := map[string][]Hoge{}
	a["hoge"] = append(a["hoge"], Hoge{Say: "hello1"})
	a["hoge"] = append(a["hoge"], Hoge{Say: "hello2"})
	a["hoge1"] = append(a["hoge1"], Hoge{Say: "hello3"})
	fmt.Println(a)
}

If you go run above

map[hoge:[{hello1} {hello2}] hoge1:[{hello3}]]

Array is put in the value of map like

Recommended Posts

[Golang] Specify an array in the value of map
The story of an error in PyOCR
Open an Excel file in Python and color the map of Japan
Find the divisor of the value entered in python
Fix the argument of the function used in map
[Python numpy] Dynamically specify the index of the array
Output in the form of a python array
Search by the value of the instance in the list
[Fundamental Information Technology Engineer Examination] I wrote an algorithm for the maximum value of an array in Python.
[Python] Summary of functions that return the index that takes the closest value in the array
Specify the lighting Model of SCN Material in Pythonista
Quicksort an array in Python 3
Code that sets the default value in case of AttributeError
Find the index of the maximum value (minimum value) of a multidimensional array
Sort the string array in order of length & Japanese syllabary
How to specify an infinite number of tolerances in the numeric argument validation check of argparse
Specify the encoding of the unicode string in the Python 2.x print statement
Find the definition of the value of errno
How to get rid of the "Tags must be an array of hashes." Error in the qiita api
How to know the internal structure of an object in Python
The story of participating in AtCoder
About the return value of pthread_mutex_init ()
Install GoLang in goenv of anyenv
About the return value of the histogram.
The story of the "hole" in the file
The meaning of ".object" in Django
Various ways to create an array of numbers from 1 to 10 in Python.
Comparing the basic grammar of Python and Go in an easy-to-understand manner
[Android] Display images on the web in the info Window of Google Map
The process of repeatedly extracting an array differs slightly depending on the language ...
I want to leave an arbitrary command in the command history of Shell
I tried to display the altitude value of DTM in a graph
Get the return value of an external shell script (ls) with python3
An example of the answer to the reference question of the study session. In python.
[Understanding in 3 minutes] The beginning of Linux
Check the behavior of destructor in Python
It's an implementation of ConnectionPool in redis.py
Implement part of the process in C ++
The story of making an immutable mold
The result of installing python in Anaconda
Let's claim the possibility of pyenv-virtualenv in 2021
The basics of running NoxPlayer in Python
Get the value of the middle layer of NN
I read the implementation of golang channel
In search of the fastest FizzBuzz in Python
Install the package in an offline environment
[Python] Combine all the elements in the array
Make the default value of the argument immutable
plot the coordinates of the processing (python) list and specify the number of times in draw ()
You will be an engineer in 100 days --Day 29 --Python --Basics of the Python language 5
Set the number of elements in a NumPy one-dimensional array to a power of 2 (0 padded)
You will be an engineer in 100 days --Day 33 --Python --Basics of the Python language 8
You will be an engineer in 100 days --Day 26 --Python --Basics of the Python language 3
Summarizing the commercial value of an EC site using the automatic summarization algorithm LexRank
To output a value even in the middle of a cell with Jupyter Notebook
I made an appdo command to execute a command in the context of the app
Save an array of numpy to a wav file using the wave module
Set an upper limit on the number of recursive function iterations in Python
Compare the sum of each element in two lists with the specified value in Python
You will be an engineer in 100 days --Day 32 --Python --Basics of the Python language 7
I want to store the result of% time, %% time, etc. in an object (variable)