Questions tagged [golint]

Golint is a linter for Go source code.

Golint makes code style recommendations.

Check this Github repo for more details

NOTE: Golint is deprecated and frozen. There are some other tools for this purpose such as go vet.

38 questions
2
votes
0 answers

vim-go with golangci-lint and revive (replacing deprecated go-lint): Confused about correct config

I am having a really hard time getting vim-go to play well with golanci-lint. golint, which was a default linter for go, has been deprecated. Most users now suggest to use revive. While the default config of vim-go with golint was working, but…
transient_loop
  • 5,984
  • 15
  • 58
  • 117
2
votes
1 answer

How can I install a specific version of golint for use globally?

I'm trying to create a docker image for use in a build pipeline that has various tools pre-installed for building and testing go projects. One tool we need is golint but I'm struggling to see how to install a specific version of it. The reason I…
Mark Stickley
  • 1,000
  • 1
  • 12
  • 28
2
votes
1 answer

GitHub Actions: Run golint on wihdows

I want to run golint on windows in GitHub Actions. go install golang.org/x/lint/golint golint ./... But I met this error: golint : The term 'golint' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the…
Matt - sanemat
  • 5,418
  • 8
  • 37
  • 41
2
votes
2 answers

Cannot install golint package: wrong import path

I have a project that uses golint and installs it inside the docker container. It have been working ok for months (and have been built multiple times), but today when I build the container again I get the following error: go get -u…
xyz
  • 524
  • 10
  • 22
2
votes
0 answers

Go lint complains the import when using dep

I saw the similar question here. But I couldn't solve my case. I am having project initialised with dep and added the first dependency "Echo". Now folder structure looks like this |--server | |--server.go |--vendor |--main.go The server.go has…
shanmugharaj
  • 3,814
  • 7
  • 42
  • 70
1
vote
3 answers

Should return err be put in else for if statement with declaration or avoid this style and outdent the return for Golang?

In Go, we often write code with declaration in if statement and also return err. Like this: if res, err := getResult(); err != nil { return err } else { fmt.Println(res) // do something with res } But the linter…
Roland Xi
  • 43
  • 6
1
vote
1 answer

How to fix go release versioning on Github that has backward tag version?

I have a go module release to Github. At the beginning, I tagged it to v1.0.0 it was running perfectly on my main program importing that module directly from Github. But on the next release, I've tagged it backward to v.0.1.1 because I think my…
anurjalal
  • 31
  • 3
1
vote
1 answer

Go in VSCode not signalling the lack of comment in public functions

I have installed Go and the VSCode extensions. I am using staticcheck as linter but I would like also to run the style checks provided by golint. When I look for the go.lint settings in VSCode, I see that I can specify either staticcheck or golint…
Picci
  • 16,775
  • 13
  • 70
  • 113
1
vote
2 answers

golangci-lint run command shows errors in makefile

I have created a make file to run some bash commands for Go. This is check.sh file This is my make file Error is : make: *** [Makefile:23: check] Error 1 How can I solve this issue?
Kashif Khan
  • 97
  • 2
  • 11
1
vote
2 answers

golint execution returns nothing

I'm coding exercise for exercism.io. And my mentor said that my code should be checked by some go linters, and he suggested me to try golint and golangci-lint. I installed golint via go get -u golang.org/x/lint/golint, and started it:…
Rustery
  • 125
  • 10
1
vote
1 answer

Arc lint error on a new Go Service with an error in parsing output

While Running arc lint on a service I am seeing this error Exception Some linters failed: - Exception: Linter failed to parse output! STDOUT STDERR :40:1: expected statement, found 'package' :59:27:…
HDS
  • 13
  • 4
1
vote
0 answers

Uniquely identifying function declarations in Go AST for Linter

I'm creating a custom linter for Go which validates certain parameters of the 'foo' function in the example below. Let's assume we have a sample.go, which looks something like this. // Package pkg does something. package pkg import ( …
Ramie
  • 1,171
  • 2
  • 16
  • 35
1
vote
1 answer

Compile glide vendored packages

Golang's glide downloads dependencies to the project's source. As a result, go build compiles those too, and go plugins that lint/vet the codebase also parse the dependencies. Assuming those dependencies are stable, how can I compile the…
sargas
  • 5,820
  • 7
  • 50
  • 69
0
votes
0 answers

What is the use of concurrency in run configuration of golangci-lint

I'm adding some linting rules for my Go project with golangci-lint. I'm really confused about the concurrency field in it's run configurations. My understanding is that it will run the linting process in multiple thread so that the execution speed…
Sruthi CP
  • 341
  • 3
  • 13
0
votes
1 answer

Go local module import can't be resolved by IDE linter

The code compiles fine, but when using the replace directive for mapping package name to a local directory, the Go linter can't pick this up. I've tried this on both VSCode & Goland, both has the lint error as shown below. The image is extra…
Webber
  • 941
  • 11
  • 26