Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: lint #157

Merged
merged 1 commit into from
Sep 24, 2024
Merged
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
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ linters:
- dogsled
- errcheck
- errorlint
- exportloopref
- copyloopvar
- gci
- goconst
- gocritic
Expand Down
19 changes: 15 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,26 @@ test-rosetta-ci:
### Linting ###
###############################################################################

golangci_lint_cmd=golangci-lint
golangci_version=v1.51.2
golangci_version=v1.61.0
golangci_installed_version=$(shell golangci-lint version --format short 2>/dev/null)

#? lint-install: Install golangci-lint
lint-install:
ifneq ($(golangci_installed_version),$(golangci_version))
@echo "--> Installing golangci-lint $(golangci_version)"
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version)
endif

#? lint: Run golangci-lint
lint:
@echo "--> Running linter"
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version)
$(MAKE) lint-install
@./scripts/go-lint-all.bash --timeout=15m

#? lint: Run golangci-lint and fix
lint-fix:
@echo "--> Running linter"
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version)
$(MAKE) lint-install
@./scripts/go-lint-all.bash --fix

.PHONY: all build rosetta test lint lint-fix
8 changes: 4 additions & 4 deletions plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,24 @@ func LoadPlugin(ir codectypes.InterfaceRegistry, pluginLocation string) (err err
pluginPathMain := fmt.Sprintf("./plugins/%s/main.so", pluginLocation)

if _, err := os.Stat(pluginPathMain); os.IsExist(err) {
return fmt.Errorf(fmt.Sprintf("Plugin file '%s' does not exist %s", pluginPathMain, err.Error()))
return fmt.Errorf("plugin file '%s' does not exist %s", pluginPathMain, err.Error())
}

// load module
plug, err := plugin.Open(pluginPathMain)
if err != nil {
return fmt.Errorf(fmt.Sprintf("There was an error while opening plugin on %s - %s", pluginPathMain, err.Error()))
return fmt.Errorf("there was an error while opening plugin on %s - %s", pluginPathMain, err.Error())
}

initZone, err := plug.Lookup("InitZone")
if err != nil {
return fmt.Errorf(fmt.Sprintf("There was an error while initializing the zone %s", err.Error()))
return fmt.Errorf("there was an error while initializing the zone %s", err.Error())
}
initZone.(func())()

registerInterfaces, err := plug.Lookup("RegisterInterfaces")
if err != nil {
return fmt.Errorf(fmt.Sprintf("There was an error while registering interfaces %s", err.Error()))
return fmt.Errorf("there was an error while registering interfaces %s", err.Error())
}

registerInterfaces.(func(codectypes.InterfaceRegistry))(ir)
Expand Down
Loading