-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- rename CI action build to test - move lint timeout to .golangci.yml - add CI action to validate generated files - add paramgen as tool dependency - update dependency versions (why didn't dependabot update them?!) - enable more linters
- Loading branch information
1 parent
e6ee1d7
commit 6273b4a
Showing
14 changed files
with
459 additions
and
448 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: validate-generated-files | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
|
||
jobs: | ||
validate-generated-files: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: 'go.mod' | ||
|
||
- name: Check generated files | ||
run: | | ||
export PATH=$PATH:$(go env GOPATH)/bin | ||
make install-tools generate | ||
git diff --exit-code --numstat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,120 @@ | ||
run: | ||
timeout: 5m | ||
|
||
linters-settings: | ||
gofmt: | ||
simplify: false | ||
govet: | ||
check-shadowing: false | ||
nolintlint: | ||
allow-unused: false # report any unused nolint directives | ||
require-explanation: true # require an explanation for nolint directives | ||
require-specific: true # require nolint directives to mention the specific linter being suppressed | ||
gocyclo: | ||
min-complexity: 20 | ||
goconst: | ||
ignore-tests: true | ||
wrapcheck: | ||
ignoreSigs: | ||
- .Errorf( | ||
- errors.New( | ||
- errors.Unwrap( | ||
- errors.Join( | ||
- .Wrap( | ||
- .Wrapf( | ||
- .WithMessage( | ||
- .WithMessagef( | ||
- .WithStack( | ||
- (context.Context).Err() | ||
|
||
issues: | ||
exclude-rules: | ||
- path: _test\.go | ||
linters: | ||
- dogsled | ||
- gosec | ||
- gocognit | ||
- errcheck | ||
- forcetypeassert | ||
- funlen | ||
- err113 | ||
- dupl | ||
- maintidx | ||
|
||
linters: | ||
# please, do not use `enable-all`: it's deprecated and will be removed soon. | ||
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint | ||
disable-all: true | ||
enable: | ||
- asasalint | ||
- asciicheck | ||
- bidichk | ||
- bodyclose | ||
- containedctx | ||
- contextcheck | ||
- decorder | ||
# - depguard | ||
- dogsled | ||
- dupl | ||
- dupword | ||
- durationcheck | ||
- errcheck | ||
- errchkjson | ||
- errname | ||
# - errorlint | ||
# - exhaustive | ||
# - exhaustivestruct | ||
- errorlint | ||
- exhaustive | ||
- exportloopref | ||
# - forbidigo | ||
# - forcetypeassert | ||
# - funlen | ||
# - gochecknoinits | ||
- forcetypeassert | ||
- funlen | ||
- gci | ||
- ginkgolinter | ||
- gocheckcompilerdirectives | ||
- gochecknoinits | ||
- gocognit | ||
- goconst | ||
- gocritic | ||
- gocyclo | ||
# - cyclop # not interested in package complexities at the moment | ||
# - godot | ||
- godot | ||
- err113 | ||
- gofmt | ||
# - gofumpt | ||
- gofumpt | ||
- goheader | ||
- goimports | ||
# - revive # lots of unused parameters in the template, would be helpful for the user to keep them | ||
# - gomnd | ||
- gomoddirectives | ||
- gomodguard | ||
- goprintffuncname | ||
- gosec | ||
- gosimple | ||
- gosmopolitan | ||
- govet | ||
# - ifshort | ||
- grouper | ||
- importas | ||
- ineffassign | ||
# - importas | ||
# - lll | ||
# - misspell | ||
- interfacebloat | ||
# - ireturn # Doesn't have correct support for generic types https://github.com/butuzov/ireturn/issues/37 | ||
- loggercheck | ||
- maintidx | ||
- makezero | ||
# - nakedret | ||
# - nilerr | ||
# - nilnil | ||
# - nlreturn | ||
- mirror | ||
- misspell | ||
- musttag | ||
- nakedret | ||
- nestif | ||
- nilerr | ||
- nilnil | ||
- noctx | ||
- nolintlint | ||
# - paralleltest | ||
- nosprintfhostport | ||
- prealloc | ||
- predeclared | ||
# - rowserrcheck | ||
- promlinter | ||
- reassign | ||
- revive | ||
- rowserrcheck | ||
- sqlclosecheck | ||
- staticcheck | ||
- stylecheck | ||
# - sqlclosecheck | ||
# - tagliatelle | ||
# - tenv | ||
# - thelper | ||
# - tparallel | ||
- typecheck | ||
- tenv | ||
- testableexamples | ||
- thelper | ||
- unconvert | ||
# - unparam | ||
- unparam | ||
- unused | ||
# - wastedassign | ||
- usestdlibvars | ||
- wastedassign | ||
- whitespace | ||
# - wrapcheck | ||
# - wsl | ||
- wrapcheck | ||
- zerologlint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,31 @@ | ||
.PHONY: build test test-integration generate install-paramgen install-tools golangci-lint-install | ||
|
||
VERSION=$(shell git describe --tags --dirty --always) | ||
|
||
.PHONY: build | ||
build: | ||
go build -ldflags "-X 'github.com/conduitio/conduit-connector-connectorname.version=${VERSION}'" -o conduit-connector-connectorname cmd/connector/main.go | ||
|
||
.PHONY: test | ||
test: | ||
go test $(GOTEST_FLAGS) -race ./... | ||
|
||
.PHONY: test-integration | ||
test-integration: | ||
# run required docker containers, execute integration tests, stop containers after tests | ||
docker compose -f test/docker-compose.yml up -d | ||
go test $(GOTEST_FLAGS) -v -race ./...; ret=$$?; \ | ||
docker compose -f test/docker-compose.yml down; \ | ||
exit $$ret | ||
|
||
.PHONY: generate | ||
generate: | ||
go generate ./... | ||
|
||
install-paramgen: | ||
go install github.com/conduitio/conduit-connector-sdk/cmd/paramgen@latest | ||
|
||
.PHONY: install-tools | ||
install-tools: | ||
@echo Installing tools from tools.go | ||
@go list -e -f '{{ join .Imports "\n" }}' tools.go | xargs -tI % go install % | ||
@go list -e -f '{{ join .Imports "\n" }}' tools.go | xargs -I % go list -f "%@{{.Module.Version}}" % | xargs -tI % go install % | ||
@go mod tidy | ||
|
||
.PHONY: lint | ||
lint: | ||
golangci-lint run -v | ||
golangci-lint run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.