Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 47 additions & 39 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,65 @@
version: "2"
run:
tests: false
skip-dirs:
- "mocks"
linters-settings:
golint: {}
gocritic:
enabled-checks: []
disabled-checks:
- regexpMust
goheader:
values:
regexp:
COMPANY: .*
YEAR: '\d\d\d\d(-\d\d\d\d)?'
template: |-
Copyright © {{ YEAR }} {{ COMPANY }}

SPDX-License-Identifier: Apache-2.0

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
linters:
disable-all: false
enable:
- bodyclose
- dogsled
- errcheck
- goconst
- gocritic
- gocyclo
- gofmt
- goheader
- goimports
- goprintffuncname
- gosec
- gosimple
- govet
- ineffassign
- misspell
- nakedret
- revive
- staticcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused
settings:
gocritic:
disabled-checks:
- regexpMust
goheader:
values:
regexp:
COMPANY: .*
YEAR: \d\d\d\d(-\d\d\d\d)?
template: |-
Copyright © {{ YEAR }} {{ COMPANY }}

SPDX-License-Identifier: Apache-2.0

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gofmt
- goimports
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
25 changes: 25 additions & 0 deletions .mockery.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
all: false
filename: '{{ .InterfaceName | snakecase }}.go'
structname: '{{ .InterfaceName }}'
template-data:
unroll-variadic: true
packages:
github.com/hyperledger-firefly/signer/pkg/rpcbackend:
config:
dir: mocks/rpcbackendmocks
pkgname: rpcbackendmocks
interfaces:
Backend:
Subscription:
github.com/hyperledger-firefly/transaction-manager/pkg/fftm:
config:
dir: mocks/fftmmocks
pkgname: fftmmocks
interfaces:
Manager:
github.com/hyperledger-firefly/evmconnect/pkg/ethblocklistener:
config:
dir: mocks/ethblocklistenermocks
pkgname: ethblocklistenermocks
interfaces:
BlockListener:
20 changes: 4 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,11 @@ coverage: test coverage.html
lint: ${LINT}
GOGC=20 $(LINT) run -v --timeout 5m
${MOCKERY}:
$(VGO) install github.com/vektra/mockery/cmd/mockery@latest
$(VGO) install github.com/vektra/mockery/v3@v3.8.0
${LINT}:
$(VGO) install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.64.8
mockpaths:
$(eval FFTM_PATH := $(shell $(VGO) list -f '{{.Dir}}' github.com/hyperledger-firefly/transaction-manager/pkg/fftm))
$(eval FF_SIGNER_PATH := $(shell $(VGO) list -f '{{.Dir}}' github.com/hyperledger-firefly/signer/pkg/rpcbackend))

define makemock
mocks: mocks-$(strip $(1))-$(strip $(2))
mocks-$(strip $(1))-$(strip $(2)): ${MOCKERY} mockpaths
${MOCKERY} --case underscore --dir $(1) --name $(2) --outpkg $(3) --output mocks/$(strip $(3))
endef

$(eval $(call makemock, $$(FF_SIGNER_PATH), Backend, rpcbackendmocks))
$(eval $(call makemock, $$(FF_SIGNER_PATH), Subscription, rpcbackendmocks))
$(eval $(call makemock, $$(FFTM_PATH), Manager, fftmmocks))
$(eval $(call makemock, pkg/ethblocklistener, BlockListener, ethblocklistenermocks))
$(VGO) install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.13.2
mocks: ${MOCKERY}
${MOCKERY}

firefly-evmconnect: ${GOFILES}
$(VGO) build -o ./firefly-evmconnect -ldflags "-X main.buildDate=`date -u +\"%Y-%m-%dT%H:%M:%SZ\"` -X main.buildVersion=$(BUILD_VERSION)" -tags=prod -tags=prod -v ./evmconnect
Expand Down
2 changes: 1 addition & 1 deletion internal/ethereum/exec_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (c *ethConnector) QueryInvoke(ctx context.Context, req *ffcapi.QueryInvokeR
}

// Parse the optional errors JSON spec, if available
errors, err := buildErrorsABI(ctx, req.TransactionInput.Errors)
errors, err := buildErrorsABI(ctx, req.Errors)
if err != nil {
return nil, ffcapi.ErrorReasonInvalidInputs, err
}
Expand Down
2 changes: 1 addition & 1 deletion internal/ethereum/prepare_transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (c *ethConnector) TransactionPrepare(ctx context.Context, req *ffcapi.Trans
}

// Parse the optional errors JSON spec, if available
errors, err := buildErrorsABI(ctx, req.TransactionInput.Errors)
errors, err := buildErrorsABI(ctx, req.Errors)
if err != nil {
return nil, ffcapi.ErrorReasonInvalidInputs, err
}
Expand Down
Loading