Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
76 views

forbidigo: forbid: - pattern: Times\(1\) msg: "No need to specify Times(1) for a single call." The above forbidgo rule, still lets the code below pass! What is going ...
Zorayr's user avatar
  • 25.1k
0 votes
1 answer
882 views

If golangci-lint gives you an error like this, what can I do to fix it? ERRO Running error: can't run linter goanalysis_metalinter buildir: failed to load package environment: could not load export ...
guettli's user avatar
  • 27.7k
-2 votes
1 answer
146 views

First the code I have: for last < end { // HERE the linter is complaining with: // nested context in loop (fatcontext) ctx, cancel = context.WithTimeout(...
unsafe_where_true's user avatar
1 vote
2 answers
579 views

I have a fork of the Polygon Edge software, developed in Go v1.20. The project uses golangci-lint in its GitHub Actions workflows. I enabled golangci-lint but first ran it manually on both the ...
VitoCK's user avatar
  • 415
2 votes
0 answers
358 views

I can't see the linter errors as problems in VS Code. Here is my setup: I am using VS Code without a .golangci.yml config file. Golangci-linter is installed and works. I can run golangci-lint run --...
siva's user avatar
  • 1,573
1 vote
1 answer
320 views

I'm working on a shared Go repo. The repo includes a committed executable for golangci-lint, so that we can all run the same exact version of the linter on local machines and on CI. I'm also using the ...
Alessandro's user avatar
1 vote
1 answer
475 views

I am working on a Go project and using VSCode as an IDE. I have installed the official Go extensions and configured my settings in such a way as to have a formatting onSave while coding. My settings....
VitoCK's user avatar
  • 415
2 votes
1 answer
367 views

When combining two slices, e.g. fruit and vegetables, to create a third, e.g. food. it would seem to make sense to append fruit and vegetable and assign the result directly to food. golangci-lint's ...
jonhadfield's user avatar
0 votes
1 answer
772 views

I am working on a project. Here are my config files. .github/workflows/linting.yaml name: Go Lint CI on: push: branches: - main pull_request: branches: - main jobs: lint: ...
Mayukh Sarkar's user avatar
1 vote
0 answers
473 views

I have enabled unparam linter in my config but its not detecting any warnings for my code This shows for unparam when I run golangci-lint linters: Enabled by your configuration linters: unparam: ...
needhelp's user avatar
  • 111
2 votes
0 answers
94 views

I am having trouble finding scope level using the Go Analyze package. Given an example.go package main import "log" var myglobalvar = "hello from global" func myLog(format ...
Libraraimos's user avatar
2 votes
0 answers
262 views

I am aware of shadowing checks from govet but I am looking for something more specific. I am looking for a golangci-lint plugin that allows us to force local variables on specific functions. Ideally, ...
Libraraimos's user avatar
2 votes
0 answers
2k views

I have a big code repository on self-hosted gitlab, which always costs about 15 minutes to run golangci-lint. Is there a way for golangci-lint to only analyze code changes in merge request? I know --...
mkdym's user avatar
  • 141
1 vote
0 answers
53 views

Created a custom plugin for golangci-lint linter which just verifies imports in the go.mod file against the whitelisted ones. Now, if linter finds a disallowed dependency it reports: goModPath := ...
Avag Sargsyan's user avatar
0 votes
1 answer
83 views

I’ve found an interesting behavior of go vet with Sprintf which I would not expect (it’s inside the lint check). Could you explain me why go vet is not throwing a violation in the second numbered case ...
Honza P.'s user avatar
0 votes
0 answers
355 views

I'm working on a Golang text editor but i have an issue when solving for punctuation the requirement is as follow. The punctuation mark ' will always be found with another instance of it and they ...
ali mahdi's user avatar
0 votes
1 answer
167 views

For some reason my GolangCI is able to identify unused imports but not able to remove them. This is my GolangCI file used to remove unused import statements, I did specify remove-unused as true: run: ...
Mabel Oza's user avatar
  • 757
0 votes
1 answer
109 views

folder structure: - myproject - resolver - resolver.go - main.go go mod init github.com/kaleabbyh/foodrecipie resolver.go: package resolvers import "fmt" func resolverfunc(){ ...
kaleab's user avatar
  • 29
1 vote
0 answers
664 views

I installed golangci-lint using the link # binary will be $(go env GOPATH)/bin/golangci-lint curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go ...
prajeesh's user avatar
  • 2,412
3 votes
0 answers
661 views

VSCode doesn't show a warning on unhandled error. I've got this line of code: defer resp.Body.Close() which is market as unhandled error in GOLAND IDE but in VSCode I don't get similar nice warning as ...
Sonny49's user avatar
  • 555
2 votes
2 answers
3k views

When I run golangci-lint on my Go code after changing the go value in my go.mod from go 1.16 to go 1.20, I now get this linter warning: windows.go:210:16: SA1019: syscall.Syscall6 has been deprecated ...
Shane Bishop's user avatar
  • 5,052
1 vote
0 answers
251 views

At work, we have a shared golangci configuration that lives in a github repo, github.com/github/go-linter. I'm trying to figure out how best to share that configuration across many go repos. I've ...
Nate Finch's user avatar
2 votes
0 answers
482 views

I want to create a go lint rule that requires all goroutines to be launched with a wrapper function that can recover from a crash on the goroutine (this will also take an onRecover callback that will ...
D. Maul's user avatar
  • 351
0 votes
2 answers
201 views

I'm looking for a way to to find occurrences of this error "handling" that doesn't do anything with the first error: example: func handler() { var myErr error myErr = doSomething() //...
Paul's user avatar
  • 1,473
3 votes
1 answer
2k views

So I have this code token := NextToken() switch token.Typ { case tokenEOF: return nil case tokenMentionTargetedControl: # do stuff default: return nil } my tokentype is a enum my golinter ...
Raul Quinzani's user avatar
1 vote
0 answers
372 views

A common Go programming error we've seen is: for _, item := range items { item.SomeField = value // oops } As range copies the value, assigning to the struct field effectively does nothing. The ...
TrueWill's user avatar
  • 25.7k
1 vote
1 answer
891 views

Is there a way we can list down the indirect dependencies of a dependency in go lang go.mod file. For example in go.mod: require ( github.com/blang/semver/v4 v4.0.0 github.com/fatih/structtag ...
Uday Kumar's user avatar
5 votes
2 answers
3k views

I enabled goimports in my GolangCI tool using my makefile and it's able to spot unused imports but is not automatically remove them. How do I enable my golangCI tool to remove the unused imports ...
Mabel Oza's user avatar
  • 757
2 votes
1 answer
6k views

I see new error in prow job could not load export data: cannot import "github.com/IBM/ibmcloud-volume-interface/lib/utils/reasoncode" (unknown bexport format version -1 ("u\x01\x00\x00\...
ambikanair's user avatar
  • 4,720
2 votes
1 answer
1k views

I am using golangci-lint as part of my CI/CD. It is complaining on SQL rows not being closed, despite it is being closed from a goroutine: .... rows, err := ... ... go ...
Gilo's user avatar
  • 758
0 votes
1 answer
153 views

When running the make golint target in opentelemetry-collector-contrib, sometimes a lint error will appear. It seems like the kind of lint-check which could be easily fixed as well, but make gofmt ...
Subject17's user avatar
9 votes
1 answer
25k views

I get this warning: main.go:72: line is 191 characters (lll) klog.Fatalf("no ...") //nolint:lll I added nolint:lll, but this does not silence this warning. We use https://golangci-lint.run/...
guettli's user avatar
  • 27.7k
4 votes
3 answers
1k views

Is there a way to check if a public function/struct is used outside of the package in which it's declared? I'm not writing a public go module that's consumed anywhere else, and simply want to scan ...
asaf92's user avatar
  • 1,901
1 vote
1 answer
167 views

I have been working on my operator where I have some of the custom metric setting the values and that works fine (registration and displaying the metric value). The problem is that metric deletion isn'...
unbox-us's user avatar
  • 433
-1 votes
1 answer
2k views

WARN [runner/nolint] Found unknown linters in //nolint directives: godox todo: fix once roles are in place This warning keeps coming up when I am building my Golang project. What does this mean? ...
Sahaaj Singh Chawla's user avatar
-1 votes
1 answer
636 views

We are using The Kubernetes executor for GitLab Runner, as part of GitLab CI Go vet is failing with error--go build github.com/hashicorp/cdktf-provider-aws-go/aws/v9/wafv2: /usr/local/go/pkg/tool/...
Krishna's user avatar
  • 11
2 votes
1 answer
4k views

I'm trying to integrate golangci-lint with vscode. This is my settings file in vscode "go.lintTool": "golangci-lint", "go.lintFlags": ["--fast"], "...
tmp dev's user avatar
  • 9,335
5 votes
0 answers
1k views

Im new on golang and Im trying to _test my proxy func, the test passes correctly but when running golangci it gives me the error: undeclared name: getProxyURL (typecheck) if got := getProxyURL(tt.args....
Ryke's user avatar
  • 51
4 votes
0 answers
4k views

I´m trying to use golangci-lint with vscode, however when i run it, the following error occurs level=warning msg="[runner] Can't run linter goanalysis_metalinter: goimports: error computing diff:...
David Meléndez's user avatar
1 vote
0 answers
2k views

I'm trying to integrate golangci-lint on my project. I use golangci-lint v1.49.0 that I install from snap. I've added ci config on my project but when I try to run it, it throws a very bizarre error. $...
new line's user avatar
  • 243
1 vote
1 answer
2k views

Note: current version of Go - 1.17.13 current version of golangci-lint - 1.45.2 I am getting the same error `could not import C (cgo preprocessing failed) (typecheck) no matter which version of ...
Komron's user avatar
  • 19
0 votes
1 answer
247 views

I am new to Golang development. I was trying to initialize a struct which has a level 3 embedded struct. I can create till 2 levels, but when I try with level 3, it gives me this compile time error. ...
Kamal Kant's user avatar
  • 1,178
4 votes
0 answers
6k views

I have added multiple root packages in Visual Studio Code and defined the dependencies and packages properly. When I build my code I am not getting any compiler errors and I am able to run the ...
Madhusudhan's user avatar
5 votes
4 answers
23k views

I'm using RHEL 8.6 and my Go version is the following: $ go version go version go1.18.3 linux/amd64 I'm trying to install locally golangci-lint and none of the described ways in the documentation are ...
Andressa Cabistani's user avatar
6 votes
1 answer
5k views

I upgraded the version of go to go1.18.3, following the instruction on https://go.dev/doc/install: rm -rf /usr/local/go && tar -C /usr/local -xzf go1.18.3.linux-amd64.tar.gz export PATH=$PATH:/...
instant501's user avatar
3 votes
1 answer
487 views

I have enabled golangci-lint file watcher in GoLand but when I save file I got error like below one: msg="Running error: context loading failed: no go files to analyze" After some ...
Roshan Kumar's user avatar
0 votes
1 answer
1k views

Below is the code snippet where i have declared a for loop and getting index and box from the array of boxes. I am using the same index below in the if else block, but the golangci-lint is complaining ...
Anshul Sharma's user avatar
9 votes
3 answers
7k views

Q: How do I resolve this madness between the ireturn and nolintlint linters? Details: I have a Golang function with this signature func NewClientCredentialsTokenSource( issuer string, clientId ...
HairOfTheDog's user avatar
  • 2,817
74 votes
2 answers
46k views

I'm using golangci-lint and I'm getting an error on the following code: versions []ObjectDescription ... (populate versions) ... for i, v := range versions { res := createWorkerFor(&v) .....
Dean's user avatar
  • 7,034
21 votes
1 answer
20k views

I started a new go projects a few days ago, and I use golangci-lint to make my code in good style. I found gochecknoinits is one of linters of golangci-lint, and it tells me not to use init. In my ...
Neo Li's user avatar
  • 293