Standard library / runtime/debug
debug.ParseBuildInfo()
Parses textual build information, returning an error for invalid encodings. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func ParseBuildInfo(data string) (bi *BuildInfo, err error)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| data | string | Textual Go build information, as emitted by BuildInfo.String. |
Return Value
(bi *BuildInfo, err error)
Parsed build metadata or a parsing error.
Working Example
Example Snippetgo
package main
import ( "fmt" "runtime/debug")
func main() { info, err := debug.ParseBuildInfo("go\tgo1.23.2\npath\texample.invalid/demo\n") fmt.Println(err == nil && info.Path == "example.invalid/demo")}