in src/main/kotlin/org/jetbrains/tinygoplugin/services/ErrorRegexUtil.kt [16:49]
fun generateMessageIfVersionErrorFound(project: Project, processOutput: String): String? {
val incompatibleGoVersionsMatch = extractIncompatibleVersionsError(processOutput)
val errorMessage =
when {
incompatibleGoVersionsMatch != null -> {
val (currentVer, oldestVer, latestVer) = incompatibleGoVersionsMatch
TinyGoBundle.message(
TINYGO_INCOMPATIBLE_GO_VERSION_RANGE_SPECIFIED_MESSAGE,
currentVer,
oldestVer,
latestVer
)
}
extractCouldNotReadGoVersionError(processOutput) -> {
val goSdk = project.service<GoSdkService>().getSdk(null)
val currentVer = goSdk.version ?: TinyGoBundle.message(TINYGO_INCOMPATIBLE_GO_VERSION_UNKNOWN)
TinyGoBundle.message(
TINYGO_INCOMPATIBLE_GO_VERSION_RANGE_UNSPECIFIED_MESSAGE,
currentVer
)
}
else -> null
}
if (errorMessage != null) {
Messages.showErrorDialog(
project,
errorMessage,
TinyGoBundle.message(TINYGO_INCOMPATIBLE_GO_VERSION_TITLE)
)
}
return errorMessage
}