Skip to content

Commit 6924988

Browse files
authored
feat: support GoReleaser (#5505)
1 parent ca2a416 commit 6924988

9 files changed

Lines changed: 18 additions & 1 deletion

File tree

Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ FROM ghcr.io/terraform-linters/tflint:v0.50.3 as tflint
1414
FROM ghcr.io/yannh/kubeconform:v0.6.4 as kubeconfrm
1515
FROM golang:1.22.2-alpine as golang
1616
FROM golangci/golangci-lint:v1.57.2 as golangci-lint
17+
FROM goreleaser/goreleaser:v1.25.1 as goreleaser
1718
FROM hadolint/hadolint:v2.12.0-alpine as dockerfile-lint
1819
FROM hashicorp/terraform:1.7.5 as terraform
1920
FROM koalaman/shellcheck:v0.10.0 as shellcheck
@@ -276,6 +277,11 @@ COPY --from=golang /usr/local/go/pkg/ /usr/lib/go/pkg/
276277
COPY --from=golang /usr/local/go/src/ /usr/lib/go/src/
277278
COPY --from=golangci-lint /usr/bin/golangci-lint /usr/bin/
278279

280+
######################
281+
# Install GoReleaser #
282+
######################
283+
COPY --from=goreleaser /usr/bin/goreleaser /usr/bin/
284+
279285
#####################
280286
# Install Terraform #
281287
#####################

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ Super-linter supports the following tools:
6767
| **Gherkin** | [gherkin-lint](https://github.com/vsiakka/gherkin-lint) |
6868
| **GitHub Actions** | [actionlint](https://github.com/rhysd/actionlint) |
6969
| **Golang** | [golangci-lint](https://github.com/golangci/golangci-lint) |
70+
| **GoReleser** | [GoReleser](https://github.com/goreleaser/goreleaser) |
7071
| **Groovy** | [npm-groovy-lint](https://github.com/nvuillam/npm-groovy-lint) |
7172
| **HTML** | [HTMLHint](https://github.com/htmlhint/HTMLHint) |
7273
| **Java** | [checkstyle](https://checkstyle.org) / [google-java-format](https://github.com/google/google-java-format) |
@@ -274,6 +275,7 @@ You can configure super-linter using the following environment variables:
274275
| **VALIDATE_GITLEAKS** | `true` | Flag to enable or disable the linting process of the secrets. |
275276
| **VALIDATE_GO** | `true` | Flag to enable or disable the linting process of the individual Golang files. Set this to `false` if you want to lint Go modules. See the `VALIDATE_GO_MODULES` variable. |
276277
| **VALIDATE_GO_MODULES** | `true` | Flag to enable or disable the linting process of Go modules. Super-linter considers a directory to be a Go module if it contains a file named `go.mod`. |
278+
| **VALIDATE_GO_RELEASER** | `true` | Flag to enable or disable the linting process of the GoReleaser config file. |
277279
| **VALIDATE_GOOGLE_JAVA_FORMAT** | `true` | Flag to enable or disable the linting process of the Java language. (Utilizing: google-java-format) |
278280
| **VALIDATE_GROOVY** | `true` | Flag to enable or disable the linting process of the language. |
279281
| **VALIDATE_HTML** | `true` | Flag to enable or disable the linting process of the HTML language. |

lib/functions/buildFileList.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,8 @@ BuildFileArrays() {
481481
elif [ "${FILE_TYPE}" == "xml" ] ||
482482
[ "${FILE_TYPE}" == "xsd" ]; then
483483
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-XML"
484+
elif [[ "${FILE}" =~ .?goreleaser.+ya?ml ]]; then
485+
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-GO_RELEASER"
484486
elif [ "${FILE_TYPE}" == "yml" ] || [ "${FILE_TYPE}" == "yaml" ]; then
485487
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-YAML"
486488
if DetectActions "${FILE}"; then

lib/functions/linterCommands.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ LINTER_COMMANDS_ARRAY_GHERKIN=(gherkin-lint -c "${GHERKIN_LINTER_RULES}")
5151
LINTER_COMMANDS_ARRAY_GO=(golangci-lint run -c "${GO_LINTER_RULES}" --fast)
5252
# Consume the input as we do with ANSIBLE
5353
LINTER_COMMANDS_ARRAY_GO_MODULES=(golangci-lint run --allow-parallel-runners -c "${GO_LINTER_RULES}" "&& echo \"Linted: {}\"")
54+
LINTER_COMMANDS_ARRAY_GO_RELEASER=(goreleaser check)
5455
LINTER_COMMANDS_ARRAY_GOOGLE_JAVA_FORMAT=(java -jar /usr/bin/google-java-format --dry-run --set-exit-if-changed)
5556
LINTER_COMMANDS_ARRAY_GROOVY=(npm-groovy-lint -c "${GROOVY_LINTER_RULES}" --failon warning --no-insight)
5657
LINTER_COMMANDS_ARRAY_HTML=(htmlhint --config "${HTML_LINTER_RULES}")

lib/linter.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ fi
292292
LANGUAGE_ARRAY=('ANSIBLE' 'ARM' 'BASH' 'BASH_EXEC' 'CHECKOV' 'CLANG_FORMAT'
293293
'CLOUDFORMATION' 'CLOJURE' 'COFFEESCRIPT' 'CPP' 'CSHARP' 'CSS' 'DART'
294294
'DOCKERFILE_HADOLINT' 'EDITORCONFIG' 'ENV' 'GITHUB_ACTIONS'
295-
'GITLEAKS' 'GHERKIN' 'GO' 'GO_MODULES' 'GOOGLE_JAVA_FORMAT' 'GROOVY' 'HTML' 'JAVA'
295+
'GITLEAKS' 'GHERKIN' 'GO' 'GO_MODULES' 'GO_RELEASER' 'GOOGLE_JAVA_FORMAT' 'GROOVY' 'HTML' 'JAVA'
296296
'JAVASCRIPT_ES' "${JAVASCRIPT_STYLE_NAME}" 'JSCPD' 'JSON' 'JSONC' 'JSX'
297297
'KUBERNETES_KUBECONFORM' 'KOTLIN' 'LATEX' 'LUA' 'MARKDOWN'
298298
'NATURAL_LANGUAGE' 'OPENAPI' 'PERL' 'PHP_BUILTIN' 'PHP_PHPCS' 'PHP_PHPSTAN'

scripts/linterVersions.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ LINTER_NAMES_ARRAY['GITLEAKS']="gitleaks"
2525
LINTER_NAMES_ARRAY['GHERKIN']="gherkin-lint"
2626
LINTER_NAMES_ARRAY['GO']="golangci-lint"
2727
LINTER_NAMES_ARRAY['GO_MODULES']="${LINTER_NAMES_ARRAY['GO']}"
28+
LINTER_NAMES_ARRAY['GO_RELEASER']="goreleaser"
2829
LINTER_NAMES_ARRAY['GOOGLE_JAVA_FORMAT']="google-java-format"
2930
LINTER_NAMES_ARRAY['GROOVY']="npm-groovy-lint"
3031
LINTER_NAMES_ARRAY['HTML']="htmlhint"

test/inspec/super-linter/controls/super_linter.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@
157157
{ linter_name: "gherkin-lint", expected_exit_status: 1}, # expect a return code = 1 because this linter doesn't support a "get linter version" command
158158
{ linter_name: "gitleaks", version_option: "version"},
159159
{ linter_name: "golangci-lint"},
160+
{ linter_name: "goreleaser"},
160161
{ linter_name: "google-java-format", version_command: "java -jar /usr/bin/google-java-format --version"},
161162
{ linter_name: "hadolint"},
162163
{ linter_name: "htmlhint"},
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
brews:
2+
- folder: test
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
brews:
2+
- directory: test

0 commit comments

Comments
 (0)