From baff4ab35baaccfd618fb1c6af2c89041a6fc651 Mon Sep 17 00:00:00 2001 From: Trevor Pounds Date: Sun, 29 Sep 2019 12:33:48 -0400 Subject: [PATCH] Update to matoous/godox v1.0. Dependency has to be pinned to commit hash since tag is not a compatible semver supported by go.mod. --- go.mod | 2 +- go.sum | 4 ++-- vendor/github.com/matoous/godox/.gitignore | 1 + vendor/github.com/matoous/godox/.golangci.yml | 7 +++++-- vendor/github.com/matoous/godox/README.md | 7 +++++-- vendor/github.com/matoous/godox/godox.go | 15 ++++++++++++--- vendor/modules.txt | 2 +- 7 files changed, 27 insertions(+), 11 deletions(-) diff --git a/go.mod b/go.mod index aacc96fd..f95e0013 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,7 @@ require ( github.com/golangci/prealloc v0.0.0-20180630174525-215b22d4de21 github.com/golangci/revgrep v0.0.0-20180526074752-d9c87f5ffaf0 github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 - github.com/matoous/godox v0.0.0-20190910121045-032ad8106c86 + github.com/matoous/godox v0.0.0-20190911065817-5d6d842e92eb // v1.0 github.com/mattn/go-colorable v0.1.2 github.com/mitchellh/go-homedir v1.1.0 github.com/mitchellh/go-ps v0.0.0-20190716172923-621e5597135b diff --git a/go.sum b/go.sum index 7a774638..446dcf95 100644 --- a/go.sum +++ b/go.sum @@ -142,8 +142,8 @@ github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/matoous/godox v0.0.0-20190910121045-032ad8106c86 h1:q6SrfsK4FojRnJ1j8+8OJzyq3g9Y1oSVyL6nYGJXXBk= -github.com/matoous/godox v0.0.0-20190910121045-032ad8106c86/go.mod h1:1BELzlh859Sh1c6+90blK8lbYy0kwQf1bYlBhBysy1s= +github.com/matoous/godox v0.0.0-20190911065817-5d6d842e92eb h1:RHba4YImhrUVQDHUCe2BNSOz4tVy2yGyXhvYDvxGgeE= +github.com/matoous/godox v0.0.0-20190911065817-5d6d842e92eb/go.mod h1:1BELzlh859Sh1c6+90blK8lbYy0kwQf1bYlBhBysy1s= github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE= diff --git a/vendor/github.com/matoous/godox/.gitignore b/vendor/github.com/matoous/godox/.gitignore index c0525124..30d94b10 100644 --- a/vendor/github.com/matoous/godox/.gitignore +++ b/vendor/github.com/matoous/godox/.gitignore @@ -3,6 +3,7 @@ *.dll *.so *.dylib +.idea # Test binary, build with `go test -c` *.test diff --git a/vendor/github.com/matoous/godox/.golangci.yml b/vendor/github.com/matoous/godox/.golangci.yml index c949963e..3f0fcdb1 100644 --- a/vendor/github.com/matoous/godox/.golangci.yml +++ b/vendor/github.com/matoous/godox/.golangci.yml @@ -49,9 +49,12 @@ issues: - goconst - dupl - - path: api/v1/ + - path: fixtures linters: - - dupl + - gocritic + - varcheck + - deadcode + - unused run: modules-download-mode: readonly diff --git a/vendor/github.com/matoous/godox/README.md b/vendor/github.com/matoous/godox/README.md index c71e67fa..6d5f54fc 100644 --- a/vendor/github.com/matoous/godox/README.md +++ b/vendor/github.com/matoous/godox/README.md @@ -1,13 +1,16 @@ GoDoX === -[![Build Status](https://travis-ci.org/matoous/godox.svg?branch=master)](https://travis-ci.org/matoous/godox) +[![Tests](https://github.com/matoous/godox/workflows/.github/workflows/test.yml/badge.svg)](https://github.com/matoous/godox/actions) +[![Lint](https://github.com/matoous/godox/workflows/.github/workflows/lint.yml/badge.svg)](https://github.com/matoous/godox/actions) [![GoDoc](https://godoc.org/github.com/matoous/godox?status.svg)](https://godoc.org/github.com/matoous/godox) [![Go Report Card](https://goreportcard.com/badge/github.com/matoous/godox)](https://goreportcard.com/report/github.com/matoous/godox) [![GitHub issues](https://img.shields.io/github/issues/matoous/godox.svg)](https://github.com/matoous/godox/issues) [![License](https://img.shields.io/badge/license-MIT%20License-blue.svg)](https://github.com/matoous/godox/LICENSE) -GoDoX extracts comments from Go code based on keywords. +GoDoX extracts comments from Go code based on keywords. This repository is fork of https://github.com/766b/godox +but a lot of code has changed, this repository is updated and the code was adjusted for better integration with +https://github.com/golangci/golangci-lint. Installation --- diff --git a/vendor/github.com/matoous/godox/godox.go b/vendor/github.com/matoous/godox/godox.go index c3a2d912..13f3f3be 100644 --- a/vendor/github.com/matoous/godox/godox.go +++ b/vendor/github.com/matoous/godox/godox.go @@ -47,12 +47,19 @@ func getMessages(c *ast.Comment, fset *token.FileSet, keywords []string) []Messa for _, kw := range keywords { if bytes.EqualFold([]byte(kw), sComment[0:len(kw)]) { pos := fset.Position(c.Pos()) + // trim the comment if len(sComment) > 40 { sComment = []byte(fmt.Sprintf("%s...", sComment[:40])) } comments = append(comments, Message{ - Pos: pos, - Message: fmt.Sprintf("%s:%d: Line contains %s: \"%s\"", filepath.Join(pos.Filename), pos.Line+lineNum, strings.Join(keywords, "/"), sComment), + Pos: pos, + Message: fmt.Sprintf( + "%s:%d: Line contains %s: \"%s\"", + filepath.Join(pos.Filename), + pos.Line+lineNum, + strings.Join(keywords, "/"), + sComment, + ), }) break } @@ -61,8 +68,10 @@ func getMessages(c *ast.Comment, fset *token.FileSet, keywords []string) []Messa return comments } +// Run runs the godox linter on given file. +// Godox searches for comments starting with given keywords and reports them. func Run(file *ast.File, fset *token.FileSet, keywords ...string) []Message { - if keywords == nil || len(keywords) == 0 { + if len(keywords) == 0 { keywords = defaultKeywords } var messages []Message diff --git a/vendor/modules.txt b/vendor/modules.txt index 12d9439f..511b25d6 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -102,7 +102,7 @@ github.com/kisielk/gotool/internal/load github.com/konsorten/go-windows-terminal-sequences # github.com/magiconair/properties v1.8.0 github.com/magiconair/properties -# github.com/matoous/godox v0.0.0-20190910121045-032ad8106c86 +# github.com/matoous/godox v0.0.0-20190911065817-5d6d842e92eb github.com/matoous/godox # github.com/mattn/go-colorable v0.1.2 github.com/mattn/go-colorable