jsonstructlint

command module
v4.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2019 License: MIT Imports: 3 Imported by: 0

README

An opinionated linter for json struct tags in Go

Build Status Go Report Card

go get -u github.com/wayneashleyberry/jsonstructlint
jsonstructlint ./...
samples/testdata.go:14:2: "x_y" is not camelcase
samples/testdata.go:16:2: "foo bar" contains whitespace
samples/testdata.go:17:2: "TitleCase" is not camelcase
samples/testdata.go:18:2: "a b" contains whitespace
samples/testdata.go:12:2: F2 is missing a struct tag
samples/testdata.go:13:2: F3 is missing a struct tag
samples/testdata.go:25:3: "Inline Struct" contains whitespace
samples/testdata.go:30:4: "Super Inline" contains whitespace
samples/testdata.go:40:4: "FileName" is not camelcase
samples/testdata.go:41:4: MissingStructTag is missing a struct tag

Rules

  • json struct tags must be lower camel case eg. camelCase
  • json struct tags must not contain whitespace
  • json struct tags must exist on all fields, if they exist on one

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg
jsoncheck
Package jsoncheck inspects field types to ensure naming conventions
Package jsoncheck inspects field types to ensure naming conventions
structcheck
Package structcheck inspects struct types to ensure conventions across the entire struct, not just individual fields.
Package structcheck inspects struct types to ensure conventions across the entire struct, not just individual fields.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL