Skip to content

Commit

Permalink
Uber mock, update golangci-lint (#23)
Browse files Browse the repository at this point in the history
* replace github.com/golang/mock with go.uber.org/mock

* update golangci-lint

* add dependabot, ci action for validating generated files, makefile, update dependencies
  • Loading branch information
lovromazgon authored Aug 7, 2023
1 parent 683b23b commit 528f0ee
Show file tree
Hide file tree
Showing 17 changed files with 361 additions and 181 deletions.
19 changes: 19 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Docs: https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates
version: 2
updates:

# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
commit-message:
prefix: ".github:"

# Maintain dependencies for Go
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"
commit-message:
prefix: "go.mod:"
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.51.2
version: v1.53.3
30 changes: 30 additions & 0 deletions .github/workflows/validate-generated-files.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: validate-generated-files

on:
push:
branches: [ main ]
pull_request:

jobs:
validate-generated-files:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'

- name: Install Protoc
uses: arduino/setup-protoc@v2

- name: Set up Buf
uses: bufbuild/buf-setup-action@v1

- name: Check generated files
run: |
export PATH=$PATH:$(go env GOPATH)/bin
make install-tools
make generate
git diff --exit-code --numstat
8 changes: 7 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
linters-settings:
depguard:
rules:
main:
deny:
- pkg: github.com/golang/mock
desc: github.com/golang/mock is deprecated, use go.uber.org/mock instead
gofmt:
simplify: false
govet:
Expand All @@ -23,7 +29,7 @@ linters:
disable-all: true
enable:
- bodyclose
# - depguard
- depguard
- dogsled
- durationcheck
- errcheck
Expand Down
18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.PHONY: build lint generate install-tools

test:
go test $(GOTEST_FLAGS) -race ./...

lint:
golangci-lint run

generate:
go generate ./...

proto-generate:
cd proto && buf generate

install-tools:
@echo Installing tools from tools.go
@go list -f '{{ join .Imports "\n" }}' tools.go | xargs -tI % go install %
@go mod tidy
4 changes: 2 additions & 2 deletions cpluginv1/internal/fromproto/destination.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func DestinationConfigureRequest(in *connectorv1.Destination_Configure_Request)
return out, nil
}

