You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
411 B
26 lines
411 B
package jsonlint |
|
|
|
import ( |
|
"encoding/json" |
|
"io" |
|
|
|
"go-common/app/admin/main/config/pkg/lint" |
|
) |
|
|
|
const filetype = "json" |
|
|
|
type jsonlint struct{} |
|
|
|
func (jsonlint) Lint(r io.Reader) lint.Error { |
|
var v interface{} |
|
dec := json.NewDecoder(r) |
|
err := dec.Decode(&v) |
|
if err == nil { |
|
return nil |
|
} |
|
return lint.Error{{Line: -1, Message: err.Error()}} |
|
} |
|
|
|
func init() { |
|
lint.RegisterLinter(filetype, jsonlint{}) |
|
}
|
|
|