From 780af09a47f0826f4b37b64e998cc844fc78d146 Mon Sep 17 00:00:00 2001 From: Michael Cristina Date: Thu, 25 Jul 2019 19:27:29 -0500 Subject: [PATCH] fix: add start and end column to Annotation --- github/checks.go | 2 ++ github/checks_test.go | 6 +++++- github/github-accessors.go | 16 ++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/github/checks.go b/github/checks.go index 342915085e4..0c88cbb58aa 100644 --- a/github/checks.go +++ b/github/checks.go @@ -54,6 +54,8 @@ type CheckRunAnnotation struct { BlobHRef *string `json:"blob_href,omitempty"` StartLine *int `json:"start_line,omitempty"` EndLine *int `json:"end_line,omitempty"` + StartColumn *int `json:"start_column,omitempty"` + EndColumn *int `json:"end_column,omitempty"` AnnotationLevel *string `json:"annotation_level,omitempty"` Message *string `json:"message,omitempty"` Title *string `json:"title,omitempty"` diff --git a/github/checks_test.go b/github/checks_test.go index 0bdc09651d2..13f5a2ac9c7 100644 --- a/github/checks_test.go +++ b/github/checks_test.go @@ -151,6 +151,8 @@ func TestChecksService_ListCheckRunAnnotations(t *testing.T) { "blob_href": "https://github.com/octocat/Hello-World/blob/837db83be4137ca555d9a5598d0a1ea2987ecfee/README.md", "start_line": 2, "end_line": 2, + "start_column": 1, + "end_column": 5, "annotation_level": "warning", "message": "Check your spelling for 'banaas'.", "title": "Spell check", @@ -168,10 +170,12 @@ func TestChecksService_ListCheckRunAnnotations(t *testing.T) { BlobHRef: String("https://github.com/octocat/Hello-World/blob/837db83be4137ca555d9a5598d0a1ea2987ecfee/README.md"), StartLine: Int(2), EndLine: Int(2), + StartColumn: Int(1), + EndColumn: Int(5), AnnotationLevel: String("warning"), Message: String("Check your spelling for 'banaas'."), - RawDetails: String("Do you mean 'bananas' or 'banana'?"), Title: String("Spell check"), + RawDetails: String("Do you mean 'bananas' or 'banana'?"), }} if !reflect.DeepEqual(checkRunAnnotations, want) { diff --git a/github/github-accessors.go b/github/github-accessors.go index 13e60abb843..e4605258f0a 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -644,6 +644,14 @@ func (c *CheckRunAnnotation) GetBlobHRef() string { return *c.BlobHRef } +// GetEndColumn returns the EndColumn field if it's non-nil, zero value otherwise. +func (c *CheckRunAnnotation) GetEndColumn() int { + if c == nil || c.EndColumn == nil { + return 0 + } + return *c.EndColumn +} + // GetEndLine returns the EndLine field if it's non-nil, zero value otherwise. func (c *CheckRunAnnotation) GetEndLine() int { if c == nil || c.EndLine == nil { @@ -676,6 +684,14 @@ func (c *CheckRunAnnotation) GetRawDetails() string { return *c.RawDetails } +// GetStartColumn returns the StartColumn field if it's non-nil, zero value otherwise. +func (c *CheckRunAnnotation) GetStartColumn() int { + if c == nil || c.StartColumn == nil { + return 0 + } + return *c.StartColumn +} + // GetStartLine returns the StartLine field if it's non-nil, zero value otherwise. func (c *CheckRunAnnotation) GetStartLine() int { if c == nil || c.StartLine == nil {