Skip to content

Add support to another shell such as Powershell and Command Prompt on Windows #2021

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
arttet opened this issue May 30, 2021 · 2 comments
Closed
4 tasks done
Labels
duplicate This issue or pull request already exists enhancement New feature or improvement platform: windows Issue that is related to Windows

Comments

@arttet
Copy link

arttet commented May 30, 2021

  • 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

golangci-lint works only with bash on Windows.

When you run golangci-lint in Powershell or Command Prompt on Windows, you will get the error:

level=warning msg="[runner] Can't run linter goanalysis_metalinter: gofmt: can't extract issues from gofmt diff output \"\": got no diffs from patch parser: []"
Version of golangci-lint
$ golangci-lint --version
golangci-lint has version 1.40.1 built from 625445b1 on 2021-05-14T11:44:45Z
Config file
$ type .golangci.yml

# More info on config here: https://golangci-lint.run/usage/configuration/#config-file
run:
  timeout: 10m
  issues-exit-code: 1
  tests: true
  skip-dirs:
    - bin
    - vendor
    - var
    - tmp
  skip-files:
    - \.pb\.go$
    - \.pb\.goclay\.go$

output:
  format: colored-line-number
  print-issued-lines: true
  print-linter-name: true

linters-settings:
  govet:
    check-shadowing: true
  golint:
    min-confidence: 0
  dupl:
    threshold: 100
  goconst:
    min-len:         2
    min-occurrences: 2

linters:
  disable-all: true
  enable:
    - bodyclose
    - deadcode
    - depguard
    - dogsled
    - dupl
    - errcheck
    - exhaustive
    - funlen
    - gochecknoinits
    - goconst
    - gocritic
    - gocyclo
    - gofmt
    - goimports
    - goprintffuncname
    - gosimple
    - govet
    - ineffassign
    - lll
    - misspell
    - nakedret
    - noctx
    - nolintlint
    - rowserrcheck
    - staticcheck
    - structcheck
    - stylecheck
    - typecheck
    - unconvert
    - unparam
    - unused
    - varcheck
    - whitespace

issues:
  exclude-use-default: false
  exclude:
    # _ instead of err checks
    - G104
    # for "public interface + private struct implementation" cases only!
    - exported func * returns unexported type *, which can be annoying to use
    # can be removed in the development phase
    # - (comment on exported (method|function|type|const)|should have( a package)? comment|comment should be of the form)
    # not for the active development - can be removed in the stable phase
    - should have a package comment, unless it's in another file for this package
    - don't use an underscore in package name
    # errcheck: Almost all programs ignore errors on these functions and in most cases it's ok
    - Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*printf?|os\.(Un)?Setenv|.*Rollback). is not checked
    - should check returned error before deferring
Go environment
$ go version && go env

go version go1.16.4 windows/amd64
set GO111MODULE=on
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\Artyom\AppData\Local\go-build
set GOENV=C:\Users\Artyom\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\Artyom\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\Artyom\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.16.4
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=0
set GOMOD=C:\Users\Artyom\Documents\GitHub\ocp-presentation-api\go.mod
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -fmessage-length=0 -fdebug-prefix-map=C:\Users\Artyom\AppData\Local\Temp\go-build1199481773=/tmp/go-build -gno-record-gcc-switches
Verbose output of running
$ golangci-lint cache clean
$ golangci-lint run -v
level=info msg="[config_reader] Used config file .golangci.yml"
level=info msg="[lintersdb] Active 33 linters: [bodyclose deadcode depguard dogsled dupl errcheck exhaustive funlen gochecknoinits goconst gocritic gocyclo gofmt goimports goprintffuncname gosimple govet ineffassign lll misspell nakedret noctx nolintlint rowserrcheck staticcheck structcheck stylecheck typecheck unconvert unparam unused varcheck whitespace]"
level=info msg="[loader] Go packages loading at mode 575 (compiled_files|exports_file|types_sizes|deps|files|imports|name) took 677.2319ms"
level=info msg="[runner/filename_unadjuster] Pre-built 0 adjustments in 1.574ms"
level=info msg="[linters context/goanalysis] analyzers took 18.3540546s with top 10 stages: buildir: 6.3703945s, exhaustive: 1.8464308s, printf: 1.2993537s, ctrlflow: 1.1933869s, nilness: 1.0348168s, SA5012: 949.3861ms, fact_purity: 936.0713ms, typedness: 912.2299ms, fact_deprecated: 900.9933ms, gofmt: 587.3965ms"
level=warning msg="[runner] Can't run linter goanalysis_metalinter: gofmt: can't extract issues from gofmt diff output \"\": got no diffs from patch parser: []"
level=info msg="[runner] processing took 0s with stages: filename_unadjuster: 0s, skip_dirs: 0s, autogenerated_exclude: 0s, nolint: 0s, diff: 0s, exclude: 0s, uniq_by_line: 0s, max_per_file_from_linter: 
0s, max_same_issues: 0s, source_code: 0s, path_shortener: 0s, path_prettifier: 0s, exclude-rules: 0s, max_from_linter: 0s, severity-rules: 0s, cgo: 0s, skip_files: 0s, identifier_marker: 0s, path_prefixer: 0s, sort_results: 0s"
level=info msg="[runner] linters took 4.2696281s with stages: goanalysis_metalinter: 4.2691082s"
level=info msg="File cache stats: 11 entries of total size 11.0KiB"
level=info msg="Memory: 52 samples, avg is 190.8MB, max is 317.1MB"
level=info msg="Execution took 5.0510534s"
Code example or link to a public repository
@arttet arttet added the bug Something isn't working label May 30, 2021
@boring-cyborg
Copy link

boring-cyborg bot commented May 30, 2021

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

@ldez ldez added platform: windows Issue that is related to Windows enhancement New feature or improvement and removed bug Something isn't working labels May 30, 2021
@ldez
Copy link
Member

ldez commented May 30, 2021

Duplicate of #362

@ldez ldez marked this as a duplicate of #362 May 30, 2021
@ldez ldez closed this as completed May 30, 2021
@ldez ldez added the duplicate This issue or pull request already exists label May 30, 2021
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 enhancement New feature or improvement platform: windows Issue that is related to Windows
Projects
None yet
Development

No branches or pull requests

2 participants