Skip to content
This repository has been archived by the owner on Oct 5, 2022. It is now read-only.

Commit

Permalink
Merge pull request #20 from kinvolk/invidian/updates
Browse files Browse the repository at this point in the history
Update Tinkerbell and linter, add linter and codespell to CI
  • Loading branch information
displague authored Dec 18, 2020
2 parents ba6735e + 190e90c commit 5bbe543
Show file tree
Hide file tree
Showing 18 changed files with 1,718 additions and 549 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/acctest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,26 @@ jobs:
env:
TF_ACC_TERRAFORM_VERSION: ${{ matrix.terraform }}
run: make testacc

golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.33.0

codespell:
name: Codespell
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Codespell
uses: codespell-project/actions-codespell@master
with:
check_filenames: true
check_hidden: true
85 changes: 85 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
output:
sort-results: true

issues:
exclude-use-default: false
max-same-issues: 0
max-issues-per-linter: 0
exclude-rules:

linters-settings:
exhaustive:
default-signifies-exhaustive: true

# List for enabled linters can be generated for updates using the following command.
# golangci-lint linters | grep -E '^\S+:' | cut -d: -f1 | sort | sed 's/^/ - /g' | grep -v -E "($(grep '^ disable:' -A 100 .golangci.yml | grep -E ' - \S+$' | awk '{print $2}' | tr \\n '|' | sed 's/|$//g'))"
linters:
disable-all: false
enable:
- asciicheck
- bodyclose
- deadcode
- depguard
- dogsled
- dupl
- errcheck
- errorlint
- exhaustive
- exportloopref
- funlen
- gochecknoglobals
- gochecknoinits
- gocognit
- goconst
- gocritic
- gocyclo
- godot
- gofmt
- gofumpt
- goheader
- goimports
- golint
- gomnd
- gomodguard
- goprintffuncname
- ineffassign
- interfacer
- lll
- maligned
- misspell
- nakedret
- nestif
- nlreturn
- noctx
- nolintlint
- paralleltest
- prealloc
- rowserrcheck
- scopelint
- sqlclosecheck
- structcheck
- stylecheck
- tparallel
- typecheck
- unconvert
- unparam
- varcheck
- whitespace
- wrapcheck
- wsl
disable:
# We use gofmt for formatting and gci is not compatible with it.
- gci

# This code do not export any API returning errors
# and internally there is no need to use typed errors.
- goerr113

# Terraform testing convention do not encourage to use them.
- testpackage

# It is OK to have TODOs in the code.
- godox

# As many structs in this code won't use all the fields and it's OK.
- exhaustivestruct
18 changes: 3 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,7 @@ GOBUILD=CGO_ENABLED=$(CGO_ENABLED) $(GOCMD) build -v -buildmode=exe -ldflags $(L
GO_PACKAGES=./...
GO_TESTS=^.*$

GOLANGCI_LINT_VERSION=v1.30.0

# Disabled linters:
#
# - gci as we use gofmt for formatting.
#
# - goerr113 as this code do not export any API returning errors
# and internally there is no need to use typed errors.
#
# - testpackage as Terraform testing convention do not encourage to use them.
#
# - godox as it is OK to have TODOs in the code.
DISABLED_LINTERS=gci,goerr113,testpackage,godox
GOLANGCI_LINT_VERSION=v1.33.0

BIN_PATH=$$HOME/bin
TF_ACC=
Expand Down Expand Up @@ -65,7 +53,7 @@ test: build-test ## Run unit tests matching GO_TESTS in GO_PACKAGES.

.PHONY: lint
lint: build build-test ## Compile code and run linter.
golangci-lint run --enable-all --disable=$(DISABLED_LINTERS) --max-same-issues=0 --max-issues-per-linter=0 --build-tags integration --timeout 10m --exclude-use-default=false $(GO_PACKAGES)
golangci-lint run $(GO_PACKAGES)

.PHONY: build-test
build-test: # Compile unit tests. Useful for checking syntax errors before running unit tests.
Expand Down Expand Up @@ -115,7 +103,7 @@ endif
.PHONY: release
release: release-env-check all
release: ## Creates a GitHub release using goreleaser.
GITHUB_TOKEN=$(GITHUB_TOKEN) GPG_FINGERPRINT=$(GPG_FINGERPRINT) bash -c 'go run github.com/goreleaser/goreleaser release --release-notes <(go run github.com/rcmachado/changelog show $(RELEASE_VERSION))'
GITHUB_TOKEN=$(GITHUB_TOKEN) GPG_FINGERPRINT=$(GPG_FINGERPRINT) bash -c 'go run -modfile=go.tools.mod github.com/goreleaser/goreleaser release --release-notes <(go run -modfile=go.tools.mod github.com/rcmachado/changelog show $(RELEASE_VERSION))'

.PHONY: install-tools
install-tools: ## Installs development tools required for creating a release.
Expand Down
17 changes: 8 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,31 @@ go 1.14

require (
github.com/agext/levenshtein v1.2.3 // indirect
github.com/aws/aws-sdk-go v1.31.13 // indirect
github.com/fatih/color v1.9.0 // indirect
github.com/google/go-cmp v0.5.2 // indirect
github.com/google/uuid v1.1.2
github.com/goreleaser/goreleaser v0.143.0
github.com/grpc-ecosystem/grpc-gateway v1.15.0 // indirect
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
github.com/hashicorp/go-hclog v0.14.1 // indirect
github.com/hashicorp/go-multierror v1.1.0 // indirect
github.com/hashicorp/go-uuid v1.0.2 // indirect
github.com/hashicorp/hcl/v2 v2.6.0 // indirect
github.com/hashicorp/terraform-plugin-sdk/v2 v2.0.4-0.20200930154456-951f045a9f14
github.com/hashicorp/yamux v0.0.0-20200609203250-aecfd211c9ce // indirect
github.com/imdario/mergo v0.3.11 // indirect
github.com/kr/pretty v0.2.0 // indirect
github.com/mattn/go-colorable v0.1.7 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/mitchellh/mapstructure v1.3.3 // indirect
github.com/oklog/run v1.1.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/rcmachado/changelog v0.0.0-20200703205747-24a2e26bdaaa
github.com/tinkerbell/tink v0.0.0-20200930194128-08601fea303b
github.com/tinkerbell/tink v0.0.0-20201109122352-0e8e57332303
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
github.com/zclconf/go-cty v1.6.1 // indirect
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a // indirect
golang.org/x/net v0.0.0-20200930145003-4acb6c075d10 // indirect
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/genproto v0.0.0-20200930140634-01fc692af84b // indirect
gopkg.in/yaml.v2 v2.3.0 // indirect
golang.org/x/tools v0.0.0-20200921190806-0f52b63a40e8 // indirect
google.golang.org/genproto v0.0.0-20201026171402-d4b8fe4fd877 // indirect
gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c // indirect
)
Loading

0 comments on commit 5bbe543

Please sign in to comment.