Repository: reviewdog/reviewdog
Pull request #689 (2020-07-25 10:19:54)

Use Diagnostic.original_output internally and remove CheckResult type
follow up of #688


- [x] Updated Unreleased section in [CHANGELOG](https://github.com/reviewdog/reviewdog/blob/master/CHANGELOG.md) or it's not notable changes.




Patch:
diff --git a/cmd/reviewdog/doghouse.go b/cmd/reviewdog/doghouse.go
index 0dd6b9d1..6fbda8bb 100644
--- a/cmd/reviewdog/doghouse.go
+++ b/cmd/reviewdog/doghouse.go
@@ -10,7 +10,6 @@ import (
 	"os"
 	"path/filepath"
 	"sort"
-	"strings"
 
 	"golang.org/x/oauth2"
 	"golang.org/x/sync/errgroup"
@@ -20,6 +19,7 @@ import (
 	"github.com/reviewdog/reviewdog/doghouse"
 	"github.com/reviewdog/reviewdog/doghouse/client"
 	"github.com/reviewdog/reviewdog/project"
+	"github.com/reviewdog/reviewdog/proto/rdf"
 	"github.com/reviewdog/reviewdog/service/github/githubutils"
 	"github.com/reviewdog/reviewdog/service/serviceutil"
 )
@@ -99,13 +99,13 @@ func checkResultSet(ctx context.Context, r io.Reader, opt *option, isProject boo
 		if err != nil {
 			return nil, err
 		}
-		rs, err := p.Parse(r)
+		diagnostics, err := p.Parse(r)
 		if err != nil {
 			return nil, err
 		}
 		resultSet.Store(toolName(opt), &reviewdog.Result{
-			Level:        opt.level,
-			CheckResults: rs,
+			Level:       opt.level,
+			Diagnostics: diagnostics,
 		})
 	}
 	return resultSet, nil
@@ -121,10 +121,10 @@ func postResultSet(ctx context.Context, resultSet *reviewdog.ResultMap,
 	}
 	filteredResultSet := new(reviewdog.FilteredResultMap)
 	resultSet.Range(func(name string, result *reviewdog.Result) {
-		checkResults := result.CheckResults
-		as := make([]*doghouse.Annotation, 0, len(checkResults))
-		for _, r := range checkResults {
-			as = append(as, checkResultToAnnotation(r, wd, gitRelWd))
+		diagnostics := result.Diagnostics
+		as := make([]*doghouse.Annotation, 0, len(diagnostics))
+		for _, d := range diagnostics {
+			as = append(as, checkResultToAnnotation(d, wd, gitRelWd))
 		}
 		req := &doghouse.CheckRequest{
 			Name:        name,
@@ -178,12 +178,11 @@ func postResultSet(ctx context.Context, resultSet *reviewdog.ResultMap,
 	return filteredResultSet, g.Wait()
 }
 
-func checkResultToAnnotation(c *reviewdog.CheckResult, wd, gitRelWd string) *doghouse.Annotation {
-	c.Diagnostic.GetLocation().Path = filepath.ToSlash(filepath.Join(
-		gitRelWd, reviewdog.CleanPath(c.Diagnostic.GetLocation().GetPath(), wd)))
+func checkResultToAnnotation(d *rdf.Diagnostic, wd, gitRelWd string) *doghouse.Annotation {
+	d.GetLocation().Path = filepath.ToSlash(filepath.Join(
+		gitRelWd, reviewdog.CleanPath(d.GetLocation().GetPath(), wd)))
 	return &doghouse.Annotation{
-		Diagnostic: c.Diagnostic,
-		RawMessage: strings.Join(c.Lines, "\n"),
+		Diagnostic: d,
 	}
 }
 
@@ -237,12 +236,10 @@ report results via logging command [1].
 
 			foundResultPerName = true
 			if cienv.IsInGitHubAction() {
-				githubutils.ReportAsGitHubActionsLog(name, results.Level, result.CheckResult)
+				githubutils.ReportAsGitHubActionsLog(name, results.Level, result.Diagnostic)
 			} else {
 				// Output original lines.
-				for _, line := range result.Lines {
-					fmt.Fprintln(w, line)
-				}
+				fmt.Fprintln(w, result.Diagnostic.GetOriginalOutput())
 			}
 		}
 		if !foundResultPerName {
diff --git a/comment_iowriter.go b/comment_iowriter.go
index 40f80b02..a5661970 100644
--- a/comment_iowriter.go
+++ b/comment_iowriter.go
@@ -4,7 +4,6 @@ import (
 	"context"
 	"fmt"
 	"io"
-	"strings"
 )
 
 var _ CommentService = &RawCommentWriter{}
@@ -20,7 +19,7 @@ func NewRawCommentWriter(w io.Writer) *RawCommentWriter {
 }
 
 func (s *RawCommentWriter) Post(_ context.Context, c *Comment) error {
-	_, err := fmt.Fprintln(s.w, strings.Join(c.Result.Lines, "\n"))
+	_, err := fmt.Fprintln(s.w, c.Result.Diagnostic.OriginalOutput)
 	return err
 }
 
diff --git a/doghouse/server/doghouse.go b/doghouse/server/doghouse.go
index d4b9facf..acd210b9 100644
--- a/doghouse/server/doghouse.go
+++ b/doghouse/server/doghouse.go
@@ -50,7 +50,7 @@ func (ch *Checker) Check(ctx context.Context) (*doghouse.CheckResponse, error) {
 		}
 	}
 
-	results := annotationsToCheckResults(ch.req.Annotations)
+	results := annotationsToDiagnostics(ch.req.Annotations)
 	filterMode := ch.req.FilterMode
 	//lint:ignore SA1019 Need to support OutsideDiff for backward compatibility.
 	if ch.req.PullRequest == 0 || ch.req.OutsideDiff {
@@ -224,8 +224,8 @@ func (ch *Checker) summaryFindings(name string, checks []*reviewdog.FilteredChec
 			lines = append(lines, "... (Too many findings. Dropped some findings)")
 			break
 		}
-		lines = append(lines, githubutils.LinkedMarkdownCheckResult(
-			ch.req.Owner, ch.req.Repo, ch.req.SHA, c.CheckResult))
+		lines = append(lines, githubutils.LinkedMarkdownDiagnostic(
+			ch.req.Owner, ch.req.Repo, ch.req.SHA, c.Diagnostic))
 	}
 	lines = append(lines, "</details>")
 	return lines
@@ -263,7 +263,7 @@ func (ch *Checker) toCheckRunAnnotation(c *reviewdog.FilteredCheck) *github.Chec
 		}
 		a.Title = github.String(fmt.Sprintf("[%s] %s#%s", toolName, loc.GetPath(), line))
 	}
-	if s := strings.Join(c.Lines, "\n"); s != "" {
+	if s := c.Diagnostic.GetOriginalOutput(); s != "" {
 		a.RawDetails = github.String(s)
 	}
 	return a
@@ -289,35 +289,30 @@ func (ch *Checker) rawPullRequestDiff(ctx context.Context, pr int) ([]byte, erro
 	return d, nil
 }
 
-func annotationsToCheckResults(as []*doghouse.Annotation) []*reviewdog.CheckResult {
-	cs := make([]*reviewdog.CheckResult, 0, len(as))
+func annotationsToDiagnostics(as []*doghouse.Annotation) []*rdf.Diagnostic {
+	ds := make([]*rdf.Diagnostic, 0, len(as))
 	for _, a := range as {
-		cs = append(cs, annotationToCheckResult(a))
+		ds = append(ds, annotationToDiagnostic(a))
 	}
-	return cs
+	return ds
 }
 
-func annotationToCheckResult(a *doghouse.Annotation) *reviewdog.CheckResult {
+func annotationToDiagnostic(a *doghouse.Annotation) *rdf.Diagnostic {
 	if a.Diagnostic != nil {
-		return &reviewdog.CheckResult{
-			Diagnostic: a.Diagnostic,
-			Lines:      strings.Split(a.RawMessage, "\n"),
-		}
+		return a.Diagnostic
 	}
 	// Old reviwedog CLI doesn't have the Diagnostic field.
-	return &reviewdog.CheckResult{
-		Diagnostic: &rdf.Diagnostic{
-			Location: &rdf.Location{
-				Path: a.Path,
-				Range: &rdf.Range{
-					Start: &rdf.Position{
-						Line: int32(a.Line),
-					},
+	return &rdf.Diagnostic{
+		Location: &rdf.Location{
+			Path: a.Path,
+			Range: &rdf.Range{
+				Start: &rdf.Position{
+					Line: int32(a.Line),
 				},
 			},
-			Message: a.Message,
 		},
-		Lines: strings.Split(a.RawMessage, "\n"),
+		Message:        a.Message,
+		OriginalOutput: a.RawMessage,
 	}
 }
 
diff --git a/doghouse/service.go b/doghouse/service.go
index b8c9630b..97e18ba4 100644
--- a/doghouse/service.go
+++ b/doghouse/service.go
@@ -79,10 +79,6 @@ type Annotation struct {
 	// Optional.
 	Diagnostic *rdf.Diagnostic `json:"diagnostic,omitempty"`
 
-	// Original error message of this annotation.
-	// Optional.
-	RawMessage string `json:"raw_message,omitempty"`
-
 	// DEPRECATED fields below. Need to support them for the old reviewdog CLI
 	// version.
 
@@ -92,4 +88,6 @@ type Annotation struct {
 	Line int `json:"line,omitempty"`
 	// DEPRECATED: Use Diagnostic.
 	Message string `json:"message,omitempty"`
+	// DEPRECATED: Use Diagnostic.
+	RawMessage string `json:"raw_message,omitempty"`
 }
diff --git a/filter.go b/filter.go
index 09649c28..aa4b3d45 100644
--- a/filter.go
+++ b/filter.go
@@ -5,11 +5,12 @@ import (
 
 	"github.com/reviewdog/reviewdog/diff"
 	"github.com/reviewdog/reviewdog/difffilter"
+	"github.com/reviewdog/reviewdog/proto/rdf"
 )
 
-// FilteredCheck represents CheckResult with filtering info.
+// FilteredCheck represents Diagnostic with filtering info.
 type FilteredCheck struct {
-	*CheckResult
+	Diagnostic   *rdf.Diagnostic
 	ShouldReport bool
 	// false if the result is outside diff files.
 	InDiffFile bool
@@ -23,13 +24,13 @@ type FilteredCheck struct {
 
 // FilterCheck filters check results by diff. It doesn't drop check which
 // is not in diff but set FilteredCheck.ShouldReport field false.
-func FilterCheck(results []*CheckResult, diff []*diff.FileDiff, strip int,
+func FilterCheck(results []*rdf.Diagnostic, diff []*diff.FileDiff, strip int,
 	cwd string, mode difffilter.Mode) []*FilteredCheck {
 	checks := make([]*FilteredCheck, 0, len(results))
 	df := difffilter.New(diff, strip, cwd, mode)
 	for _, result := range results {
-		check := &FilteredCheck{CheckResult: result}
-		loc := result.Diagnostic.GetLocation()
+		check := &FilteredCheck{Diagnostic: result}
+		loc := result.GetLocation()
 		startLine := int(loc.GetRange().GetStart().GetLine())
 		endLine := int(loc.GetRange().GetEnd().GetLine())
 		if endLine == 0 {
diff --git a/parser.go b/parser.go
index bf0a4c58..8bb1d4c2 100644
--- a/parser.go
+++ b/parser.go
@@ -6,6 +6,7 @@ import (
 	"errors"
 	"fmt"
 	"io"
+	"strings"
 
 	"github.com/reviewdog/errorformat"
 	"github.com/reviewdog/errorformat/fmts"
@@ -71,26 +72,24 @@ func NewErrorformatParserString(efms []string) (*ErrorformatParser, error) {
 	return NewErrorformatParser(efm), nil
 }
 
-func (p *ErrorformatParser) Parse(r io.Reader) ([]*CheckResult, error) {
+func (p *ErrorformatParser) Parse(r io.Reader) ([]*rdf.Diagnostic, error) {
 	s := p.efm.NewScanner(r)
-	var rs []*CheckResult
+	var rs []*rdf.Diagnostic
 	for s.Scan() {
 		e := s.Entry()
 		if e.Valid {
-			rs = append(rs, &CheckResult{
-				Diagnostic: &rdf.Diagnostic{
-					Location: &rdf.Location{
-						Path: e.Filename,
-						Range: &rdf.Range{
-							Start: &rdf.Position{
-								Line:   int32(e.Lnum),
-								Column: int32(e.Col),
-							},
+			rs = append(rs, &rdf.Diagnostic{
+				Location: &rdf.Location{
+					Path: e.Filename,
+					Range: &rdf.Range{
+						Start: &rdf.Position{
+							Line:   int32(e.Lnum),
+							Column: int32(e.Col),
 						},
 					},
-					Message: e.Text,
 				},
-				Lines: e.Lines,
+				Message:        e.Text,
+				OriginalOutput: strings.Join(e.Lines, "\n"),
 			})
 		}
 	}
@@ -107,31 +106,27 @@ func NewCheckStyleParser() Parser {
 	return &CheckStyleParser{}
 }
 
-func (p *CheckStyleParser) Parse(r io.Reader) ([]*CheckResult, error) {
+func (p *CheckStyleParser) Parse(r io.Reader) ([]*rdf.Diagnostic, error) {
 	var cs = new(CheckStyleResult)
 	if err := xml.NewDecoder(r).Decode(cs); err != nil {
 		return nil, err
 	}
-	var rs []*CheckResult
+	var rs []*rdf.Diagnostic
 	for _, file := range cs.Files {
 		for _, cerr := range file.Errors {
-			rs = append(rs, &CheckResult{
-				Diagnostic: &rdf.Diagnostic{
-					Location: &rdf.Location{
-						Path: file.Name,
-						Range: &rdf.Range{
-							Start: &rdf.Position{
-								Line:   int32(cerr.Line),
-								Column: int32(cerr.Column),
-							},
+			rs = append(rs, &rdf.Diagnostic{
+				Location: &rdf.Location{
+					Path: file.Name,
+					Range: &rdf.Range{
+						Start: &rdf.Position{
+							Line:   int32(cerr.Line),
+							Column: int32(cerr.Column),
 						},
 					},
-					Message: cerr.Message,
-				},
-				Lines: []string{
-					fmt.Sprintf("%v:%d:%d: %v: %v (%v)",
-						file.Name, cerr.Line, cerr.Column, cerr.Severity, cerr.Message, cerr.Source),
 				},
+				Message: cerr.Message,
+				OriginalOutput: fmt.Sprintf("%v:%d:%d: %v: %v (%v)",
+					file.Name, cerr.Line, cerr.Column, cerr.Severity, cerr.Message, cerr.Source),
 			})
 		}
 	}
@@ -172,15 +167,19 @@ func NewRDJSONLParser() *RDJSONLParser {
 	return &RDJSONLParser{}
 }
 
-func (p *RDJSONLParser) Parse(r io.Reader) ([]*CheckResult, error) {
-	var results []*CheckResult
+func (p *RDJSONLParser) Parse(r io.Reader) ([]*rdf.Diagnostic, error) {
+	var results []*rdf.Diagnostic
 	s := bufio.NewScanner(r)
 	for s.Scan() {
 		d := new(rdf.Diagnostic)
 		if err := protojson.Unmarshal(s.Bytes(), d); err != nil {
 			return nil, err
 		}
-		results = append(results, &CheckResult{Diagnostic: d, Lines: []string{s.Text()}})
+		if d.GetOriginalOutput() == "" {
+			// TODO(haya14busa): Refactor not to fill in original output.
+			d.OriginalOutput = s.Text()
+		}
+		results = append(results, d)
 	}
 	return results, nil
 }
diff --git a/project/run.go b/project/run.go
index 1a68b174..c904719e 100644
--- a/project/run.go
+++ b/project/run.go
@@ -57,7 +57,7 @@ func RunAndParse(ctx context.Context, conf *Config, runners map[string]bool, def
 		}
 		g.Go(func() error {
 			defer func() { <-semaphore }()
-			rs, err := p.Parse(io.MultiReader(stdout, stderr))
+			diagnostics, err := p.Parse(io.MultiReader(stdout, stderr))
 			if err != nil {
 				return err
 			}
@@ -67,10 +67,10 @@ func RunAndParse(ctx context.Context, conf *Config, runners map[string]bool, def
 			}
 			cmdErr := cmd.Wait()
 			results.Store(runnerName, &reviewdog.Result{
-				Name:         runnerName,
-				Level:        level,
-				CheckResults: rs,
-				CmdErr:       cmdErr,
+				Name:        runnerName,
+				Level:       level,
+				Diagnostics: diagnostics,
+				CmdErr:      cmdErr,
 			})
 			msg := fmt.Sprintf("reviewdog: [finish]\trunner=%s", runnerName)
 			if cmdErr != nil {
@@ -109,12 +109,12 @@ func Run(ctx context.Context, conf *Config, runners map[string]bool, c reviewdog
 	}
 	var g errgroup.Group
 	results.Range(func(toolname string, result *reviewdog.Result) {
-		rs := result.CheckResults
+		ds := result.Diagnostics
 		g.Go(func() error {
 			if err := result.CheckUnexpectedFailure(); err != nil {
 				return err
 			}
-			return reviewdog.RunFromResult(ctx, c, rs, filediffs, d.Strip(), toolname, filterMode, failOnError)
+			return reviewdog.RunFromResult(ctx, c, ds, filediffs, d.Strip(), toolname, filterMode, failOnError)
 		})
 	})
 	return g.Wait()
diff --git a/resultmap.go b/resultmap.go
index 0f765d92..588b2e32 100644
--- a/resultmap.go
+++ b/resultmap.go
@@ -4,20 +4,22 @@ import (
 	"errors"
 	"fmt"
 	"sync"
+
+	"github.com/reviewdog/reviewdog/proto/rdf"
 )
 
-// ResultMap represents a concurrent-safe map to store CheckResults generated by concurrent jobs.
+// ResultMap represents a concurrent-safe map to store Diagnostics generated by concurrent jobs.
 type ResultMap struct {
 	sm sync.Map
 }
 
 type Result struct {
-	Name         string
-	Level        string
-	CheckResults []*CheckResult
+	Name        string
+	Level       string
+	Diagnostics []*rdf.Diagnostic
 
 	// Optional. Report an error of the command execution.
-	// Non-nil CmdErr doesn't mean failure and CheckResults still may have
+	// Non-nil CmdErr doesn't mean failure and Diagnostics still may have
 	// results.
 	// It is common that a linter fails with non-zero exit code when it finds
 	// lint errors.
@@ -26,7 +28,7 @@ type Result struct {
 
 // CheckUnexpectedFailure returns error on unexpected failure, if any.
 func (r *Result) CheckUnexpectedFailure() error {
-	if r.CmdErr != nil && len(r.CheckResults) == 0 {
+	if r.CmdErr != nil && len(r.Diagnostics) == 0 {
 		return fmt.Errorf("%s failed with zero findings: The command itself "+
 			"failed (%v) or reviewdog cannot parse the results", r.Name, r.CmdErr)
 	}
@@ -76,7 +78,7 @@ type FilteredResult struct {
 	FilteredCheck []*FilteredCheck
 }
 
-// FilteredResultMap represents a concurrent-safe map to store CheckResults generated by concurrent jobs.
+// FilteredResultMap represents a concurrent-safe map to store Diagnostics generated by concurrent jobs.
 type FilteredResultMap struct {
 	sm sync.Map
 }
diff --git a/reviewdog.go b/reviewdog.go
index 7d72b12d..d3038b0d 100644
--- a/reviewdog.go
+++ b/reviewdog.go
@@ -30,22 +30,15 @@ func NewReviewdog(toolname string, p Parser, c CommentService, d DiffService, fi
 }
 
 // RunFromResult creates a new Reviewdog and runs it with check results.
-func RunFromResult(ctx context.Context, c CommentService, results []*CheckResult,
+func RunFromResult(ctx context.Context, c CommentService, results []*rdf.Diagnostic,
 	filediffs []*diff.FileDiff, strip int, toolname string, filterMode difffilter.Mode, failOnError bool) error {
 	return (&Reviewdog{c: c, toolname: toolname, filterMode: filterMode, failOnError: failOnError}).runFromResult(ctx, results, filediffs, strip, failOnError)
 }
 
-// CheckResult represents a checked result of static analysis tools.
-// :h error-file-format
-type CheckResult struct {
-	Diagnostic *rdf.Diagnostic
-	Lines      []string // Original error lines (often one line). (Optional)
-}
-
 // Parser is an interface which parses compilers, linters, or any tools
 // results.
 type Parser interface {
-	Parse(r io.Reader) ([]*CheckResult, error)
+	Parse(r io.Reader) ([]*rdf.Diagnostic, error)
 }
 
 // Comment represents a reported result as a comment.
@@ -73,7 +66,7 @@ type DiffService interface {
 	Strip() int
 }
 
-func (w *Reviewdog) runFromResult(ctx context.Context, results []*CheckResult,
+func (w *Reviewdog) runFromResult(ctx context.Context, results []*rdf.Diagnostic,
 	filediffs []*diff.FileDiff, strip int, failOnError bool) error {
 	wd, err := os.Getwd()
 	if err != nil {
diff --git a/service/github/github.go b/service/github/github.go
index adf65e0b..38b457da 100644
--- a/service/github/github.go
+++ b/service/github/github.go
@@ -89,7 +89,7 @@ func (g *GitHubPullRequest) postAsReviewComment(ctx context.Context) error {
 			// GitHub Review API cannot report results outside diff. If it's running
 			// in GitHub Actions, fallback to GitHub Actions log as report .
 			if cienv.IsInGitHubAction() {
-				githubutils.ReportAsGitHubActionsLog(c.ToolName, "warning", c.Result.CheckResult)
+				githubutils.ReportAsGitHubActionsLog(c.ToolName, "warning", c.Result.Diagnostic)
 			}
 			continue
 		}
@@ -177,7 +177,7 @@ func (g *GitHubPullRequest) remainingCommentsSummary(remaining []*reviewdog.Comm
 		sb.WriteString(fmt.Sprintf("<summary>%s</summary>\n", tool))
 		sb.WriteString("\n")
 		for _, c := range comments {
-			sb.WriteString(githubutils.LinkedMarkdownCheckResult(g.owner, g.repo, g.sha, c.Result.CheckResult))
+			sb.WriteString(githubutils.LinkedMarkdownDiagnostic(g.owner, g.repo, g.sha, c.Result.Diagnostic))
 			sb.WriteString("\n")
 		}
 		sb.WriteString("</details>\n")
diff --git a/service/github/githubutils/comment_writer.go b/service/github/githubutils/comment_writer.go
index 0acf2645..1e8b84d6 100644
--- a/service/github/githubutils/comment_writer.go
+++ b/service/github/githubutils/comment_writer.go
@@ -3,11 +3,11 @@ package githubutils
 import (
 	"context"
 	"fmt"
-	"strings"
 	"sync"
 
 	"github.com/haya14busa/go-actions-toolkit/core"
 	"github.com/reviewdog/reviewdog"
+	"github.com/reviewdog/reviewdog/proto/rdf"
 )
 
 const MaxLoggingAnnotationsPerStep = 10
@@ -32,7 +32,7 @@ func (lw *GitHubActionLogWriter) Post(_ context.Context, c *reviewdog.Comment) e
 	if lw.reportNum == MaxLoggingAnnotationsPerStep {
 		WarnTooManyAnnotationOnce()
 	}
-	ReportAsGitHubActionsLog(c.ToolName, lw.level, c.Result.CheckResult)
+	ReportAsGitHubActionsLog(c.ToolName, lw.level, c.Result.Diagnostic)
 	return nil
 }
 
@@ -47,13 +47,13 @@ func (lw *GitHubActionLogWriter) Flush(_ context.Context) error {
 // ReportAsGitHubActionsLog reports results via logging command to create
 // annotations.
 // https://help.github.com/en/actions/automating-your-workflow-with-github-actions/development-tools-for-github-actions#example-5
-func ReportAsGitHubActionsLog(toolName, level string, c *reviewdog.CheckResult) {
+func ReportAsGitHubActionsLog(toolName, level string, d *rdf.Diagnostic) {
 	mes := fmt.Sprintf("[%s] reported by reviewdog 🐶\n%s\n\nRaw Output:\n%s",
-		toolName, c.Diagnostic.GetMessage(), strings.Join(c.Lines, "\n"))
-	loc := c.Diagnostic.GetLocation()
+		toolName, d.GetMessage(), d.GetOriginalOutput())
+	loc := d.GetLocation()
 	start := loc.GetRange().GetStart()
 	opt := &core.LogOption{
-		File: c.Diagnostic.GetLocation().GetPath(),
+		File: d.GetLocation().GetPath(),
 		Line: int(start.GetLine()),
 		Col:  int(start.GetColumn()),
 	}
diff --git a/service/github/githubutils/utils.go b/service/github/githubutils/utils.go
index 44549eeb..49a801c4 100644
--- a/service/github/githubutils/utils.go
+++ b/service/github/githubutils/utils.go
@@ -3,19 +3,19 @@ package githubutils
 import (
 	"fmt"
 
-	"github.com/reviewdog/reviewdog"
+	"github.com/reviewdog/reviewdog/proto/rdf"
 )
 
-// LinkedMarkdownCheckResult returns Markdown string which contains a link to the
-// location in the CheckResult and CheckResult content itself.
-func LinkedMarkdownCheckResult(owner, repo, sha string, c *reviewdog.CheckResult) string {
-	path := c.Diagnostic.GetLocation().GetPath()
-	msg := c.Diagnostic.GetMessage()
+// LinkedMarkdownDiagnostic returns Markdown string which contains a link to the
+// location in the diagnostic and the diagnostic content itself.
+func LinkedMarkdownDiagnostic(owner, repo, sha string, d *rdf.Diagnostic) string {
+	path := d.GetLocation().GetPath()
+	msg := d.GetMessage()
 	if path == "" {
 		return msg
 	}
-	loc := BasicLocationFormat(c)
-	line := int(c.Diagnostic.GetLocation().GetRange().GetStart().GetLine())
+	loc := BasicLocationFormat(d)
+	line := int(d.GetLocation().GetRange().GetStart().GetLine())
 	link := PathLink(owner, repo, sha, path, line)
 	return fmt.Sprintf("[%s](%s) %s", loc, link, msg)
 }
@@ -33,9 +33,9 @@ func PathLink(owner, repo, sha, path string, line int) string {
 		owner, repo, sha, path, fragment)
 }
 
-// BasicLocationFormat format check CheckResult to %f|%l col %c| errorformat.
-func BasicLocationFormat(c *reviewdog.CheckResult) string {
-	loc := c.Diagnostic.GetLocation()
+// BasicLocationFormat format a diagnostic to %f|%l col %c| errorformat.
+func BasicLocationFormat(d *rdf.Diagnostic) string {
+	loc := d.GetLocation()
 	out := loc.GetPath() + "|"
 	lnum := int(loc.GetRange().GetStart().GetLine())
 	col := int(loc.GetRange().GetStart().GetColumn())


Test patch:
diff --git a/cmd/reviewdog/doghouse_test.go b/cmd/reviewdog/doghouse_test.go
index 737e63b3..91bde139 100644
--- a/cmd/reviewdog/doghouse_test.go
+++ b/cmd/reviewdog/doghouse_test.go
@@ -115,29 +115,27 @@ func TestNewDoghouseServerCli(t *testing.T) {
 	}
 }
 
-func TestCheckResultSet_Project(t *testing.T) {
+func TestDiagnosticResultSet_Project(t *testing.T) {
 	defer func(f func(ctx context.Context, conf *project.Config, runners map[string]bool, level string, tee bool) (*reviewdog.ResultMap, error)) {
 		projectRunAndParse = f
 	}(projectRunAndParse)
 
-	var wantCheckResult reviewdog.ResultMap
-	wantCheckResult.Store("name1", &reviewdog.Result{CheckResults: []*reviewdog.CheckResult{
+	var wantDiagnosticResult reviewdog.ResultMap
+	wantDiagnosticResult.Store("name1", &reviewdog.Result{Diagnostics: []*rdf.Diagnostic{
 		{
-			Diagnostic: &rdf.Diagnostic{
-				Location: &rdf.Location{
-					Range: &rdf.Range{Start: &rdf.Position{
-						Line:   1,
-						Column: 14,
-					}},
-					Path: "reviewdog.go",
-				},
-				Message: "msg",
+			Location: &rdf.Location{
+				Range: &rdf.Range{Start: &rdf.Position{
+					Line:   1,
+					Column: 14,
+				}},
+				Path: "reviewdog.go",
 			},
+			Message: "msg",
 		},
 	}})
 
 	projectRunAndParse = func(ctx context.Context, conf *project.Config, runners map[string]bool, level string, tee bool) (*reviewdog.ResultMap, error) {
-		return &wantCheckResult, nil
+		return &wantDiagnosticResult, nil
 	}
 
 	tmp, err := ioutil.TempFile("", "")
@@ -151,18 +149,18 @@ func TestCheckResultSet_Project(t *testing.T) {
 		t.Fatal(err)
 	}
 
-	if got.Len() != wantCheckResult.Len() {
-		t.Errorf("length of results is different. got = %d, want = %d\n", got.Len(), wantCheckResult.Len())
+	if got.Len() != wantDiagnosticResult.Len() {
+		t.Errorf("length of results is different. got = %d, want = %d\n", got.Len(), wantDiagnosticResult.Len())
 	}
 	got.Range(func(k string, r *reviewdog.Result) {
-		w, _ := wantCheckResult.Load(k)
+		w, _ := wantDiagnosticResult.Load(k)
 		if diff := cmp.Diff(r, w, protocmp.Transform()); diff != "" {
 			t.Errorf("result has diff:\n%s", diff)
 		}
 	})
 }
 
-func TestCheckResultSet_NonProject(t *testing.T) {
+func TestDiagnosticResultSet_NonProject(t *testing.T) {
 	opt := &option{
 		f: "golint",
 	}
@@ -172,19 +170,17 @@ func TestCheckResultSet_NonProject(t *testing.T) {
 		t.Fatal(err)
 	}
 	var want reviewdog.ResultMap
-	want.Store("golint", &reviewdog.Result{CheckResults: []*reviewdog.CheckResult{
+	want.Store("golint", &reviewdog.Result{Diagnostics: []*rdf.Diagnostic{
 		{
-			Diagnostic: &rdf.Diagnostic{
-				Location: &rdf.Location{
-					Range: &rdf.Range{Start: &rdf.Position{
-						Line:   14,
-						Column: 14,
-					}},
-					Path: "reviewdog.go",
-				},
-				Message: "test message",
+			Location: &rdf.Location{
+				Range: &rdf.Range{Start: &rdf.Position{
+					Line:   14,
+					Column: 14,
+				}},
+				Path: "reviewdog.go",
 			},
-			Lines: []string{input},
+			Message:        "test message",
+			OriginalOutput: input,
 		},
 	}})
 
@@ -242,8 +238,8 @@ func TestPostResultSet_withReportURL(t *testing.T) {
 								Start: &rdf.Position{Line: 14},
 							},
 						},
+						OriginalOutput: "L1\nL2",
 					},
-					RawMessage: "L1\nL2",
 				},
 				{
 					Diagnostic: &rdf.Diagnostic{
@@ -280,39 +276,33 @@ func TestPostResultSet_withReportURL(t *testing.T) {
 
 	// It assumes the current dir is ./cmd/reviewdog/
 	var resultSet reviewdog.ResultMap
-	resultSet.Store("name1", &reviewdog.Result{CheckResults: []*reviewdog.CheckResult{
+	resultSet.Store("name1", &reviewdog.Result{Diagnostics: []*rdf.Diagnostic{
 		{
-			Diagnostic: &rdf.Diagnostic{
-				Location: &rdf.Location{
-					Range: &rdf.Range{Start: &rdf.Position{
-						Line: 14,
-					}},
-					Path: "reviewdog.go", // test relative path
-				},
-				Message: "name1: test 1",
+			Location: &rdf.Location{
+				Range: &rdf.Range{Start: &rdf.Position{
+					Line: 14,
+				}},
+				Path: "reviewdog.go", // test relative path
 			},
-			Lines: []string{"L1", "L2"},
+			Message:        "name1: test 1",
+			OriginalOutput: "L1\nL2",
 		},
 		{
-			Diagnostic: &rdf.Diagnostic{
-				Location: &rdf.Location{
-					Path: absPath(t, "reviewdog.go"), // test abs path
-				},
-				Message: "name1: test 2",
+			Location: &rdf.Location{
+				Path: absPath(t, "reviewdog.go"), // test abs path
 			},
+			Message: "name1: test 2",
 		},
 	}})
-	resultSet.Store("name2", &reviewdog.Result{CheckResults: []*reviewdog.CheckResult{
+	resultSet.Store("name2", &reviewdog.Result{Diagnostics: []*rdf.Diagnostic{
 		{
-			Diagnostic: &rdf.Diagnostic{
-				Location: &rdf.Location{
-					Range: &rdf.Range{Start: &rdf.Position{
-						Line: 14,
-					}},
-					Path: "doghouse.go",
-				},
-				Message: "name2: test 1",
+			Location: &rdf.Location{
+				Range: &rdf.Range{Start: &rdf.Position{
+					Line: 14,
+				}},
+				Path: "doghouse.go",
 			},
+			Message: "name2: test 1",
 		},
 	}})
 
@@ -344,7 +334,7 @@ func TestPostResultSet_withoutReportURL(t *testing.T) {
 	}
 
 	var resultSet reviewdog.ResultMap
-	resultSet.Store("name1", &reviewdog.Result{CheckResults: []*reviewdog.CheckResult{}})
+	resultSet.Store("name1", &reviewdog.Result{Diagnostics: []*rdf.Diagnostic{}})
 
 	ghInfo := &cienv.BuildInfo{Owner: owner, Repo: repo, PullRequest: prNum, SHA: sha}
 
@@ -375,7 +365,7 @@ func TestPostResultSet_conclusion(t *testing.T) {
 
 	fakeCli := &fakeDoghouseServerCli{}
 	var resultSet reviewdog.ResultMap
-	resultSet.Store("name1", &reviewdog.Result{CheckResults: []*reviewdog.CheckResult{}})
+	resultSet.Store("name1", &reviewdog.Result{Diagnostics: []*rdf.Diagnostic{}})
 	ghInfo := &cienv.BuildInfo{Owner: owner, Repo: repo, PullRequest: prNum, SHA: sha}
 
 	tests := []struct {
@@ -420,7 +410,7 @@ func TestPostResultSet_withEmptyResponse(t *testing.T) {
 	}
 
 	var resultSet reviewdog.ResultMap
-	resultSet.Store("name1", &reviewdog.Result{CheckResults: []*reviewdog.CheckResult{}})
+	resultSet.Store("name1", &reviewdog.Result{Diagnostics: []*rdf.Diagnostic{}})
 
 	ghInfo := &cienv.BuildInfo{Owner: owner, Repo: repo, PullRequest: prNum, SHA: sha}
 
@@ -440,14 +430,14 @@ func TestReportResults(t *testing.T) {
 	filteredResultSet.Store("name1", &reviewdog.FilteredResult{
 		FilteredCheck: []*reviewdog.FilteredCheck{
 			{
-				CheckResult: &reviewdog.CheckResult{
-					Lines: []string{"name1-L1", "name1-L2"},
+				Diagnostic: &rdf.Diagnostic{
+					OriginalOutput: "name1-L1\nname1-L2",
 				},
 				ShouldReport: true,
 			},
 			{
-				CheckResult: &reviewdog.CheckResult{
-					Lines: []string{"name1.2-L1", "name1.2-L2"},
+				Diagnostic: &rdf.Diagnostic{
+					OriginalOutput: "name1.2-L1\nname1.2-L2",
 				},
 				ShouldReport: false,
 			},
@@ -456,8 +446,8 @@ func TestReportResults(t *testing.T) {
 	filteredResultSet.Store("name2", &reviewdog.FilteredResult{
 		FilteredCheck: []*reviewdog.FilteredCheck{
 			{
-				CheckResult: &reviewdog.CheckResult{
-					Lines: []string{"name1-L1", "name1-L2"},
+				Diagnostic: &rdf.Diagnostic{
+					OriginalOutput: "name1-L1\nname1-L2",
 				},
 				ShouldReport: false,
 			},
@@ -489,8 +479,8 @@ func TestReportResults_inGitHubAction(t *testing.T) {
 	filteredResultSet.Store("name1", &reviewdog.FilteredResult{
 		FilteredCheck: []*reviewdog.FilteredCheck{
 			{
-				CheckResult: &reviewdog.CheckResult{
-					Lines: []string{"name1-L1", "name1-L2"},
+				Diagnostic: &rdf.Diagnostic{
+					OriginalOutput: "name1-L1\nname1-L2",
 				},
 				ShouldReport: true,
 			},
@@ -515,14 +505,14 @@ func TestReportResults_noResultsShouldReport(t *testing.T) {
 	filteredResultSet.Store("name1", &reviewdog.FilteredResult{
 		FilteredCheck: []*reviewdog.FilteredCheck{
 			{
-				CheckResult: &reviewdog.CheckResult{
-					Lines: []string{"name1-L1", "name1-L2"},
+				Diagnostic: &rdf.Diagnostic{
+					OriginalOutput: "name1-L1\nname1-L2",
 				},
 				ShouldReport: false,
 			},
 			{
-				CheckResult: &reviewdog.CheckResult{
-					Lines: []string{"name1.2-L1", "name1.2-L2"},
+				Diagnostic: &rdf.Diagnostic{
+					OriginalOutput: "name1.2-L1\nname1.2-L2",
 				},
 				ShouldReport: false,
 			},
@@ -531,8 +521,8 @@ func TestReportResults_noResultsShouldReport(t *testing.T) {
 	filteredResultSet.Store("name2", &reviewdog.FilteredResult{
 		FilteredCheck: []*reviewdog.FilteredCheck{
 			{
-				CheckResult: &reviewdog.CheckResult{
-					Lines: []string{"name1-L1", "name1-L2"},
+				Diagnostic: &rdf.Diagnostic{
+					OriginalOutput: "name1-L1\nname1-L2",
 				},
 				ShouldReport: false,
 			},
diff --git a/comment_iowriter_test.go b/comment_iowriter_test.go
index b6ab0438..2105c3ab 100644
--- a/comment_iowriter_test.go
+++ b/comment_iowriter_test.go
@@ -16,9 +16,9 @@ func TestUnifiedCommentWriter_Post(t *testing.T) {
 	}{
 		{
 			in: &Comment{
-				Result: &FilteredCheck{CheckResult: &CheckResult{
+				Result: &FilteredCheck{
 					Diagnostic: &rdf.Diagnostic{Location: &rdf.Location{Path: "/path/to/file"}},
-				}},
+				},
 				ToolName: "tool name",
 				Body:     "message",
 			},
@@ -26,14 +26,14 @@ func TestUnifiedCommentWriter_Post(t *testing.T) {
 		},
 		{
 			in: &Comment{
-				Result: &FilteredCheck{CheckResult: &CheckResult{
+				Result: &FilteredCheck{
 					Diagnostic: &rdf.Diagnostic{Location: &rdf.Location{
 						Path: "/path/to/file",
 						Range: &rdf.Range{Start: &rdf.Position{
 							Column: 14,
 						}},
 					}},
-				}},
+				},
 				ToolName: "tool name",
 				Body:     "message",
 			},
@@ -41,14 +41,14 @@ func TestUnifiedCommentWriter_Post(t *testing.T) {
 		},
 		{
 			in: &Comment{
-				Result: &FilteredCheck{CheckResult: &CheckResult{
+				Result: &FilteredCheck{
 					Diagnostic: &rdf.Diagnostic{Location: &rdf.Location{
 						Path: "/path/to/file",
 						Range: &rdf.Range{Start: &rdf.Position{
 							Line: 14,
 						}},
 					}},
-				}},
+				},
 				ToolName: "tool name",
 				Body:     "message",
 			},
@@ -56,7 +56,7 @@ func TestUnifiedCommentWriter_Post(t *testing.T) {
 		},
 		{
 			in: &Comment{
-				Result: &FilteredCheck{CheckResult: &CheckResult{
+				Result: &FilteredCheck{
 					Diagnostic: &rdf.Diagnostic{Location: &rdf.Location{
 						Path: "/path/to/file",
 						Range: &rdf.Range{Start: &rdf.Position{
@@ -64,7 +64,7 @@ func TestUnifiedCommentWriter_Post(t *testing.T) {
 							Column: 7,
 						}},
 					}},
-				}},
+				},
 				ToolName: "tool name",
 				Body:     "line1\nline2",
 			},
diff --git a/comment_test.go b/comment_test.go
index 66fb53f7..d9e64216 100644
--- a/comment_test.go
+++ b/comment_test.go
@@ -5,6 +5,8 @@ import (
 	"context"
 	"strings"
 	"testing"
+
+	"github.com/reviewdog/reviewdog/proto/rdf"
 )
 
 func TestMultiCommentService_Post(t *testing.T) {
@@ -14,7 +16,7 @@ func TestMultiCommentService_Post(t *testing.T) {
 
 	const want = "line1\nline2"
 
-	c := &Comment{Result: &FilteredCheck{CheckResult: &CheckResult{Lines: strings.Split(want, "\n")}}}
+	c := &Comment{Result: &FilteredCheck{Diagnostic: &rdf.Diagnostic{OriginalOutput: want}}}
 	if err := w.Post(context.Background(), c); err != nil {
 		t.Fatal(err)
 	}
diff --git a/doghouse/server/doghouse_test.go b/doghouse/server/doghouse_test.go
index 6ee58773..bd919804 100644
--- a/doghouse/server/doghouse_test.go
+++ b/doghouse/server/doghouse_test.go
@@ -82,8 +82,8 @@ func TestCheck_OK(t *testing.T) {
 							Start: &rdf.Position{Line: 2, Column: 1},
 						},
 					},
+					OriginalOutput: "raw test message",
 				},
-				RawMessage: "raw test message",
 			},
 			{
 				Diagnostic: &rdf.Diagnostic{
@@ -94,8 +94,8 @@ func TestCheck_OK(t *testing.T) {
 							Start: &rdf.Position{Line: 14},
 						},
 					},
+					OriginalOutput: "raw test message outside diff",
 				},
-				RawMessage: "raw test message outside diff",
 			},
 			{
 				Diagnostic: &rdf.Diagnostic{
@@ -160,9 +160,10 @@ func TestCheck_OK(t *testing.T) {
 				},
 			},
 			{
-				Path:    "sample.new.txt",
-				Line:    2,
-				Message: "request from old clients",
+				Path:       "sample.new.txt",
+				Line:       2,
+				Message:    "request from old clients",
+				RawMessage: "raw message from old clients",
 			},
 		},
 		Level: "warning",
@@ -253,6 +254,7 @@ func TestCheck_OK(t *testing.T) {
 					AnnotationLevel: github.String("warning"),
 					Message:         github.String("request from old clients"),
 					Title:           github.String("[haya14busa-linter] sample.new.txt#L2"),
+					RawDetails:      github.String("raw message from old clients"),
 				},
 			}
 			if d := cmp.Diff(annotations, wantAnnotations); d != "" {
@@ -300,8 +302,8 @@ func testOutsideDiff(t *testing.T, outsideDiff bool, filterMode difffilter.Mode)
 							Start: &rdf.Position{Line: 2},
 						},
 					},
+					OriginalOutput: "raw test message",
 				},
-				RawMessage: "raw test message",
 			},
 			{
 				Diagnostic: &rdf.Diagnostic{
@@ -312,8 +314,8 @@ func testOutsideDiff(t *testing.T, outsideDiff bool, filterMode difffilter.Mode)
 							Start: &rdf.Position{Line: 14},
 						},
 					},
+					OriginalOutput: "raw test message outside diff",
 				},
-				RawMessage: "raw test message outside diff",
 			},
 		},
 		Level:       "warning",
@@ -406,8 +408,8 @@ func TestCheck_OK_multiple_update_runs(t *testing.T) {
 						Start: &rdf.Position{Line: 2},
 					},
 				},
+				OriginalOutput: "raw test message",
 			},
-			RawMessage: "raw test message",
 		})
 	}
 
@@ -473,8 +475,8 @@ func TestCheck_OK_nonPullRequests(t *testing.T) {
 							Start: &rdf.Position{Line: 2},
 						},
 					},
+					OriginalOutput: "raw test message",
 				},
-				RawMessage: "raw test message",
 			},
 			{
 				Diagnostic: &rdf.Diagnostic{
@@ -485,8 +487,8 @@ func TestCheck_OK_nonPullRequests(t *testing.T) {
 							Start: &rdf.Position{Line: 14},
 						},
 					},
+					OriginalOutput: "raw test message2",
 				},
-				RawMessage: "raw test message2",
 			},
 		},
 		Level: "warning",
diff --git a/filter_test.go b/filter_test.go
index 1a7cfded..8c01c73b 100644
--- a/filter_test.go
+++ b/filter_test.go
@@ -45,60 +45,48 @@ index 0000000..264c67e
 `
 
 func TestFilterCheckByAddedLines(t *testing.T) {
-	results := []*CheckResult{
+	results := []*rdf.Diagnostic{
 		{
-			Diagnostic: &rdf.Diagnostic{
-				Location: &rdf.Location{
-					Path:  "sample.new.txt",
-					Range: &rdf.Range{Start: &rdf.Position{Line: 1}},
-				},
+			Location: &rdf.Location{
+				Path:  "sample.new.txt",
+				Range: &rdf.Range{Start: &rdf.Position{Line: 1}},
 			},
 		},
 		{
-			Diagnostic: &rdf.Diagnostic{
-				Location: &rdf.Location{
-					Path:  "sample.new.txt",
-					Range: &rdf.Range{Start: &rdf.Position{Line: 2}},
-				},
+			Location: &rdf.Location{
+				Path:  "sample.new.txt",
+				Range: &rdf.Range{Start: &rdf.Position{Line: 2}},
 			},
 		},
 		{
-			Diagnostic: &rdf.Diagnostic{
-				Location: &rdf.Location{
-					Path:  "nonewline.new.txt",
-					Range: &rdf.Range{Start: &rdf.Position{Line: 1}},
-				},
+			Location: &rdf.Location{
+				Path:  "nonewline.new.txt",
+				Range: &rdf.Range{Start: &rdf.Position{Line: 1}},
 			},
 		},
 		{
-			Diagnostic: &rdf.Diagnostic{
-				Location: &rdf.Location{
-					Path:  "nonewline.new.txt",
-					Range: &rdf.Range{Start: &rdf.Position{Line: 3}},
-				},
+			Location: &rdf.Location{
+				Path:  "nonewline.new.txt",
+				Range: &rdf.Range{Start: &rdf.Position{Line: 3}},
 			},
 		},
 		{
-			Diagnostic: &rdf.Diagnostic{
-				Message: "outside range (start)",
-				Location: &rdf.Location{
-					Path: "sample.new.txt",
-					Range: &rdf.Range{
-						Start: &rdf.Position{Line: 1},
-						End:   &rdf.Position{Line: 2},
-					},
+			Message: "outside range (start)",
+			Location: &rdf.Location{
+				Path: "sample.new.txt",
+				Range: &rdf.Range{
+					Start: &rdf.Position{Line: 1},
+					End:   &rdf.Position{Line: 2},
 				},
 			},
 		},
 	}
 	want := []*FilteredCheck{
 		{
-			CheckResult: &CheckResult{
-				Diagnostic: &rdf.Diagnostic{
-					Location: &rdf.Location{
-						Path:  "sample.new.txt",
-						Range: &rdf.Range{Start: &rdf.Position{Line: 1}},
-					},
+			Diagnostic: &rdf.Diagnostic{
+				Location: &rdf.Location{
+					Path:  "sample.new.txt",
+					Range: &rdf.Range{Start: &rdf.Position{Line: 1}},
 				},
 			},
 			ShouldReport:  false,
@@ -108,12 +96,10 @@ func TestFilterCheckByAddedLines(t *testing.T) {
 			OldLine:       1,
 		},
 		{
-			CheckResult: &CheckResult{
-				Diagnostic: &rdf.Diagnostic{
-					Location: &rdf.Location{
-						Path:  "sample.new.txt",
-						Range: &rdf.Range{Start: &rdf.Position{Line: 2}},
-					},
+			Diagnostic: &rdf.Diagnostic{
+				Location: &rdf.Location{
+					Path:  "sample.new.txt",
+					Range: &rdf.Range{Start: &rdf.Position{Line: 2}},
 				},
 			},
 			ShouldReport:  true,
@@ -123,12 +109,10 @@ func TestFilterCheckByAddedLines(t *testing.T) {
 			OldLine:       0,
 		},
 		{
-			CheckResult: &CheckResult{
-				Diagnostic: &rdf.Diagnostic{
-					Location: &rdf.Location{
-						Path:  "nonewline.new.txt",
-						Range: &rdf.Range{Start: &rdf.Position{Line: 1}},
-					},
+			Diagnostic: &rdf.Diagnostic{
+				Location: &rdf.Location{
+					Path:  "nonewline.new.txt",
+					Range: &rdf.Range{Start: &rdf.Position{Line: 1}},
 				},
 			},
 			ShouldReport:  false,
@@ -138,12 +122,10 @@ func TestFilterCheckByAddedLines(t *testing.T) {
 			OldLine:       1,
 		},
 		{
-			CheckResult: &CheckResult{
-				Diagnostic: &rdf.Diagnostic{
-					Location: &rdf.Location{
-						Path:  "nonewline.new.txt",
-						Range: &rdf.Range{Start: &rdf.Position{Line: 3}},
-					},
+			Diagnostic: &rdf.Diagnostic{
+				Location: &rdf.Location{
+					Path:  "nonewline.new.txt",
+					Range: &rdf.Range{Start: &rdf.Position{Line: 3}},
 				},
 			},
 			ShouldReport:  true,
@@ -153,15 +135,13 @@ func TestFilterCheckByAddedLines(t *testing.T) {
 			OldLine:       0,
 		},
 		{
-			CheckResult: &CheckResult{
-				Diagnostic: &rdf.Diagnostic{
-					Message: "outside range (start)",
-					Location: &rdf.Location{
-						Path: "sample.new.txt",
-						Range: &rdf.Range{
-							Start: &rdf.Position{Line: 1},
-							End:   &rdf.Position{Line: 2},
-						},
+			Diagnostic: &rdf.Diagnostic{
+				Message: "outside range (start)",
+				Location: &rdf.Location{
+					Path: "sample.new.txt",
+					Range: &rdf.Range{
+						Start: &rdf.Position{Line: 1},
+						End:   &rdf.Position{Line: 2},
 					},
 				},
 			},
@@ -181,40 +161,32 @@ func TestFilterCheckByAddedLines(t *testing.T) {
 
 // All lines that are in diff are taken into account
 func TestFilterCheckByDiffContext(t *testing.T) {
-	results := []*CheckResult{
+	results := []*rdf.Diagnostic{
 		{
-			Diagnostic: &rdf.Diagnostic{
-				Location: &rdf.Location{
-					Path:  "sample.new.txt",
-					Range: &rdf.Range{Start: &rdf.Position{Line: 1}},
-				},
+			Location: &rdf.Location{
+				Path:  "sample.new.txt",
+				Range: &rdf.Range{Start: &rdf.Position{Line: 1}},
 			},
 		},
 		{
-			Diagnostic: &rdf.Diagnostic{
-				Location: &rdf.Location{
-					Path:  "sample.new.txt",
-					Range: &rdf.Range{Start: &rdf.Position{Line: 2}},
-				},
+			Location: &rdf.Location{
+				Path:  "sample.new.txt",
+				Range: &rdf.Range{Start: &rdf.Position{Line: 2}},
 			},
 		},
 		{
-			Diagnostic: &rdf.Diagnostic{
-				Location: &rdf.Location{
-					Path:  "sample.new.txt",
-					Range: &rdf.Range{Start: &rdf.Position{Line: 3}},
-				},
+			Location: &rdf.Location{
+				Path:  "sample.new.txt",
+				Range: &rdf.Range{Start: &rdf.Position{Line: 3}},
 			},
 		},
 	}
 	want := []*FilteredCheck{
 		{
-			CheckResult: &CheckResult{
-				Diagnostic: &rdf.Diagnostic{
-					Location: &rdf.Location{
-						Path:  "sample.new.txt",
-						Range: &rdf.Range{Start: &rdf.Position{Line: 1}},
-					},
+			Diagnostic: &rdf.Diagnostic{
+				Location: &rdf.Location{
+					Path:  "sample.new.txt",
+					Range: &rdf.Range{Start: &rdf.Position{Line: 1}},
 				},
 			},
 			ShouldReport:  true,
@@ -224,12 +196,10 @@ func TestFilterCheckByDiffContext(t *testing.T) {
 			OldLine:       1,
 		},
 		{
-			CheckResult: &CheckResult{
-				Diagnostic: &rdf.Diagnostic{
-					Location: &rdf.Location{
-						Path:  "sample.new.txt",
-						Range: &rdf.Range{Start: &rdf.Position{Line: 2}},
-					},
+			Diagnostic: &rdf.Diagnostic{
+				Location: &rdf.Location{
+					Path:  "sample.new.txt",
+					Range: &rdf.Range{Start: &rdf.Position{Line: 2}},
 				},
 			},
 			ShouldReport:  true,
@@ -239,12 +209,10 @@ func TestFilterCheckByDiffContext(t *testing.T) {
 			OldLine:       0,
 		},
 		{
-			CheckResult: &CheckResult{
-				Diagnostic: &rdf.Diagnostic{
-					Location: &rdf.Location{
-						Path:  "sample.new.txt",
-						Range: &rdf.Range{Start: &rdf.Position{Line: 3}},
-					},
+			Diagnostic: &rdf.Diagnostic{
+				Location: &rdf.Location{
+					Path:  "sample.new.txt",
+					Range: &rdf.Range{Start: &rdf.Position{Line: 3}},
 				},
 			},
 			ShouldReport:  true,
diff --git a/parser_test.go b/parser_test.go
index f1ab0770..b7f56470 100644
--- a/parser_test.go
+++ b/parser_test.go
@@ -99,12 +99,12 @@ func TestCheckStyleParser(t *testing.T) {
 	}
 
 	p := NewCheckStyleParser()
-	crs, err := p.Parse(strings.NewReader(sample))
+	diagnostics, err := p.Parse(strings.NewReader(sample))
 	if err != nil {
 		t.Error(err)
 	}
-	for i, cr := range crs {
-		if got, want := cr.Lines[0], wants[i]; got != want {
+	for i, d := range diagnostics {
+		if got, want := d.GetOriginalOutput(), wants[i]; got != want {
 			t.Errorf("%d: got %v, want %v", i, got, want)
 		}
 	}
@@ -120,12 +120,12 @@ func TestRDJSONLParser(t *testing.T) {
 {"source":{"name":"severity-test"},"message":"severity test (number)","location":{"path":"testdata/main.go","range":{"start":{"line":24,"column":6}}}, "severity": "WARNING"}`
 	sampleLines := strings.Split(sample, "\n")
 	p := NewRDJSONLParser()
-	crs, err := p.Parse(strings.NewReader(sample))
+	diagnostics, err := p.Parse(strings.NewReader(sample))
 	if err != nil {
 		t.Error(err)
 	}
-	for i, cr := range crs {
-		if got, want := cr.Lines[0], sampleLines[i]; got != want {
+	for i, d := range diagnostics {
+		if got, want := d.GetOriginalOutput(), sampleLines[i]; got != want {
 			t.Errorf("%d: got %v, want %v", i, got, want)
 		}
 	}
diff --git a/service/gerrit/change_review_test.go b/service/gerrit/change_review_test.go
index 05d7b542..6bfd8189 100644
--- a/service/gerrit/change_review_test.go
+++ b/service/gerrit/change_review_test.go
@@ -29,7 +29,7 @@ func TestChangeReviewCommenter_Post_Flush(t *testing.T) {
 	ctx := context.Background()
 	newLnum1 := 14
 	newComment1 := &reviewdog.Comment{
-		Result: &reviewdog.FilteredCheck{CheckResult: &reviewdog.CheckResult{
+		Result: &reviewdog.FilteredCheck{
 			Diagnostic: &rdf.Diagnostic{
 				Location: &rdf.Location{
 					Path: "file.go",
@@ -38,12 +38,13 @@ func TestChangeReviewCommenter_Post_Flush(t *testing.T) {
 					}},
 				},
 			},
-		}, InDiffFile: true},
+			InDiffFile: true,
+		},
 		Body: "new comment",
 	}
 	newLnum2 := 15
 	newComment2 := &reviewdog.Comment{
-		Result: &reviewdog.FilteredCheck{CheckResult: &reviewdog.CheckResult{
+		Result: &reviewdog.FilteredCheck{
 			Diagnostic: &rdf.Diagnostic{
 				Location: &rdf.Location{
 					Path: "file2.go",
@@ -52,11 +53,12 @@ func TestChangeReviewCommenter_Post_Flush(t *testing.T) {
 					}},
 				},
 			},
-		}, InDiffFile: true},
+			InDiffFile: true,
+		},
 		Body: "new comment 2",
 	}
 	commentOutsideDiff := &reviewdog.Comment{
-		Result: &reviewdog.FilteredCheck{CheckResult: &reviewdog.CheckResult{
+		Result: &reviewdog.FilteredCheck{
 			Diagnostic: &rdf.Diagnostic{
 				Location: &rdf.Location{
 					Path: "file3.go",
@@ -65,7 +67,8 @@ func TestChangeReviewCommenter_Post_Flush(t *testing.T) {
 					}},
 				},
 			},
-		}, InDiffFile: false},
+			InDiffFile: false,
+		},
 		Body: "comment outside diff",
 	}
 
diff --git a/service/github/github_test.go b/service/github/github_test.go
index 55b75bad..d646c3a7 100644
--- a/service/github/github_test.go
+++ b/service/github/github_test.go
@@ -72,11 +72,9 @@ func TestGitHubPullRequest_Post(t *testing.T) {
 	}
 	comment := &reviewdog.Comment{
 		Result: &reviewdog.FilteredCheck{
-			CheckResult: &reviewdog.CheckResult{
-				Diagnostic: &rdf.Diagnostic{
-					Location: &rdf.Location{
-						Path: "watchdogs.go",
-					},
+			Diagnostic: &rdf.Diagnostic{
+				Location: &rdf.Location{
+					Path: "watchdogs.go",
 				},
 			},
 			InDiffContext: true,
@@ -296,14 +294,12 @@ func TestGitHubPullRequest_Post_Flush_review_api(t *testing.T) {
 	comments := []*reviewdog.Comment{
 		{
 			Result: &reviewdog.FilteredCheck{
-				CheckResult: &reviewdog.CheckResult{
-					Diagnostic: &rdf.Diagnostic{
-						Location: &rdf.Location{
-							Path: "reviewdog.go",
-							Range: &rdf.Range{
-								Start: &rdf.Position{
-									Line: 2,
-								},
+				Diagnostic: &rdf.Diagnostic{
+					Location: &rdf.Location{
+						Path: "reviewdog.go",
+						Range: &rdf.Range{
+							Start: &rdf.Position{
+								Line: 2,
 							},
 						},
 					},
@@ -314,14 +310,12 @@ func TestGitHubPullRequest_Post_Flush_review_api(t *testing.T) {
 		},
 		{
 			Result: &reviewdog.FilteredCheck{
-				CheckResult: &reviewdog.CheckResult{
-					Diagnostic: &rdf.Diagnostic{
-						Location: &rdf.Location{
-							Path: "reviewdog.go",
-							Range: &rdf.Range{
-								Start: &rdf.Position{
-									Line: 15,
-								},
+				Diagnostic: &rdf.Diagnostic{
+					Location: &rdf.Location{
+						Path: "reviewdog.go",
+						Range: &rdf.Range{
+							Start: &rdf.Position{
+								Line: 15,
 							},
 						},
 					},
@@ -332,14 +326,12 @@ func TestGitHubPullRequest_Post_Flush_review_api(t *testing.T) {
 		},
 		{
 			Result: &reviewdog.FilteredCheck{
-				CheckResult: &reviewdog.CheckResult{
-					Diagnostic: &rdf.Diagnostic{
-						Location: &rdf.Location{
-							Path: "reviewdog.go",
-							Range: &rdf.Range{
-								Start: &rdf.Position{
-									Line: 15,
-								},
+				Diagnostic: &rdf.Diagnostic{
+					Location: &rdf.Location{
+						Path: "reviewdog.go",
+						Range: &rdf.Range{
+							Start: &rdf.Position{
+								Line: 15,
 							},
 						},
 					},
@@ -350,17 +342,15 @@ func TestGitHubPullRequest_Post_Flush_review_api(t *testing.T) {
 		},
 		{
 			Result: &reviewdog.FilteredCheck{
-				CheckResult: &reviewdog.CheckResult{
-					Diagnostic: &rdf.Diagnostic{
-						Location: &rdf.Location{
-							Path: "reviewdog.go",
-							Range: &rdf.Range{
-								Start: &rdf.Position{
-									Line: 15,
-								},
-								End: &rdf.Position{
-									Line: 16,
-								},
+				Diagnostic: &rdf.Diagnostic{
+					Location: &rdf.Location{
+						Path: "reviewdog.go",
+						Range: &rdf.Range{
+							Start: &rdf.Position{
+								Line: 15,
+							},
+							End: &rdf.Position{
+								Line: 16,
 							},
 						},
 					},
@@ -371,19 +361,17 @@ func TestGitHubPullRequest_Post_Flush_review_api(t *testing.T) {
 		},
 		{
 			Result: &reviewdog.FilteredCheck{
-				CheckResult: &reviewdog.CheckResult{
-					Diagnostic: &rdf.Diagnostic{
-						Location: &rdf.Location{
-							Path: "reviewdog.go",
-							Range: &rdf.Range{
-								Start: &rdf.Position{
-									Line:   15,
-									Column: 1,
-								},
-								End: &rdf.Position{
-									Line:   17,
-									Column: 1,
-								},
+				Diagnostic: &rdf.Diagnostic{
+					Location: &rdf.Location{
+						Path: "reviewdog.go",
+						Range: &rdf.Range{
+							Start: &rdf.Position{
+								Line:   15,
+								Column: 1,
+							},
+							End: &rdf.Position{
+								Line:   17,
+								Column: 1,
 							},
 						},
 					},
@@ -394,17 +382,15 @@ func TestGitHubPullRequest_Post_Flush_review_api(t *testing.T) {
 		},
 		{
 			Result: &reviewdog.FilteredCheck{
-				CheckResult: &reviewdog.CheckResult{
-					Diagnostic: &rdf.Diagnostic{
-						Location: &rdf.Location{
-							Path: "reviewdog.go",
-							Range: &rdf.Range{
-								Start: &rdf.Position{
-									Line: 15,
-								},
-								End: &rdf.Position{
-									Line: 16,
-								},
+				Diagnostic: &rdf.Diagnostic{
+					Location: &rdf.Location{
+						Path: "reviewdog.go",
+						Range: &rdf.Range{
+							Start: &rdf.Position{
+								Line: 15,
+							},
+							End: &rdf.Position{
+								Line: 16,
 							},
 						},
 					},
@@ -415,12 +401,10 @@ func TestGitHubPullRequest_Post_Flush_review_api(t *testing.T) {
 		},
 		{
 			Result: &reviewdog.FilteredCheck{
-				CheckResult: &reviewdog.CheckResult{
-					Diagnostic: &rdf.Diagnostic{
-						Location: &rdf.Location{
-							Path: "reviewdog.go",
-							// No Line
-						},
+				Diagnostic: &rdf.Diagnostic{
+					Location: &rdf.Location{
+						Path: "reviewdog.go",
+						// No Line
 					},
 				},
 			},
@@ -482,14 +466,12 @@ func TestGitHubPullRequest_Post_toomany(t *testing.T) {
 	for i := 0; i < 100; i++ {
 		comments = append(comments, &reviewdog.Comment{
 			Result: &reviewdog.FilteredCheck{
-				CheckResult: &reviewdog.CheckResult{
-					Diagnostic: &rdf.Diagnostic{
-						Location: &rdf.Location{
-							Path: "reviewdog.go",
-							Range: &rdf.Range{Start: &rdf.Position{
-								Line: int32(i),
-							}},
-						},
+				Diagnostic: &rdf.Diagnostic{
+					Location: &rdf.Location{
+						Path: "reviewdog.go",
+						Range: &rdf.Range{Start: &rdf.Position{
+							Line: int32(i),
+						}},
 					},
 				},
 				InDiffContext: true,
@@ -529,8 +511,8 @@ func TestGitHubPullRequest_workdir(t *testing.T) {
 	}
 	ctx := context.Background()
 	want := "a/b/c"
-	g.Post(ctx, &reviewdog.Comment{Result: &reviewdog.FilteredCheck{CheckResult: &reviewdog.CheckResult{
-		Diagnostic: &rdf.Diagnostic{Location: &rdf.Location{Path: want}}}}})
+	g.Post(ctx, &reviewdog.Comment{Result: &reviewdog.FilteredCheck{
+		Diagnostic: &rdf.Diagnostic{Location: &rdf.Location{Path: want}}}})
 	if got := g.postComments[0].Result.Diagnostic.GetLocation().GetPath(); got != want {
 		t.Errorf("wd=%q path=%q, want %q", g.wd, got, want)
 	}
@@ -545,8 +527,8 @@ func TestGitHubPullRequest_workdir(t *testing.T) {
 	}
 	path := "a/b/c"
 	wantPath := "cmd/" + path
-	g.Post(ctx, &reviewdog.Comment{Result: &reviewdog.FilteredCheck{CheckResult: &reviewdog.CheckResult{
-		Diagnostic: &rdf.Diagnostic{Location: &rdf.Location{Path: want}}}}})
+	g.Post(ctx, &reviewdog.Comment{Result: &reviewdog.FilteredCheck{
+		Diagnostic: &rdf.Diagnostic{Location: &rdf.Location{Path: want}}}})
 	if got := g.postComments[0].Result.Diagnostic.GetLocation().GetPath(); got != wantPath {
 		t.Errorf("wd=%q path=%q, want %q", g.wd, got, wantPath)
 	}
diff --git a/service/github/githubutils/utils_test.go b/service/github/githubutils/utils_test.go
index 9ea778fa..b839fbe7 100644
--- a/service/github/githubutils/utils_test.go
+++ b/service/github/githubutils/utils_test.go
@@ -3,31 +3,28 @@ package githubutils
 import (
 	"testing"
 
-	"github.com/reviewdog/reviewdog"
 	"github.com/reviewdog/reviewdog/proto/rdf"
 )
 
-func TestLinkedMarkdownCheckResult(t *testing.T) {
+func TestLinkedMarkdownDiagnostic(t *testing.T) {
 	tests := []struct {
 		owner, repo, sha string
-		c                *reviewdog.CheckResult
+		d                *rdf.Diagnostic
 		want             string
 	}{
 		{
 			owner: "o",
 			repo:  "r",
 			sha:   "s",
-			c: &reviewdog.CheckResult{
-				Diagnostic: &rdf.Diagnostic{
-					Location: &rdf.Location{
-						Path: "path/to/file.txt",
-						Range: &rdf.Range{Start: &rdf.Position{
-							Line:   1414,
-							Column: 14,
-						}},
-					},
-					Message: "msg",
+			d: &rdf.Diagnostic{
+				Location: &rdf.Location{
+					Path: "path/to/file.txt",
+					Range: &rdf.Range{Start: &rdf.Position{
+						Line:   1414,
+						Column: 14,
+					}},
 				},
+				Message: "msg",
 			},
 			want: "[path/to/file.txt|1414 col 14|](http://github.com/o/r/blob/s/path/to/file.txt#L1414) msg",
 		},
@@ -35,17 +32,15 @@ func TestLinkedMarkdownCheckResult(t *testing.T) {
 			owner: "o",
 			repo:  "r",
 			sha:   "s",
-			c: &reviewdog.CheckResult{
-				Diagnostic: &rdf.Diagnostic{
-					Location: &rdf.Location{
-						Path: "path/to/file.txt",
-						Range: &rdf.Range{Start: &rdf.Position{
-							Line:   1414,
-							Column: 0,
-						}},
-					},
-					Message: "msg",
+			d: &rdf.Diagnostic{
+				Location: &rdf.Location{
+					Path: "path/to/file.txt",
+					Range: &rdf.Range{Start: &rdf.Position{
+						Line:   1414,
+						Column: 0,
+					}},
 				},
+				Message: "msg",
 			},
 			want: "[path/to/file.txt|1414|](http://github.com/o/r/blob/s/path/to/file.txt#L1414) msg",
 		},
@@ -53,21 +48,19 @@ func TestLinkedMarkdownCheckResult(t *testing.T) {
 			owner: "o",
 			repo:  "r",
 			sha:   "s",
-			c: &reviewdog.CheckResult{
-				Diagnostic: &rdf.Diagnostic{
-					Location: &rdf.Location{
-						Path: "path/to/file.txt",
-					},
-					Message: "msg",
+			d: &rdf.Diagnostic{
+				Location: &rdf.Location{
+					Path: "path/to/file.txt",
 				},
+				Message: "msg",
 			},
 			want: "[path/to/file.txt||](http://github.com/o/r/blob/s/path/to/file.txt) msg",
 		},
 	}
 	for _, tt := range tests {
-		if got := LinkedMarkdownCheckResult(tt.owner, tt.repo, tt.sha, tt.c); got != tt.want {
-			t.Errorf("LinkedMarkdownCheckResult(%q, %q, %q, %#v) = %q, want %q",
-				tt.owner, tt.repo, tt.sha, tt.c, got, tt.want)
+		if got := LinkedMarkdownDiagnostic(tt.owner, tt.repo, tt.sha, tt.d); got != tt.want {
+			t.Errorf("LinkedMarkdownDiagnostic(%q, %q, %q, %#v) = %q, want %q",
+				tt.owner, tt.repo, tt.sha, tt.d, got, tt.want)
 		}
 	}
 }
diff --git a/service/gitlab/gitlab_mr_commit_test.go b/service/gitlab/gitlab_mr_commit_test.go
index 20a4d11a..73dfff1b 100644
--- a/service/gitlab/gitlab_mr_commit_test.go
+++ b/service/gitlab/gitlab_mr_commit_test.go
@@ -92,7 +92,7 @@ func TestGitLabMergeRequestCommitCommenter_Post_Flush_review_api(t *testing.T) {
 	// If setting exists file path, sha is changed by last commit id.
 	comments := []*reviewdog.Comment{
 		{
-			Result: &reviewdog.FilteredCheck{CheckResult: &reviewdog.CheckResult{
+			Result: &reviewdog.FilteredCheck{
 				Diagnostic: &rdf.Diagnostic{
 					Location: &rdf.Location{
 						Path: "notExistFile.go",
@@ -101,11 +101,12 @@ func TestGitLabMergeRequestCommitCommenter_Post_Flush_review_api(t *testing.T) {
 						}},
 					},
 				},
-			}, InDiffFile: true},
+				InDiffFile: true,
+			},
 			Body: "already commented",
 		},
 		{
-			Result: &reviewdog.FilteredCheck{CheckResult: &reviewdog.CheckResult{
+			Result: &reviewdog.FilteredCheck{
 				Diagnostic: &rdf.Diagnostic{
 					Location: &rdf.Location{
 						Path: "notExistFile.go",
@@ -114,7 +115,8 @@ func TestGitLabMergeRequestCommitCommenter_Post_Flush_review_api(t *testing.T) {
 						}},
 					},
 				},
-			}, InDiffFile: true},
+				InDiffFile: true,
+			},
 			Body: "new comment",
 		},
 	}
@@ -145,8 +147,8 @@ func TestGitLabPullRequest_workdir(t *testing.T) {
 	}
 	ctx := context.Background()
 	want := "a/b/c"
-	g.Post(ctx, &reviewdog.Comment{Result: &reviewdog.FilteredCheck{CheckResult: &reviewdog.CheckResult{
-		Diagnostic: &rdf.Diagnostic{Location: &rdf.Location{Path: want}}}}})
+	g.Post(ctx, &reviewdog.Comment{Result: &reviewdog.FilteredCheck{
+		Diagnostic: &rdf.Diagnostic{Location: &rdf.Location{Path: want}}}})
 	if got := g.postComments[0].Result.Diagnostic.GetLocation().GetPath(); got != want {
 		t.Errorf("wd=%q path=%q, want %q", g.wd, got, want)
 	}
@@ -161,8 +163,8 @@ func TestGitLabPullRequest_workdir(t *testing.T) {
 	}
 	path := "a/b/c"
 	wantPath := "cmd/" + path
-	g.Post(ctx, &reviewdog.Comment{Result: &reviewdog.FilteredCheck{CheckResult: &reviewdog.CheckResult{
-		Diagnostic: &rdf.Diagnostic{Location: &rdf.Location{Path: want}}}}})
+	g.Post(ctx, &reviewdog.Comment{Result: &reviewdog.FilteredCheck{
+		Diagnostic: &rdf.Diagnostic{Location: &rdf.Location{Path: want}}}})
 	if got := g.postComments[0].Result.Diagnostic.GetLocation().GetPath(); got != wantPath {
 		t.Errorf("wd=%q path=%q, want %q", g.wd, got, wantPath)
 	}
diff --git a/service/gitlab/gitlab_mr_discussion_test.go b/service/gitlab/gitlab_mr_discussion_test.go
index cbbd24ce..227a7410 100644
--- a/service/gitlab/gitlab_mr_discussion_test.go
+++ b/service/gitlab/gitlab_mr_discussion_test.go
@@ -23,7 +23,7 @@ func TestGitLabMergeRequestDiscussionCommenter_Post_Flush_review_api(t *testing.
 	os.Chdir("../..")
 
 	alreadyCommented1 := &reviewdog.Comment{
-		Result: &reviewdog.FilteredCheck{CheckResult: &reviewdog.CheckResult{
+		Result: &reviewdog.FilteredCheck{
 			Diagnostic: &rdf.Diagnostic{
 				Location: &rdf.Location{
 					Path: "file.go",
@@ -32,11 +32,12 @@ func TestGitLabMergeRequestDiscussionCommenter_Post_Flush_review_api(t *testing.
 					}},
 				},
 			},
-		}, InDiffFile: true},
+			InDiffFile: true,
+		},
 		Body: "already commented",
 	}
 	alreadyCommented2 := &reviewdog.Comment{
-		Result: &reviewdog.FilteredCheck{CheckResult: &reviewdog.CheckResult{
+		Result: &reviewdog.FilteredCheck{
 			Diagnostic: &rdf.Diagnostic{
 				Location: &rdf.Location{
 					Path: "another/file.go",
@@ -45,11 +46,12 @@ func TestGitLabMergeRequestDiscussionCommenter_Post_Flush_review_api(t *testing.
 					}},
 				},
 			},
-		}, InDiffFile: true},
+			InDiffFile: true,
+		},
 		Body: "already commented 2",
 	}
 	newComment1 := &reviewdog.Comment{
-		Result: &reviewdog.FilteredCheck{CheckResult: &reviewdog.CheckResult{
+		Result: &reviewdog.FilteredCheck{
 			Diagnostic: &rdf.Diagnostic{
 				Location: &rdf.Location{
 					Path: "file.go",
@@ -58,11 +60,12 @@ func TestGitLabMergeRequestDiscussionCommenter_Post_Flush_review_api(t *testing.
 					}},
 				},
 			},
-		}, InDiffFile: true},
+			InDiffFile: true,
+		},
 		Body: "new comment",
 	}
 	newComment2 := &reviewdog.Comment{
-		Result: &reviewdog.FilteredCheck{CheckResult: &reviewdog.CheckResult{
+		Result: &reviewdog.FilteredCheck{
 			Diagnostic: &rdf.Diagnostic{
 				Location: &rdf.Location{
 					Path: "file2.go",
@@ -71,19 +74,18 @@ func TestGitLabMergeRequestDiscussionCommenter_Post_Flush_review_api(t *testing.
 					}},
 				},
 			},
-		}, InDiffFile: true},
+			InDiffFile: true,
+		},
 		Body: "new comment 2",
 	}
 	newComment3 := &reviewdog.Comment{
 		Result: &reviewdog.FilteredCheck{
-			CheckResult: &reviewdog.CheckResult{
-				Diagnostic: &rdf.Diagnostic{
-					Location: &rdf.Location{
-						Path: "new_file.go",
-						Range: &rdf.Range{Start: &rdf.Position{
-							Line: 14,
-						}},
-					},
+			Diagnostic: &rdf.Diagnostic{
+				Location: &rdf.Location{
+					Path: "new_file.go",
+					Range: &rdf.Range{Start: &rdf.Position{
+						Line: 14,
+					}},
 				},
 			},
 			OldPath:    "old_file.go",
@@ -93,7 +95,7 @@ func TestGitLabMergeRequestDiscussionCommenter_Post_Flush_review_api(t *testing.
 		Body: "new comment 3",
 	}
 	commentOutsideDiff := &reviewdog.Comment{
-		Result: &reviewdog.FilteredCheck{CheckResult: &reviewdog.CheckResult{
+		Result: &reviewdog.FilteredCheck{
 			Diagnostic: &rdf.Diagnostic{
 				Location: &rdf.Location{
 					Path: "path.go",
@@ -102,17 +104,19 @@ func TestGitLabMergeRequestDiscussionCommenter_Post_Flush_review_api(t *testing.
 					}},
 				},
 			},
-		}, InDiffFile: false},
+			InDiffFile: false,
+		},
 		Body: "comment outside diff",
 	}
 	commentWithoutLnum := &reviewdog.Comment{
-		Result: &reviewdog.FilteredCheck{CheckResult: &reviewdog.CheckResult{
+		Result: &reviewdog.FilteredCheck{
 			Diagnostic: &rdf.Diagnostic{
 				Location: &rdf.Location{
 					Path: "path.go",
 				},
 			},
-		}, InDiffFile: true},
+			InDiffFile: true,
+		},
 		Body: "comment without lnum",
 	}