Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LinesToReviewComments ¶
LinesToReviewComments reads linter reports and converts those to Gerrit Review Comments. Key in returned map is file name and value all associated problems as comments.
Example ¶
// Mock Gerrit server s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { data, _ := ioutil.ReadAll(r.Body) fmt.Printf("%s", data) fmt.Fprint(w, ")]}\n{}") })) defer s.Close() input := strings.NewReader(`file_1.go:1:2: some problem`) comments, err := review.LinesToReviewComments(input) if err != nil { if err == review.ErrNoProblemsFound { return } log.Fatal(err) } r := gerrit.ReviewInput{ Message: "go-review", Comments: comments, } c := gerrit.NewClient(s.URL, gerrit.NoAuth) if err := c.SetReview(context.Background(), "some-change-id", "some-revision", r); err != nil { log.Fatal(err) } // { // "message": "go-review", // "comments": { // "file_1.go": [ // { // "line": 1, // "message": "some problem" // } // ] // } // }
Output:
Types ¶
type ErrorString ¶
type ErrorString string
const ( ErrNoProblemsFound ErrorString = "no problems to convert into review comments" ErrSplitLine ErrorString = "failed to split line to location and description" ErrSplitLocation ErrorString = "failed split location to filename and position" )
func (ErrorString) Error ¶
func (e ErrorString) Error() string
type ParseError ¶
func (*ParseError) Error ¶
func (e *ParseError) Error() string
Click to show internal directories.
Click to hide internal directories.