Source:
protected GoVisitor buildGoVisitor(@NotNull final ProblemsHolder holder, @NotNull LocalInspectionToolSession session) { return new GoVisitor() { @Override public void visitPackageClause(@NotNull GoPackageClause o) { String packageName = o.getName(); if (GoConstants.MAIN.equals(packageName)) { return; } List<PsiComment> comments = GoDocumentationProvider.getCommentsForElement(o); String commentText = GoDocumentationProvider.getCommentText(comments, false); if (!comments.isEmpty() && !commentText.isEmpty() && !commentText.startsWith("Package " + packageName)) { registerProblem(comments, "Package comment should be of the form 'Package " + packageName + " ...'", holder); } } @Override public void visitCompositeElement(@NotNull GoCompositeElement o) { if (!shouldInspect(o)) { return; } List<PsiComment> comments = GoDocumentationProvider.getCommentsForElement(o); String commentText = GoDocumentationProvider.getCommentText(comments, false); String elementName = ((GoNamedElement)o).getName(); if (elementName == null) { return; } if (!comments.isEmpty() && !commentText.isEmpty()) { if (!isCorrectComment(commentText, elementName)) { registerProblem(comments, "Comment should start with '" + elementName + "'", holder); } else if (commentText.length() <= elementName.length() + 1) { registerProblem(comments, "Comment should be meaningful or it should be removed", holder); } } else { PsiElement identifier = ((GoNamedElement)o).getIdentifier(); if (identifier != null) { holder.registerProblem(identifier, String.format("'%s' should have a comment or not be exported", elementName), ProblemHighlightType.WEAK_WARNING); } } } }; }

Target:
protected GoVisitor buildGoVisitor(@NotNull final ProblemsHolder holder, @NotNull LocalInspectionToolSession session) { return new GoVisitor() { @Override public void visitPackageClause(@NotNull GoPackageClause o) { super.visitPackageClause(o); String packageName = o.getName(); if (GoConstants.MAIN.equals(packageName)) return; List<PsiComment> comments = GoDocumentationProvider.getCommentsForElement(o); String commentText = GoDocumentationProvider.getCommentText(comments, false); if (!comments.isEmpty() && !commentText.isEmpty() && !commentText.startsWith("Package " + packageName)) { registerProblem(comments, "Package comment should be of the form 'Package " + packageName + " ...'", holder); } } @Override public void visitCompositeElement(@NotNull GoCompositeElement o) { super.visitCompositeElement(o); if (!shouldInspect(o)) return; boolean isBlockComment = false; int elementsInBlock = 0; PsiElement specElement = o; if (o instanceof GoVarDefinition || o instanceof GoConstDefinition) { specElement = o.getParent(); } List<PsiComment> comments = GoDocumentationProvider.getCommentsInner(specElement); if (comments.size() == 0) { comments = GoDocumentationProvider.getCommentsForElement(o); isBlockComment = true; elementsInBlock = getElementsInBlockCount(specElement); } String commentText = GoDocumentationProvider.getCommentText(comments, false); String elementName = ((GoNamedElement)o).getName(); if (elementName == null) return; if (comments.isEmpty() || commentText.isEmpty()) { PsiElement identifier = ((GoNamedElement)o).getIdentifier(); if (identifier != null) { holder.registerProblem(identifier, String.format("'%s' should have a comment or not be exported", elementName), ProblemHighlightType.WEAK_WARNING); } } else if (!isCorrectComment(commentText, elementName, isBlockComment, elementsInBlock)) { registerProblem(comments, "Comment should start with '" + elementName + "'", holder); } else if (commentText.length() <= elementName.length() + 1) { registerProblem(comments, "Comment should be meaningful or it should be removed", holder); } } }; }