Skip to content

Can't run linter goanalysis_metalinter: goimports: can't extract issues from gofmt diff output #3338

@GaoJianAllen

Description

@GaoJianAllen

Welcome

  • Yes, I'm using a binary release within 2 latest major releases. Only such installations are supported.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, etc).
  • Yes, I've tried with the standalone linter if available. (https://golangci-lint.run/usage/linters/)

Description of the problem

I got below error. Actually, these code are generated by grpc so I want to config skip-dirs, but it doesn't work.

bin/golangci-lint run
WARN [runner] Can't run linter goanalysis_metalinter: goimports: can't extract issues from gofmt diff output "--- /Users/allen/workspace/Allen/FooService/api/gen/go/foo/v1/foo_api.pb.go.orig\t2022-11-01 14:30:32\n+++ /Users/allen/workspace/Allen/FooService/api/gen/go/foo/v1/foo_api.pb.go\t2022-11-01 14:30:32\n@@ -7,6 +7,9 @@\n package foov1\n \n import (\n+\treflect \"reflect\"\n+\tsync \"sync\"\n+\n \t_ \"github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options\"\n \t_ \"google.golang.org/genproto/googleapis/api/annotations\"\n \tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n@@ -14,8 +17,6 @@\n \tstructpb \"google.golang.org/protobuf/types/known/structpb\"\n \ttimestamppb \"google.golang.org/protobuf/types/known/timestamppb\"\n \twrapperspb \"google.golang.org/protobuf/types/known/wrapperspb\"\n-\treflect \"reflect\"\n-\tsync \"sync\"\n )\n \n const (\n": can't parse patch: parsing time "2022-11-01 14:30:32" as "2006-01-02 15:04:05 -0700": cannot parse "" as "-0700" 

Version of golangci-lint

$ golangci-lint --version
# golangci-lint has version 1.50.1 built from 8926a95f on 2022-10-22T10:50:47Z

Configuration file

run:
  timeout: 5m
  modules-download-mode: readonly

linters:
  enable:
    - errcheck
    - goimports
    - govet
    - staticcheck

issues:
  exclude-use-default: false
  max-issues-per-linter: 0
  max-same-issues: 0

Go environment

$ go version && go env
# go version go1.19.1 darwin/amd64
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/allen/Library/Caches/go-build"
GOENV="/Users/allen/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/allen/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/allen/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="off"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.19.1"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/allen/workspace/Horizon/horizon-rpl-service/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/cn/cngycyp9131_pk8zjkqh0p800000gn/T/go-build4046955359=/tmp/go-build -gno-record-gcc-switches -fno-common"

Verbose output of running

$ golangci-lint cache clean
$ golangci-lint run -v
# paste output here

Code example or link to a public repository

// �generated code

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions