Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Unmarshal ¶
Example ¶
configuration := `# DEVICES UT0311-L0x.405419896.name = BOARD1 UT0311-L0x.405419896.address = 192.168.1.100:60000 UT0311-L0x.54321.name = BOARD2 UT0311-L0x.54321.address = 192.168.1.101:60000 ` config := struct { Devices deviceMap `conf:"/UT0311-L0x\\.([0-9]+)\\.(\\w+)/"` }{} err := Unmarshal([]byte(configuration), &config) if err != nil { fmt.Printf("ERROR: %v", err) return } for id, d := range config.Devices { fmt.Printf("DEVICE: %-10d %s\n", id, d) }
Output: DEVICE: 405419896 BOARD1 192.168.1.100:60000 DEVICE: 54321 BOARD2 192.168.1.101:60000
Types ¶
Click to show internal directories.
Click to hide internal directories.