Source:
<code>protected GoVisitor buildGoVisitor(@NotNull ProblemsHolder holder, @NotNull LocalInspectionToolSession session) { return new GoVisitor(){ <START> <END> @Override public void visitVarSpec(@NotNull GoVarSpec o) { super.visitVarSpec(o); for(int i = 0; i < o.getExpressionList().size(); ++i){ check(o.getVarDefinitionList().get(i).getGoType(null), o.getVarDefinitionList().get(i).getValue()); } } @Override public void visitAssignOp(@NotNull GoAssignOp o) { super.visitAssignOp(o); PsiElement[] right = o.getParent().getChildren(); if(right == null) return; List<GoExpression> left = ((GoLeftHandExprList)right[0]).getExpressionList(); if(left == null) return; for(int i = 0; i < left.size(); ++i){ GoExpression var = left.get(i); PsiElement value = right[right.length - (left.size() - i)]; if(value instanceof GoExpression){ check(var.getGoType(null), (GoExpression)value); } } } @Override public void visitBinaryExpr(@NotNull GoBinaryExpr o) { super.visitBinaryExpr(o); if(o.getOperator().getText().equals(GoTypes.EQ.toString()) || o.getOperator().getText().equals(GoTypes.NOT_EQ.toString())){ check(o.getLeft().getGoType(null), o.getRight()); check(o.getRight().getGoType(null), o.getLeft()); } } protected void check(GoType var, GoExpression value){ if(var == null || value == null) return; if(GoTypeUtil.isString(var)) { if(value.getText().equals(GoConstants.NIL)){ holder.registerProblem(value, PROBLEM_DESC, new LocalQuickFix() { @Nls @NotNull @Override public String getFamilyName() { return "Change to default value"; } @Override public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) { value.replace(GoElementFactory.createExpression(project, DEFAULT_STRING)); } }); } } } }; }</code><technical_language>code style</technical_language>

Target:
protected GoVisitor buildGoVisitor(@NotNull ProblemsHolder holder, @NotNull LocalInspectionToolSession session) { return new GoVisitor() { @Override public void visitVarSpec(@NotNull GoVarSpec o) { super.visitVarSpec(o); if (o.getVarDefinitionList() == null) return; o.getVarDefinitionList().forEach(var -> check(var, var != null ? var.getValue() : null)); } @Override public void visitAssignmentStatement(@NotNull GoAssignmentStatement o) { super.visitAssignmentStatement(o); if (o.getLeftHandExprList() == null) return; List<GoExpression> rightSide = o.getExpressionList(); List<GoExpression> leftSide = o.getLeftHandExprList().getExpressionList(); if (leftSide == null || rightSide == null) return; IntStream.range(0, Math.min(leftSide.size(), rightSide.size())) .forEach(i -> check(leftSide.get(i), rightSide.get(i))); } @Override public void visitBinaryExpr(@NotNull GoBinaryExpr o) { super.visitBinaryExpr(o); if (o.getOperator() == null || o.getOperator().getNode() == null) return; IElementType type = o.getOperator().getNode().getElementType(); if (type == GoTypes.EQ || type == GoTypes.NOT_EQ) { check(o.getLeft(), o.getRight()); check(o.getRight(), o.getLeft()); } } protected void check(GoTypeOwner var, GoExpression value) { if (var == null || value == null) return; GoType varType = var.getGoType(null); if (!GoTypeUtil.isString(varType)) return; if (value instanceof GoReferenceExpression && value.textMatches(GoConstants.NIL) && GoPsiImplUtil.builtin(((GoReferenceExpression)value).resolve())) { holder.registerProblem(value, PROBLEM_DESCRIPTION, ProblemHighlightType.GENERIC_ERROR_OR_WARNING, new GoChangeStringToDefaultValueQuickFix()); } } }; }