1
0
Fork 0
forked from forgejo/forgejo

Rename scripts to build and add revive command as a new build tool command (#10942)

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
Lunny Xiao 2020-04-04 03:29:12 +08:00 committed by GitHub
parent 4af7c47b38
commit 4f63f283c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
182 changed files with 15832 additions and 1226 deletions

34
vendor/github.com/mgechev/revive/formatter/ndjson.go generated vendored Normal file
View file

@ -0,0 +1,34 @@
package formatter
import (
"encoding/json"
"os"
"github.com/mgechev/revive/lint"
)
// NDJSON is an implementation of the Formatter interface
// which formats the errors to NDJSON stream.
type NDJSON struct {
Metadata lint.FormatterMetadata
}
// Name returns the name of the formatter
func (f *NDJSON) Name() string {
return "ndjson"
}
// Format formats the failures gotten from the lint.
func (f *NDJSON) Format(failures <-chan lint.Failure, config lint.Config) (string, error) {
enc := json.NewEncoder(os.Stdout)
for failure := range failures {
obj := jsonObject{}
obj.Severity = severity(config, failure)
obj.Failure = failure
err := enc.Encode(obj)
if err != nil {
return "", err
}
}
return "", nil
}