Source:
private static void checkPrintf( @NotNull ProblemsHolder holder, @NotNull GoCallExpr callExpr, @NotNull GoFunctionOrMethodDeclaration declaration) { int placeholderPosition = GoPlaceholderChecker.getPlaceholderPosition(declaration); List<GoExpression> arguments = callExpr.getArgumentList().getExpressionList(); if (arguments.isEmpty()) return; int callArgsNum = arguments.size(); if (placeholderPosition < 0 || callArgsNum <= placeholderPosition) return; GoExpression placeholder = arguments.get(placeholderPosition); if (!GoTypeUtil.isString(placeholder.getGoType(null))) { String message = "Value used for formatting text does not appear to be a string"; holder.registerProblem(placeholder, message, ProblemHighlightType.GENERIC_ERROR_OR_WARNING); return; } String placeholderText = GoPlaceholderChecker.resolve(placeholder); if (placeholderText == null) return; if (!GoPlaceholderChecker.hasPlaceholder(placeholderText) && callArgsNum > placeholderPosition) { String message = "Value used for formatting text does not appear to contain a placeholder"; holder.registerProblem(placeholder, message, ProblemHighlightType.GENERIC_ERROR_OR_WARNING); return; } callArgsNum--; List<Placeholder> placeholders = GoPlaceholderChecker.parsePrintf(placeholderText); for (Placeholder fmtPlaceholder : placeholders) { if (!checkPrintfArgument(holder, placeholder, callExpr, arguments, callArgsNum, placeholderPosition, fmtPlaceholder)) return; } if (hasErrors(holder, placeholder, placeholders)) return; int maxArgsNum = computeMaxArgsNum(placeholders, placeholderPosition); if (GoPsiImplUtil.hasVariadic(callExpr.getArgumentList()) && maxArgsNum >= callArgsNum) { return; } if (maxArgsNum != callArgsNum) { int expect = maxArgsNum - placeholderPosition; int numArgs = callArgsNum - placeholderPosition; String message = String.format("Got %d placeholder(s) for %d arguments(s)", expect, numArgs); holder.registerProblem(placeholder, message, ProblemHighlightType.GENERIC_ERROR_OR_WARNING); } }

Target:
private static void checkPrintf(@NotNull ProblemsHolder holder, @NotNull GoCallExpr callExpr, @NotNull GoFunctionOrMethodDeclaration declaration) { int placeholderPosition = GoPlaceholderChecker.getPlaceholderPosition(declaration); List<GoExpression> arguments = callExpr.getArgumentList().getExpressionList(); if (arguments.isEmpty()) return; int callArgsNum = arguments.size(); if (placeholderPosition < 0 || callArgsNum <= placeholderPosition) return; GoExpression placeholder = arguments.get(placeholderPosition); if (!GoTypeUtil.isString(placeholder.getGoType(null))) { String message = "Value used for formatting text does not appear to be a string #loc"; holder.registerProblem(placeholder, message, ProblemHighlightType.GENERIC_ERROR_OR_WARNING); return; } String placeholderText = resolve(placeholder); if (placeholderText == null) return; if (!GoPlaceholderChecker.hasPlaceholder(placeholderText) && callArgsNum > placeholderPosition) { String message = "Value used for formatting text does not appear to contain a placeholder #loc"; holder.registerProblem(placeholder, message, ProblemHighlightType.GENERIC_ERROR_OR_WARNING); return; } callArgsNum--; List<Placeholder> placeholders = GoPlaceholderChecker.parsePrintf(placeholderText); for (Placeholder fmtPlaceholder : placeholders) { if (!checkPrintfArgument(holder, placeholder, callExpr, arguments, callArgsNum, placeholderPosition, fmtPlaceholder)) return; } if (hasErrors(holder, placeholder, placeholders)) return; int maxArgsNum = computeMaxArgsNum(placeholders, placeholderPosition); if (GoPsiImplUtil.hasVariadic(callExpr.getArgumentList()) && maxArgsNum >= callArgsNum) { return; } if (maxArgsNum != callArgsNum) { int expect = maxArgsNum - placeholderPosition; int numArgs = callArgsNum - placeholderPosition; String message = String.format("Got %d placeholder(s) for %d arguments(s) #loc", expect, numArgs); holder.registerProblem(placeholder, message, ProblemHighlightType.GENERIC_ERROR_OR_WARNING); } }