in pkg/graphql/metadata/metadata.go [247:269]
func BackendVersion(cliCtx *cli.Context) (major, minor int, err error) {
version, err := common.Version(cliCtx)
if err != nil {
return 0, 0, err
}
if version == "" {
return 0, 0, fmt.Errorf("failed to detect OAP version")
}
versions := backendVersion.FindStringSubmatch(version)
if len(versions) != 3 {
return 0, 0, fmt.Errorf("parsing OAP version failure: %s", version)
}
major, err = strconv.Atoi(versions[1])
if err != nil {
return 0, 0, fmt.Errorf("parse major failure: %s", version)
}
minor, err = strconv.Atoi(versions[2])
if err != nil {
return 0, 0, fmt.Errorf("parse minor failure: %s", version)
}
return major, minor, nil
}