Standard library / net
net.ParseMAC()
Parse a supported hardware address notation. This does not inspect the network. Expected stdout: '02:00:00:00:00:01\n'.
Formal Syntax & Structure
go syntaxgo
func ParseMAC(s string) (hw HardwareAddr, err error)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| s | string | Textual address or prefix to parse. |
Return Value
(hw HardwareAddr, err error)
Operation result; check errors and validity indicators when returned.
Working Example
Example Snippetgo
package main
import ( "fmt" "net")
func main() { fmt.Println(must(net.ParseMAC("02:00:00:00:00:01"))) }
func must[T any](v T, e error) T { if e != nil { panic(e) } return v}func check(e error) { if e != nil { panic(e) }}