Skip to content

Commit

Permalink
fix: lint (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianToledano authored Sep 24, 2024
1 parent bc4233d commit 23cdb34
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
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

0 comments on commit 23cdb34

Please sign in to comment.