func DestinationStartRequest(in *connectorv1.Destination_Start_Request) (cpluginv1.DestinationStartRequest, error) {
func DestinationStartRequest(_ *connectorv1.Destination_Start_Request) (cpluginv1.DestinationStartRequest, error) {
return cpluginv1.DestinationStartRequest{}, nil
}

Expand All @@ -48,7 +48,7 @@ func DestinationStopRequest(in *connectorv1.Destination_Stop_Request) (cpluginv1
return out, nil
}

func DestinationTeardownRequest(in *connectorv1.Destination_Teardown_Request) (cpluginv1.DestinationTeardownRequest, error) {
func DestinationTeardownRequest(_ *connectorv1.Destination_Teardown_Request) (cpluginv1.DestinationTeardownRequest, error) {
return cpluginv1.DestinationTeardownRequest{}, nil
}

Expand Down
4 changes: 2 additions & 2 deletions cpluginv1/internal/fromproto/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ func SourceRunRequest(in *connectorv1.Source_Run_Request) (cpluginv1.SourceRunRe
return out, nil
}

func SourceStopRequest(in *connectorv1.Source_Stop_Request) (cpluginv1.SourceStopRequest, error) {
func SourceStopRequest(_ *connectorv1.Source_Stop_Request) (cpluginv1.SourceStopRequest, error) {
return cpluginv1.SourceStopRequest{}, nil
}

func SourceTeardownRequest(in *connectorv1.Source_Teardown_Request) (cpluginv1.SourceTeardownRequest, error) {
func SourceTeardownRequest(_ *connectorv1.Source_Teardown_Request) (cpluginv1.SourceTeardownRequest, error) {
return cpluginv1.SourceTeardownRequest{}, nil
}

Expand Down
2 changes: 1 addition & 1 deletion cpluginv1/internal/fromproto/specifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ import (
connectorv1 "github.com/conduitio/conduit-connector-protocol/proto/connector/v1"
)

func SpecifierSpecifyRequest(in *connectorv1.Specifier_Specify_Request) (cpluginv1.SpecifierSpecifyRequest, error) {
func SpecifierSpecifyRequest(_ *connectorv1.Specifier_Specify_Request) (cpluginv1.SpecifierSpecifyRequest, error) {
return cpluginv1.SpecifierSpecifyRequest{}, nil
}
14 changes: 7 additions & 7 deletions cpluginv1/internal/toproto/destination.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ import (
connectorv1 "github.com/conduitio/conduit-connector-protocol/proto/connector/v1"
)

func DestinationConfigureResponse(in cpluginv1.DestinationConfigureResponse) (*connectorv1.Destination_Configure_Response, error) {
func DestinationConfigureResponse(_ cpluginv1.DestinationConfigureResponse) (*connectorv1.Destination_Configure_Response, error) {
return &connectorv1.Destination_Configure_Response{}, nil
}

func DestinationStartResponse(in cpluginv1.DestinationStartResponse) (*connectorv1.Destination_Start_Response, error) {
func DestinationStartResponse(_ cpluginv1.DestinationStartResponse) (*connectorv1.Destination_Start_Response, error) {
return &connectorv1.Destination_Start_Response{}, nil
}

Expand All @@ -35,20 +35,20 @@ func DestinationRunResponse(in cpluginv1.DestinationRunResponse) (*connectorv1.D
return &out, nil
}

func DestinationStopResponse(in cpluginv1.DestinationStopResponse) (*connectorv1.Destination_Stop_Response, error) {
func DestinationStopResponse(_ cpluginv1.DestinationStopResponse) (*connectorv1.Destination_Stop_Response, error) {
return &connectorv1.Destination_Stop_Response{}, nil
}

func DestinationTeardownResponse(in cpluginv1.DestinationTeardownResponse) (*connectorv1.Destination_Teardown_Response, error) {
func DestinationTeardownResponse(_ cpluginv1.DestinationTeardownResponse) (*connectorv1.Destination_Teardown_Response, error) {
return &connectorv1.Destination_Teardown_Response{}, nil
}

func DestinationLifecycleOnCreatedResponse(in cpluginv1.DestinationLifecycleOnCreatedResponse) (*connectorv1.Destination_Lifecycle_OnCreated_Response, error) {
func DestinationLifecycleOnCreatedResponse(_ cpluginv1.DestinationLifecycleOnCreatedResponse) (*connectorv1.Destination_Lifecycle_OnCreated_Response, error) {
return &connectorv1.Destination_Lifecycle_OnCreated_Response{}, nil
}
func DestinationLifecycleOnUpdatedResponse(in cpluginv1.DestinationLifecycleOnUpdatedResponse) (*connectorv1.Destination_Lifecycle_OnUpdated_Response, error) {
func DestinationLifecycleOnUpdatedResponse(_ cpluginv1.DestinationLifecycleOnUpdatedResponse) (*connectorv1.Destination_Lifecycle_OnUpdated_Response, error) {
return &connectorv1.Destination_Lifecycle_OnUpdated_Response{}, nil
}
func DestinationLifecycleOnDeletedResponse(in cpluginv1.DestinationLifecycleOnDeletedResponse) (*connectorv1.Destination_Lifecycle_OnDeleted_Response, error) {
func DestinationLifecycleOnDeletedResponse(_ cpluginv1.DestinationLifecycleOnDeletedResponse) (*connectorv1.Destination_Lifecycle_OnDeleted_Response, error) {
return &connectorv1.Destination_Lifecycle_OnDeleted_Response{}, nil
}
12 changes: 6 additions & 6 deletions cpluginv1/internal/toproto/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ import (
connectorv1 "github.com/conduitio/conduit-connector-protocol/proto/connector/v1"
)

func SourceConfigureResponse(in cpluginv1.SourceConfigureResponse) (*connectorv1.Source_Configure_Response, error) {
func SourceConfigureResponse(_ cpluginv1.SourceConfigureResponse) (*connectorv1.Source_Configure_Response, error) {
return &connectorv1.Source_Configure_Response{}, nil
}

func SourceStartResponse(in cpluginv1.SourceStartResponse) (*connectorv1.Source_Start_Response, error) {
func SourceStartResponse(_ cpluginv1.SourceStartResponse) (*connectorv1.Source_Start_Response, error) {
return &connectorv1.Source_Start_Response{}, nil
}

Expand All @@ -46,16 +46,16 @@ func SourceStopResponse(in cpluginv1.SourceStopResponse) (*connectorv1.Source_St
return &out, nil
}

func SourceTeardownResponse(in cpluginv1.SourceTeardownResponse) (*connectorv1.Source_Teardown_Response, error) {
func SourceTeardownResponse(_ cpluginv1.SourceTeardownResponse) (*connectorv1.Source_Teardown_Response, error) {
return &connectorv1.Source_Teardown_Response{}, nil
}

func SourceLifecycleOnCreatedResponse(in cpluginv1.SourceLifecycleOnCreatedResponse) (*connectorv1.Source_Lifecycle_OnCreated_Response, error) {
func SourceLifecycleOnCreatedResponse(_ cpluginv1.SourceLifecycleOnCreatedResponse) (*connectorv1.Source_Lifecycle_OnCreated_Response, error) {
return &connectorv1.Source_Lifecycle_OnCreated_Response{}, nil
}
func SourceLifecycleOnUpdatedResponse(in cpluginv1.SourceLifecycleOnUpdatedResponse) (*connectorv1.Source_Lifecycle_OnUpdated_Response, error) {
func SourceLifecycleOnUpdatedResponse(_ cpluginv1.SourceLifecycleOnUpdatedResponse) (*connectorv1.Source_Lifecycle_OnUpdated_Response, error) {
return &connectorv1.Source_Lifecycle_OnUpdated_Response{}, nil
}
func SourceLifecycleOnDeletedResponse(in cpluginv1.SourceLifecycleOnDeletedResponse) (*connectorv1.Source_Lifecycle_OnDeleted_Response, error) {
func SourceLifecycleOnDeletedResponse(_ cpluginv1.SourceLifecycleOnDeletedResponse) (*connectorv1.Source_Lifecycle_OnDeleted_Response, error) {
return &connectorv1.Source_Lifecycle_OnDeleted_Response{}, nil
}
2 changes: 1 addition & 1 deletion cpluginv1/internal/toproto/specifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func _() {
_ = vTypes[int(cpluginv1.ParameterTypeDuration)-int(connectorv1.Specifier_Parameter_TYPE_DURATION)]
}

func SpecifierSpecifyRequest(in cpluginv1.SpecifierSpecifyRequest) (*connectorv1.Specifier_Specify_Request, error) {
func SpecifierSpecifyRequest(_ cpluginv1.SpecifierSpecifyRequest) (*connectorv1.Specifier_Specify_Request, error) {
return &connectorv1.Specifier_Specify_Request{}, nil
}

Expand Down
2 changes: 1 addition & 1 deletion cpluginv1/mock/destination.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cpluginv1/mock/source.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cpluginv1/mock/specifier.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

91 changes: 71 additions & 20 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,78 @@ module github.com/conduitio/conduit-connector-protocol
go 1.20

require (
github.com/golang/mock v1.6.0
github.com/hashicorp/go-plugin v1.4.3
google.golang.org/grpc v1.53.0
google.golang.org/protobuf v1.29.1
github.com/bufbuild/buf v1.25.1
github.com/hashicorp/go-plugin v1.4.10
go.uber.org/mock v0.2.0
google.golang.org/grpc v1.57.0
google.golang.org/protobuf v1.31.0
)

require (
github.com/fatih/color v1.7.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/hashicorp/go-hclog v0.14.1 // indirect
github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb // indirect
github.com/jhump/protoreflect v1.10.2-0.20211108190630-d551e22cd340 // indirect
github.com/mattn/go-colorable v0.1.4 // indirect
github.com/mattn/go-isatty v0.0.10 // indirect
github.com/mitchellh/go-testing-interface v1.0.0 // indirect
github.com/oklog/run v1.0.0 // indirect
github.com/stretchr/testify v1.8.1 // indirect
golang.org/x/mod v0.7.0 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
golang.org/x/tools v0.3.0 // indirect
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/bufbuild/connect-go v1.9.0 // indirect
github.com/bufbuild/connect-opentelemetry-go v0.4.0 // indirect
github.com/bufbuild/protocompile v0.6.0 // indirect
github.com/containerd/stargz-snapshotter/estargz v0.14.3 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/docker/cli v24.0.4+incompatible // indirect
github.com/docker/distribution v2.8.2+incompatible // indirect
github.com/docker/docker v24.0.4+incompatible // indirect
github.com/docker/docker-credential-helpers v0.8.0 // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/fatih/color v1.15.0 // indirect
github.com/felixge/fgprof v0.9.3 // indirect
github.com/go-chi/chi/v5 v5.0.10 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/gofrs/uuid/v5 v5.0.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/go-containerregistry v0.15.2 // indirect
github.com/google/pprof v0.0.0-20230705174524-200ffdc848b8 // indirect
github.com/hashicorp/go-hclog v1.5.0 // indirect
github.com/hashicorp/yamux v0.1.1 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jdxcode/netrc v0.0.0-20221124155335-4616370d1a84 // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/klauspost/pgzip v1.2.6 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/moby/term v0.5.0 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/oklog/run v1.1.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0-rc4 // indirect
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pkg/profile v1.7.0 // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/rs/cors v1.9.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/spf13/cobra v1.7.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/tetratelabs/wazero v1.3.1 // indirect
github.com/vbatts/tar-split v0.11.3 // indirect
go.opentelemetry.io/otel v1.16.0 // indirect
go.opentelemetry.io/otel/metric v1.16.0 // indirect
go.opentelemetry.io/otel/sdk v1.16.0 // indirect
go.opentelemetry.io/otel/trace v1.16.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/crypto v0.12.0 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/net v0.14.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/term v0.11.0 // indirect
golang.org/x/text v0.12.0 // indirect
golang.org/x/tools v0.11.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230803162519-f966b187b2e5 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 528f0ee

Please sign in to comment.