Skip to content

top-level-declaration-order

Keep top-level declarations in a consistent order.

Updated View as Markdown

Default severity: warning

Files are easier to scan when top-level declarations appear as constants, variables, types, then functions. Imports are ignored, and init remains part of the function group.

Bad

type Client struct{}
const timeout = time.Second

Good

const timeout = time.Second
var defaultClient Client
type Client struct{}
func New() Client { return Client{} }
Navigation

Type to search…

↑↓ navigate↵ selectEsc close