decorder

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2022 License: MIT Imports: 4 Imported by: 10

README

Decorder

A declaration order linter for golang. In case of this tool declarations are type, const, var and func.

This linter can check

  • the general order of declarations (e.g. all global constants are always defined before variables)
  • that init() is the first function inside a file (if defined)
  • that multiple (global) const, var and type statements are not allowed (go supports e.g. a single const statement with parenthesis for all constant declarations)

Installation

go get gitlab.com/bosi/decorder/cmd

Usage

# with default options
./decorder ./...

# custom declaration order
./decorder -dec-order var,const,func,type ./...

# disable declaration order check
./decorder -disable-dec-order-check ./...

# disable check for multiple declarations statements
./decorder -disable-dec-num-check ./...

# disable check that init func is always first function
./decorder -disable-init-func-first-check ./...

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Analyzer = &analysis.Analyzer{
		Name: "decorder",
		Doc:  "check declaration order and count of types, constants, variables and functions",
		Run:  run,
	}
)

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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