This allows multiple Metrics to be stored in a map
Created
October 25, 2012 11:50
-
-
Save RadioactiveMouse/3952170 to your computer and use it in GitHub Desktop.
Struct Mapping
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
import "time" | |
type Metric struct { | |
Name string | |
DateTime time.Time | |
Value int | |
} | |
func main() { | |
MetricList := make(map[int]Metric) | |
MetricList[0] = Metric{"Tom",time.Now(),24} | |
MetricList[1] = Metric{"Laura",time.Now(),25} | |
fmt.Printf("%+v \n", MetricList) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment