---
title: "top-level-declaration-order"
description: "Keep top-level declarations in a consistent order."
image: "https://strider.gempir.com/og.png"
---

> Documentation Index
> Fetch the complete documentation index at: https://strider.gempir.com/llms.txt
> Use this file to discover all available pages before exploring further.

# top-level-declaration-order

**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

```go
type Client struct{}
const timeout = time.Second
```

## Good

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

Source: https://strider.gempir.com/lints/top-level-declaration-order/index.mdx
