Skip to content

goimports: can't extract issues from gofmt diff output #3328

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
bushkov opened this issue Oct 28, 2022 · 2 comments
Closed
4 tasks done

goimports: can't extract issues from gofmt diff output #3328

bushkov opened this issue Oct 28, 2022 · 2 comments
Labels
duplicate This issue or pull request already exists question Further information is requested

Comments

@bushkov
Copy link

bushkov commented Oct 28, 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

After upgrading from macOS 12.6 to 13.0, I cannot run goimports linter. The error message I get is:

ERRO Running error: 1 error occurred:
	* can't run linter goimports: goimports: can't extract issues from gofmt diff output "... (\n": can't parse patch: parsing time "2022-10-25 14:43:33" 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 8926a95 on 2022-10-22T10:48:48Z

Configuration file

$ cat .golangci.yml
run:
  go: "1.19"
  timeout: 5m


linters:
  enable-all: true
  disable:
    - exhaustivestruct # recommended to only use in special cases...
    - funlen
    - godox # we still need a lot of TODO
    - gochecknoglobals # prevent using a lot of libraries' functionality
    - nlreturn
    - wsl
    - cyclop
    - gocognit
    - gomnd # we should enable this later
    - ireturn
    - varnamelen
    - wrapcheck
    - lll
    - nosnakecase # complains about protobuf-generated files
    - ifshort # deprecated by the owner
    - nestif
    - tagliatelle
    - maintidx
    - bodyclose
    - rowserrcheck
    - sqlclosecheck
    - wastedassign
    - exhaustruct
    - contextcheck
    - scopelint
    - interfacer
    - maligned
    - golint
    - varcheck
    - deadcode
    - structcheck

issues:
  exclude-rules:
    - path: _test\.go
      linters:
        - paralleltest
        - testpackage
        - varnamelen
        - dupl

Go environment

$ go version && go env
go version go1.19.2 darwin/arm64
GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="/Users/username/Library/Caches/go-build"
GOENV="/Users/username/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/victor/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/victor/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/homebrew/Cellar/go/1.19.2/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/homebrew/Cellar/go/1.19.2/libexec/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.19.2"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/username/Projects/projectname/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 arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/x5/1q2gh29n4r7_njfgc8hkspgm0000gn/T/go-build2375447467=/tmp/go-build -gno-record-gcc-switches -fno-common"

Verbose output of running

$ golangci-lint cache clean
$ golangci-lint run -v
INFO [config_reader] Config search paths: [./ /Users/username/Projects/projectname /Users/username/Projects /Users/username /Users /]
INFO [config_reader] Used config file .golangci.yml
INFO [lintersdb] Active 69 linters: [asasalint asciicheck bidichk containedctx decorder depguard dogsled dupl dupword durationcheck errcheck errchkjson errname errorlint execinquery exhaustive exportloopref forbidigo forcetypeassert gci gochecknoinits goconst gocritic gocyclo godot goerr113 gofmt gofumpt goheader goimports gomoddirectives gomodguard goprintffuncname gosec gosimple govet grouper importas ineffassign interfacebloat loggercheck makezero misspell nakedret nilerr nilnil noctx nolintlint nonamedreturns nosprintfhostport paralleltest prealloc predeclared promlinter reassign revive staticcheck stylecheck tenv testableexamples testpackage thelper tparallel typecheck unconvert unparam unused usestdlibvars whitespace]
INFO [loader] Go packages loading at mode 575 (deps|exports_file|imports|name|compiled_files|files|types_sizes) took 1.096262875s
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 5.756334ms
INFO [linters_context] importas settings found, but no aliases listed. List aliases under alias: key.
INFO [linters_context/goanalysis] analyzers took 20.232614407s with top 10 stages: buildir: 8.569282628s, exhaustive: 892.608879ms, bidichk: 663.079336ms, inspect: 546.342447ms, buildssa: 520.524792ms, ctrlflow: 501.963875ms, fact_deprecated: 453.660077ms, the_only_name: 444.461419ms, dupl: 383.813583ms, printf: 381.53188ms
WARN [runner] Can't run linter goanalysis_metalinter: goimports: can't extract issues from gofmt diff output "--- /Users/username/Projects/projectname/..\t2022-10-28 08:52:46\n+++ /Users/username/Projects/projectname/..\t2022-10-28 08:52:46\n@@ -7,10 +7,11 @@\n package v1\n \n import (\n-\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n-\tprotoimpl \"google.golang.org/protobuf/runtime/protoimpl\"\n \treflect \"reflect\"\n \tsync \"sync\"\n+\n+\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n+\tprotoimpl \"google.golang.org/protobuf/runtime/protoimpl\"\n )\n \n const (\n": can't parse patch: parsing time "2022-10-28 08:52:46" as "2006-01-02 15:04:05 -0700": cannot parse "" as "-0700"
INFO [runner] processing took 2.708µs with stages: max_same_issues: 833ns, skip_dirs: 375ns, filename_unadjuster: 209ns, autogenerated_exclude: 208ns, cgo: 208ns, skip_files: 208ns, nolint: 125ns, path_prettifier: 125ns, max_from_linter: 83ns, identifier_marker: 83ns, max_per_file_from_linter: 42ns, exclude: 42ns, diff: 42ns, source_code: 42ns, path_shortener: 42ns, exclude-rules: 41ns, severity-rules: 0s, sort_results: 0s, path_prefixer: 0s, uniq_by_line: 0s
INFO [runner] linters took 2.846069292s with stages: goanalysis_metalinter: 2.846034917s
ERRO Running error: 1 error occurred:
	* can't run linter goanalysis_metalinter: goimports: can't extract issues from gofmt diff output "--- /Users/username/Projects/projectname/..\t2022-10-28 08:52:46\n+++ /Users/username/Projects/projectname/..\t2022-10-28 08:52:46\n@@ -7,10 +7,11 @@\n package v1\n \n import (\n-\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n-\tprotoimpl \"google.golang.org/protobuf/runtime/protoimpl\"\n \treflect \"reflect\"\n \tsync \"sync\"\n+\n+\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n+\tprotoimpl \"google.golang.org/protobuf/runtime/protoimpl\"\n )\n \n const (\n": can't parse patch: parsing time "2022-10-28 08:52:46" as "2006-01-02 15:04:05 -0700": cannot parse "" as "-0700"

INFO Memory: 41 samples, avg is 318.5MB, max is 636.4MB
INFO Execution took 3.956738791s

Code example or link to a public repository

import (
	protoreflect "google.golang.org/protobuf/reflect/protoreflect"
	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
	reflect "reflect"
	sync "sync"
)
...
@bushkov bushkov added the bug Something isn't working label Oct 28, 2022
@boring-cyborg
Copy link

boring-cyborg bot commented Oct 28, 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 question Further information is requested and removed bug Something isn't working labels Oct 28, 2022
@ldez
Copy link
Member

ldez commented Oct 28, 2022

#3327

#3087 (comment)

@ldez ldez closed this as completed Oct 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants