import ( "github.com/mitchellh/packer/packer" "github.com/mitchellh/packer/packer/ui/error" ) err := fmt.Errorf("Template error: %s", errMsg) packer.Ui().Error(err, nil)
import ( "github.com/mitchellh/packer/packer" "github.com/mitchellh/packer/packer/ui/error" ) err := fmt.Errorf("Provisioner error: %s", errMessage) packer.Ui().Error(err, map[string]string{ "bold": "true", "textColor": "red", })In this example, we're creating a new error message using the `fmt.Errorf()` function and passing it to the `packer.Ui().Error()` function along with a map of attributes that define how the error message should be displayed. Here, we've set the text color to red and made the text bold using the `bold` attribute. Overall, the "github.com/mitchellh/packer/packer/ui/error" package provides a convenient way to display error messages in the Packer UI and customize their appearance.