Golangci-lint structcheck linter not working

I wrote a small main file to test out golangci linters

package main

import "fmt"

type AB struct {
	A string
	B string

func main() {
	s := AB{
		B: "hello",


Field A is unused and should be reported by structcheck linter which is enabled by default.

structcheck: Finds unused struct fields [fast: false, auto-fix: false]

Calling golangci-lint run, I don’t get any report on the unused field.
Same with golangci-lint run -E structcheck

Could someone please clarify what I’m doing wrong? Thanks

If you change it from A to a, do you then get a warning about the field being unused?

1 Like

Yes, I get the warning with an un-exported field
main.go:6:2: `a` is unused (structcheck)

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.