Skip to content

golang-ci iterates over skip-dirs #3273

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

golang-ci iterates over skip-dirs #3273

troian opened this issue Oct 4, 2022 · 3 comments
Labels
duplicate This issue or pull request already exists

Comments

@troian
Copy link

troian commented Oct 4, 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 have gofmt failing with weird output. the code it fails on is generated and is specified as ignored in .golangci.yaml, however skip-dirs content seems not being applied

Version of golangci-lint

$ golangci-lint --version
golangci-lint has version 1.49.0 built from cc2d97f3 on 2022-08-24T10:24:37Z

Configuration file

issues:
  exclude:
    - comment on exported (method|function|type|const|var)
  exclude-use-default: true

linters:
  # Disable all linters.
  # Default: false
  disable-all: true
# Skip mocks generated k8s code
run:
  skip-dirs:
    - pkg/client
    - mock
  skip-dirs-use-default: true
  modules-download-mode: readonly

Go environment

$ go version && go env
# paste output here

Verbose output of running

golangci-lint cache clean
golangci-lint run --disable-all --enable gofmt -v
INFO [config_reader] Config search paths: [./ /Users/amr/go/src/github.com/ovrclk/provider-services /Users/amr/go/src/github.com/ovrclk /Users/amr/go/src/github.com /Users/amr/go/src /Users/amr/go /Users/amr /Users /] 
INFO [config_reader] Used config file .golangci.yaml 
INFO [lintersdb] Active 1 linters: [gofmt]        
INFO [loader] Go packages loading at mode 7 (compiled_files|name|files) took 952.442958ms 
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 19.580375ms 
INFO [linters context/goanalysis] analyzers took 1.23512475s with top 10 stages: gofmt: 1.23512475s 
WARN [runner] Can't run linter gofmt: gofmt: can't extract issues from gofmt diff output "--- /Users/amr/go/src/github.com/ovrclk/provider-services/pkg/client/clientset/versioned/fake/register.go.orig\t2022-10-03 22:57:09\n+++ /Users/amr/go/src/github.com/ovrclk/provider-services/pkg/client/clientset/versioned/fake/register.go\t2022-10-03 22:57:09\n@@ -39,14 +39,14 @@\n // AddToScheme adds all types of this clientset into the given scheme. This allows composition\n // of clientsets, like in:\n //\n-//   import (\n-//     \"k8s.io/client-go/kubernetes\"\n-//     clientsetscheme \"k8s.io/client-go/kubernetes/scheme\"\n-//     aggregatorclientsetscheme \"k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme\"\n-//   )\n+//\timport (\n+//\t  \"k8s.io/client-go/kubernetes\"\n+//\t  clientsetscheme \"k8s.io/client-go/kubernetes/scheme\"\n+//\t  aggregatorclientsetscheme \"k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme\"\n+//\t)\n //\n-//   kclientset, _ := kubernetes.NewForConfig(c)\n-//   _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)\n+//\tkclientset, _ := kubernetes.NewForConfig(c)\n+//\t_ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)\n //\n // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types\n // correctly.\n": can't parse patch: parsing time "2022-10-03 22:57:09" as "2006-01-02 15:04:05 -0700": cannot parse "" as "-0700" 
INFO [runner] processing took 1.337µs with stages: max_same_issues: 375ns, max_from_linter: 208ns, skip_dirs: 167ns, nolint: 167ns, autogenerated_exclude: 42ns, sort_results: 42ns, path_prettifier: 42ns, skip_files: 42ns, path_shortener: 42ns, filename_unadjuster: 42ns, cgo: 42ns, severity-rules: 42ns, exclude-rules: 42ns, max_per_file_from_linter: 42ns, identifier_marker: 0s, path_prefixer: 0s, diff: 0s, uniq_by_line: 0s, exclude: 0s, source_code: 0s 
INFO [runner] linters took 148.273625ms with stages: gofmt: 148.236209ms 
ERRO Running error: 1 error occurred:
    * can't run linter gofmt: gofmt: can't extract issues from gofmt diff output "--- /Users/amr/go/src/github.com/ovrclk/provider-services/pkg/client/clientset/versioned/fake/register.go.orig\t2022-10-03 22:57:09\n+++ /Users/amr/go/src/github.com/ovrclk/provider-services/pkg/client/clientset/versioned/fake/register.go\t2022-10-03 22:57:09\n@@ -39,14 +39,14 @@\n // AddToScheme adds all types of this clientset into the given scheme. This allows composition\n // of clientsets, like in:\n //\n-//   import (\n-//     \"k8s.io/client-go/kubernetes\"\n-//     clientsetscheme \"k8s.io/client-go/kubernetes/scheme\"\n-//     aggregatorclientsetscheme \"k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme\"\n-//   )\n+//\timport (\n+//\t  \"k8s.io/client-go/kubernetes\"\n+//\t  clientsetscheme \"k8s.io/client-go/kubernetes/scheme\"\n+//\t  aggregatorclientsetscheme \"k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme\"\n+//\t)\n //\n-//   kclientset, _ := kubernetes.NewForConfig(c)\n-//   _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)\n+//\tkclientset, _ := kubernetes.NewForConfig(c)\n+//\t_ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)\n //\n // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types\n // correctly.\n": can't parse patch: parsing time "2022-10-03 22:57:09" as "2006-01-02 15:04:05 -0700": cannot parse "" as "-0700"
 
INFO Memory: 13 samples, avg is 33.4MB, max is 54.1MB 
INFO Execution took 1.129135542s

Code example or link to a public repository

// add your code here
@troian troian added the bug Something isn't working label Oct 4, 2022
@boring-cyborg
Copy link

boring-cyborg bot commented Oct 4, 2022

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

@ldez
Copy link
Member

ldez commented Oct 4, 2022

Hello,

I guess (because you don't fill in the required information) you are using macOS.

So I think you are using Apple Diff, unfortunately, Apple Diff doesn't follow standard diff behavior.

The problem is explained here: #3087 (comment)

@ldez ldez added duplicate This issue or pull request already exists and removed bug Something isn't working labels Oct 4, 2022
@ldez ldez closed this as completed Oct 4, 2022
@troian
Copy link
Author

troian commented Oct 4, 2022

that was apple diff, thank you

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
Projects
None yet
Development

No branches or pull requests

2 participants