Skip to content

func TestXXX is unused (unused)  #791

Closed
@hiromaily

Description

@hiromaily

To detect unused func, I enable only unused linter. However, there are many detections func TestXXXX is unused (unused)
I expect any tests are used and wanna skip any TestXXX func from unused.


  1. Version of golangci-lint: golangci-lint --version (or git commit if you don't use binary distribution)
7577d548a3893f86cb9aa479b88c52ff5d437893
  1. Config file: cat .golangci.yml
run:
  deadline: 10m
  build-tags:
    - integration
  skip-dirs:
    - vendor

linters-settings:
  misspell:
    locale: US
  unused:
    check-exported: true

linters:
  disable-all: true
  enable:
    - unused
  presets:
    - format
    - unused
  fast: false
  1. Go environment: go version && go env
$ go version                                                                                                                                                                                 go version go1.13.1 darwin/amd64
$ go env                                                                                                                                                                                 GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/myname/Library/Caches/go-build"
GOENV="/Users/myname/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/myname/work/go"
GOPRIVATE=""
GOPROXY="direct"
GOROOT="/usr/local/Cellar/go/1.13.1/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.13.1/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/myname/work/go/src/github.com/myproject/repository/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/9n/zjbb8_mx08nc4q3q9q6bck916qy5dd/T/go-build706206117=/tmp/go-build -gno-record-gcc-switches -fno-common"

Metadata

Metadata

Assignees

No one assigned

    Labels

    false positiveAn error is reported when one does not exist

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions