constpkg

package
v0.0.0-...-d31700d Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

View Source
var Const = Rule{

	Rule: namepkg.Rule{
		MaxLen: 40,
		Style:  "camelCase",
	},
	// contains filtered or unexported fields
}
View Source
var LocalConst = Rule{

	Rule: namepkg.Rule{
		MaxLen: 30,
		Style:  "lowerCamelCase",
	},
	// contains filtered or unexported fields
}

Functions

func Check

func Check(local bool, node ast.Node, fileSet *token.FileSet)
Example
var src = `package example
const C =  3
func F() {
  const c, ConstName =  3, 4
  var   v =  5
}
`
problems.Clear()
w := walker.Parse("example.go", src)
w.Walk(func(isLocal bool, node ast.Node) {
	Check(isLocal, node, w.FileSet)
})
problems.Render()
Output:

+-----------------+-----------------------------------------------------------+------------------+
|    position     |                          problem                          |       rule       |
+-----------------+-----------------------------------------------------------+------------------+
| example.go:4:12 | local const name ConstName should be lowerCamelCase style | localConst.style |
+-----------------+-----------------------------------------------------------+------------------+

Types

type Rule

type Rule struct {
	namepkg.Rule `yaml:",inline"`
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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