How to declare empty Map in Go?
In this example an empty map
employee
is declared outside main
function.
Example
package main
import "fmt"
var employee = map[string]int{}
func main() {
fmt.Println(employee)
}
Output
map[]
Most Helpful This Week
How to import structs from another package in Go?
How to check if a string contains a substring in Golang?
Regular expression to extract numbers from a string in Golang
How to Remove duplicate values from Slice?
Print index and element or data from Array, Slice and Map
Example: Arrays of Arrays, Arrays of Slices, Slices of Arrays and Slices of Slices