Skip to content

Commit

Permalink
Fix linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mostafa committed Oct 3, 2024
1 parent d7cf221 commit df4b0a7
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cmd/cmd_helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ func mustPullPlugin() (string, error) {
func runCommand(dir string, command string, args ...string) error {
cmd := exec.Command(command, args...)
cmd.Dir = dir
return cmd.Run()
return cmd.Run() //nolint:wrapcheck
}
2 changes: 1 addition & 1 deletion cmd/plugin_scaffold_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func Test_pluginScaffoldCmd(t *testing.T) {

err = runCommand(pluginDir, "go", "mod", "tidy")
require.NoError(t, err, "running go mod tidy should not return an error")
runCommand(pluginDir, "make", "build-dev")
err = runCommand(pluginDir, "make", "build-dev")
require.NoError(t, err, "running make build-dev should not return an error")

pluginBinaryPath := filepath.Join(pluginDir, pluginName)
Expand Down
2 changes: 1 addition & 1 deletion config/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const (
// Plugin constants.
DefaultMinPort = 50000
DefaultMaxPort = 60000
PluginPriorityStart = 1000
PluginPriorityStart = uint(1000)
DefaultPluginAddress = "http://plugins/metrics"
DefaultMetricsMergerPeriod = 5 * time.Second
DefaultPluginHealthCheckPeriod = 5 * time.Second
Expand Down
2 changes: 1 addition & 1 deletion network/roundrobin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func TestRoundRobin_ConcurrentAccess(t *testing.T) {

waitGroup.Wait()
nextIndex := roundRobin.next.Load()
if nextIndex != uint32(numGoroutines) { //nolint:gosec
if nextIndex != uint32(numGoroutines) {
t.Errorf("expected next index to be %d, got %d", numGoroutines, nextIndex)
}
}
Expand Down
2 changes: 1 addition & 1 deletion network/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ func (s *Server) OnClose(conn *ConnWrapper, err error) Action {

// Shutdown the server if there are no more connections and the server is stopped.
// This is used to shut down the server gracefully.
if uint64(s.CountConnections()) == 0 && !s.IsRunning() {
if s.CountConnections() == 0 && !s.IsRunning() {
span.AddEvent("Shutting down the server")
return Shutdown
}
Expand Down
3 changes: 2 additions & 1 deletion plugin/plugin_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,8 @@ func (reg *Registry) LoadPlugins(
// in the config file. Built-in plugins are loaded first, followed by user-defined
// plugins. Built-in plugins have a priority of 0 to 999, and user-defined plugins
// have a priority of 1000 or greater.
plugin.Priority = sdkPlugin.Priority(config.PluginPriorityStart + uint(priority))
plugin.Priority = sdkPlugin.Priority(
config.PluginPriorityStart + uint(priority)) //nolint:gosec

Check failure on line 481 in plugin/plugin_registry.go

View workflow job for this annotation

GitHub Actions / Test GatewayD

directive `//nolint:gosec` is unused for linter "gosec" (nolintlint)

logAdapter := logging.NewHcLogAdapter(&reg.Logger, pCfg.Name)

Expand Down
2 changes: 1 addition & 1 deletion plugin/plugin_registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func BenchmarkHookRun(b *testing.B) {
args.Fields["test"] = v1.NewStringValue("test1")
return args, nil
}
for priority := range 1000 {
for priority := range uint(1000) {
reg.AddHook(v1.HookName_HOOK_NAME_ON_NEW_LOGGER,
sdkPlugin.Priority(priority),
hookFunction,
Expand Down

0 comments on commit df4b0a7

Please sign in to comment.