Skip to content

staticcheck on Ubuntu #1427

Answered by atc0005
oussamm asked this question in Q&A
Jul 27, 2023 · 3 comments · 1 reply
Discussion options

You must be logged in to vote

What happens if you run:

  • $GOPATH/bin/staticcheck --version
  • $(go env GOPATH)/bin/staticcheck --version
  • which staticcheck
    • this is expected to fail if $GOPATH/bin is not in your path

It sounds like $GOPATH/bin is not in your path.

A line like this at the bottom of your ~/.profile file should resolve that:

export PATH=$PATH:$(go env GOPATH)/bin

Then run:

source ~/.profile within your terminal (or log out and back in again) to set the updated PATH value.

These commands should now work:

  • which staticcheck
  • staticcheck --version

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by oussamm
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@oussamm
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants