Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
4 tasks done
GaoJianAllen opened this issue Nov 1, 2022 · 5 comments
Labels
duplicate This issue or pull request already exists

Comments

@GaoJianAllen
Copy link

GaoJianAllen commented Nov 1, 2022

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
@GaoJianAllen GaoJianAllen added the bug Something isn't working label Nov 1, 2022
@boring-cyborg
Copy link

boring-cyborg bot commented Nov 1, 2022

Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors.

@ldez ldez added duplicate This issue or pull request already exists and removed bug Something isn't working labels Nov 1, 2022
@ldez
Copy link
Member

ldez commented Nov 1, 2022

duplicate of #3087 and #3327

@ldez ldez closed this as completed Nov 1, 2022
@isysk
Copy link

isysk commented Apr 14, 2023

brew install diffutils worked for me, thanks~

@xiantang
Copy link

brew install diffutils worked for me, thanks~ brew install diffutils 对我有用,谢谢~

it's worked.Thanks a ton

@liron-navon
Copy link

brew install diffutils worked for me, thanks~

works for me, thanks

@golangci golangci locked as resolved and limited conversation to collaborators Jun 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

5 participants