Debian Codegraph @

website/content/docs/getting-started.md

raw
1 ---
2 title: "Getting started"
3 description: "Quickly get started using Staticcheck"
4 weight: 1
5 aliases:
6 - /docs/install
7 ---
8
9 ## Installation
10
11 Beginning with Go 1.17, the simplest way of installing Staticcheck is by running:
12
13 ```
14 go install honnef.co/go/tools/cmd/staticcheck@latest
15 ```
16
17 This will install the latest version of Staticcheck to `$GOPATH/bin`. To find out where `$GOPATH` is, run `go env GOPATH`.
18 Instead of `@latest`, you can also use a specific version, such as `@2020.2.1`.
19
20 If you'd like to be notified of new releases, you can use [GitHub's Releases only watches](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/viewing-your-subscriptions#configuring-your-watch-settings-for-an-individual-repository).
21
22 ### Binary releases
23
24 We publish binary releases for the most common operating systems and CPU architectures.
25 These can be downloaded from [GitHub](https://github.com/dominikh/go-tools/releases).
26
27 ### Distribution packages
28
29 Many package managers include Staticcheck, allowing you to install it with your usual commands, such as `apt install`.
30 Note, however, that you might not always get new releases in a timely manner.
31
32 What follows is a non-exhaustive list of the package names in various package repositories.
33
34 <div id="getting-started-distribution-packages">
35
36 Arch Linux
37 : [staticcheck](https://archlinux.org/packages/extra/x86_64/staticcheck/)
38
39 Debian
40 : [go-staticcheck](https://packages.debian.org/go-staticcheck)
41
42 Fedora
43 : [golang-honnef-tools](https://fedora.pkgs.org/33/fedora-x86_64/golang-honnef-tools-2020.1.5-2.fc33.x86_64.rpm.html)
44
45 Homebrew
46 : [staticcheck](https://formulae.brew.sh/formula/staticcheck)
47
48 MacPorts
49 : [staticcheck](https://ports.macports.org/port/staticcheck/summary)
50
51 NixOS
52 : go-tools
53
54 Scoop
55 : [staticcheck](https://github.com/ScoopInstaller/Main/blob/master/bucket/staticcheck.json)
56
57 </div>
58
59 ## Running Staticcheck
60
61 The `staticcheck` command works much like `go build` or `go vet` do.
62 It supports all of the same package patterns.
63 For example, `staticcheck .` will check the current package, and `staticcheck ./...` will check all packages.
64 For more details on specifying packages to check, see `go help packages`.
65
66 Therefore, to start using Staticcheck, just run it on your code: `staticcheck ./...`.
67 It will print any issues it finds, or nothing at all if your code is squeaky clean.
68
69 Read the [Running Staticcheck]({{< relref "/docs/running-staticcheck" >}}) articles to learn more about running Staticcheck.