Skip to content

Commit

Permalink
Ran linter against Go code.
Browse files Browse the repository at this point in the history
  • Loading branch information
skyzyx committed Mar 26, 2024
1 parent 82724b6 commit 1d077cd
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 38 deletions.
3 changes: 3 additions & 0 deletions .ecrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"\\.cache$",
"\\.css\\.map$",
"\\.dcignore$",
"\\.ecrc$",
"\\.eot$",
"\\.example$",
"\\.gif$",
Expand All @@ -34,9 +35,11 @@
"\\.snap$",
"\\.svg$",
"\\.tar$",
"\\.terraform-docs\\.yml$",
"\\.terraform\\.lock\\.hcl$",
"\\.ttf$",
"\\.txt$",
"\\.vscode/.*?\\.json$",
"\\.webp$",
"\\.wmv$",
"\\.woff$",
Expand Down
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ max_line_length = 20000
indent_size = 2

# Configuration formats
[*.{hcl,json,jsonc,toml,yaml,yml}]
[*.{hcl,json,jsonc,toml,yaml,yml}, .ecrc]
indent_size = 2

[*.go]
Expand Down
29 changes: 1 addition & 28 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ repos:
- --maxkb=500
- --enforce-all
- id: check-case-conflict
- id: check-json
- id: check-merge-conflict
- id: check-toml
- id: check-xml
Expand Down Expand Up @@ -99,46 +98,20 @@ repos:
- --space-redirects
# goplicate-end:shell

# ----------------------------------------------------------------------------
# goplicate-start:python
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: fix-encoding-pragma
args:
- --remove
- id: requirements-txt-fixer

- repo: https://github.com/asottile/pyupgrade
rev: c21b4c4d153be0633357686c7697f539ac194868
hooks:
- id: pyupgrade
args:
- --py311-plus

- repo: https://github.com/asottile/reorder_python_imports
rev: c4fe43d9809f1507508b3aba24ad1a72b5407f58
hooks:
- id: reorder-python-imports
args:
- --py311-plus
# goplicate-end:python

# ----------------------------------------------------------------------------
# goplicate-start:golang
- repo: https://github.com/skyzyx/git-hooks
rev: 4a2f0dc93e5c5353ed5e619599b0d15e34df88db
hooks:
- id: gofumpt
- id: golangci-lint
- id: gomodupdate

- repo: local
hooks:
- id: go-consistent
name: 'Go: Consistent Patterns'
description: Analyzes Go packages to identify unnecessary type conversions.
entry: bash -c 'go-consistent ./corefunc/...; go-consistent ./corefuncprovider/...'
entry: bash -c 'go-consistent ./...'
language: system
stages: [commit, push]

Expand Down
10 changes: 5 additions & 5 deletions __first_time.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ TYPES=()

# Pass GO=true when calling the script.
# shellcheck disable=2154
if [[ "${GO}" == "true" ]]; then
if [[ ${GO} == "true" ]]; then
TYPES+=("go")
fi

# Pass TF=true when calling the script.
# shellcheck disable=2154
if [[ "${TF}" == "true" ]]; then
if [[ ${TF} == "true" ]]; then
TYPES+=("tf")
fi

Expand Down Expand Up @@ -78,13 +78,13 @@ TYPES=()

# Pass GO=true when calling the script.
# shellcheck disable=2154
if [[ "${GO}" == "true" ]]; then
if [[ ${GO} == "true" ]]; then
TYPES+=("go")
fi

# Pass TF=true when calling the script.
# shellcheck disable=2154
if [[ "${TF}" == "true" ]]; then
if [[ ${TF} == "true" ]]; then
TYPES+=("tf")
fi

Expand All @@ -106,7 +106,7 @@ cp -vf "${RUNNER_TEMP}/updates/.vscode/settings.tmpl.jsonc" "${PWD}/.vscode/sett
goplicate run --allow-dirty --confirm --stash-changes

# Generate .ecrc
tomljson ecrc.toml >.ecrc
tomljson ecrc.toml > .ecrc

# Make shell scripts executable
find "${PWD}" -type f -name "*.sh" -print0 |
Expand Down
8 changes: 4 additions & 4 deletions __update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ for FILE in ${FILES[@]}; do

# Otherwise, as long as the copied file is not the ignored file, go
# ahead and copy it (no restricton)
elif [[ "${FILE}" != "${RUNNER_TEMP}/full-copy/${IGNORE}" ]]; then
elif [[ ${FILE} != "${RUNNER_TEMP}/full-copy/${IGNORE}" ]]; then
cp -Rfv "${FILE}" "${PWD}"
fi
done
Expand All @@ -56,13 +56,13 @@ TYPES=()

# Pass GO=true when calling the script.
# shellcheck disable=2154
if [[ "${GO}" == "true" ]]; then
if [[ ${GO} == "true" ]]; then
TYPES+=("go")
fi

# Pass TF=true when calling the script.
# shellcheck disable=2154
if [[ "${TF}" == "true" ]]; then
if [[ ${TF} == "true" ]]; then
TYPES+=("tf")
fi

Expand All @@ -78,7 +78,7 @@ done
goplicate run --allow-dirty --confirm --stash-changes

# Generate .ecrc
tomljson ecrc.toml >.ecrc
tomljson ecrc.toml > .ecrc

# Make shell scripts executable
find "${PWD}" -type f -name "*.sh" -print0 |
Expand Down
3 changes: 3 additions & 0 deletions ecrc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Exclude = [
"\\.cache$",
"\\.css\\.map$",
"\\.dcignore$",
"\\.ecrc$",
"\\.eot$",
"\\.example$",
"\\.gif$",
Expand All @@ -46,9 +47,11 @@ Exclude = [
"\\.snap$",
"\\.svg$",
"\\.tar$",
"\\.terraform-docs\\.yml$",
"\\.terraform\\.lock\\.hcl$",
"\\.ttf$",
"\\.txt$",
"\\.vscode/.*?\\.json$",
"\\.webp$",
"\\.wmv$",
"\\.woff$",
Expand Down

0 comments on commit 1d077cd

Please sign in to comment.