Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .automation/test/golang/golang_fix_01.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// This is a package comment
package main

import "fmt"

func nicolas() {
fmt.Println("hello world")
}
8 changes: 8 additions & 0 deletions .automation/test/golang/golang_fix_02.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// This is a package comment
package main

import "fmt"

func nicolas() {
fmt.Println("hello world")
}
45 changes: 8 additions & 37 deletions .github/linters/.golangci.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,11 @@
---
#########################
#########################
## Golang Linter rules ##
#########################
#########################

# configure golangci-lint
# see https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml
issues:
exclude-rules:
- path: _test\.go
linters:
- dupl
- gosec
- goconst
linters:
disable-all: true
enable:
- golint
- gosec
- unconvert
- gocyclo
- goconst
- goimports
- maligned
- gofmt
- gocritic
linters-settings:
errcheck:
# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
# default is false: such cases aren't reported by default.
check-blank: true
govet:
# report about shadowed variables
check-shadowing: true
gocyclo:
# minimal code complexity to report, 30 by default
min-complexity: 15
maligned:
# print struct with more effective memory layout or not, false by default
suggest-new: true
- gosimple
- govet
- ineffassign
- staticcheck
- typecheck
- unused
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Note: Can be used with `oxsecurity/megalinter@beta` in your GitHub Action mega-l
- Jscpd: Do not output HTML reports if REPORT_OUTPUT_FOLDER is none
- kubeconform: Simplify installation and get latest version
- Updated cases in console/log output to use ⚠ `Warning Sign (U+26A0)` instead of ◬ `White Up-Pointing Triangle with Dot (U+25EC)`
- golangci-lint : Change default config & add autofix capability using **--fix** argument

- Reporters
- Enhancements and fixes on Gitlab Comment Reporter
Expand Down
45 changes: 8 additions & 37 deletions TEMPLATES/.golangci.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,11 @@
---
#########################
#########################
## Golang Linter rules ##
#########################
#########################

# configure golangci-lint
# see https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml
issues:
exclude-rules:
- path: _test\.go
linters:
- dupl
- gosec
- goconst
linters:
disable-all: true
enable:
- golint
- gosec
- unconvert
- gocyclo
- goconst
- goimports
- maligned
- gofmt
- gocritic
linters-settings:
errcheck:
# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
# default is false: such cases aren't reported by default.
check-blank: true
govet:
# report about shadowed variables
check-shadowing: true
gocyclo:
# minimal code complexity to report, 30 by default
min-complexity: 15
maligned:
# print struct with more effective memory layout or not, false by default
suggest-new: true
- gosimple
- govet
- ineffassign
- staticcheck
- typecheck
- unused
1 change: 1 addition & 0 deletions megalinter/descriptors/go.megalinter-descriptor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ linters:
cli_lint_mode: list_of_files
cli_lint_extra_args:
- "run"
cli_lint_fix_arg_name: --fix
cli_version_arg_name: "version"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello,
Minor comment not really related to the PR but I thought I'd mention it since I was working on a monorepo wrapper for golangci lint. I noticed for me the count didn't work with the default unless I added:

    cli_lint_errors_count: regex_count
    cli_lint_errors_regex: "\\.go:\\d+:\\d+: .*\\n"

That seemed to do it pretty well in my tests.

version_extract_regex: "((\\d+(\\.\\d+)+)|(master))"
examples:
Expand Down