func fetchInstanceType() (string, error) {
	var err error
	var instanceType string

	// trying to get region from managed instance registration
	if instanceType = managedInstance.InstanceType(); instanceType != "" {
		return instanceType, nil
	}

	// trying to get instance id from ec2 metadata
	if instanceType, err = metadata.GetMetadata("instance-type"); instanceType != "" && err == nil {
		return instanceType, nil
	}

	// return combined error messages
	return "", fmt.Errorf(errorMessage, "instance Type", err)
}
// fetchInstanceType fetches the instance type with the following preference order.
// 1. managed instance registration
// 2. EC2 Instance Metadata
fetchInstanceType fetches the instance type with the following preference order.
1. managed instance registration
2. EC2 Instance Metadata
// fetchInstanceType fetches the instance type with the following preference order . // 1 . managed instance registration // 2 . EC2 Instance Metadata
func fetchInstanceType() (string, error) {
	var err error
	var instanceType string
	if instanceType = managedInstance.InstanceType(); instanceType != "" {
		return instanceType, nil
	}
	if instanceType, err = metadata.GetMetadata("instance-type"); instanceType != "" && err == nil {
		return instanceType, nil
	}
	return "", fmt.Errorf(errorMessage, "instance Type", err)
}
func fetchInstanceType ( ) ( string , error ) { var err error var instanceType string if instanceType = managedInstance . InstanceType ( ) ; instanceType != " " { return instanceType , nil } if instanceType , err = metadata . GetMetadata ( " " ) ; instanceType != " " && err == nil { return instanceType , nil } return " " , fmt . Errorf ( errorMessage , " " , err ) }
fetchInstanceType fetches the instance type with the following preference order.
fetchInstanceType fetches the instance type with the following preference order .
// trying to get region from managed instance registration // trying to get instance id from ec2 metadata // return combined error messages