Skip to content

Commit

Permalink
chore: fixed lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Prashansa-K committed Dec 20, 2024
1 parent 3997f12 commit 3255847
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pkg/file/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -1591,7 +1591,7 @@ func (b *stateBuilder) ingestDeGraphqlRoute(degraphqlRouteEntity FPluginEntity)
}

if utils.Empty(degraphqlRoute.ID) {
d, err := b.currentState.DegraphqlRoutes.GetByUriQuery(*degraphqlRoute.URI, *degraphqlRoute.Query)
d, err := b.currentState.DegraphqlRoutes.GetByURIQuery(*degraphqlRoute.URI, *degraphqlRoute.Query)
if errors.Is(err, state.ErrNotFound) {
degraphqlRoute.ID = uuid()
} else if err != nil {
Expand Down
1 change: 0 additions & 1 deletion pkg/file/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,6 @@ func (f *FPluginEntity) UnmarshalYAML(unmarshal func(interface{}) error) error {
default:
return fmt.Errorf("unknown entity type: %s", *f.Type)
}

}

// sortKey is used for sorting.
Expand Down
4 changes: 2 additions & 2 deletions pkg/state/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,8 @@ func buildDegraphqlRouteFromCustomEntity(kongState *KongState, entity map[string
}

if entity["service"] != nil {
serviceId := entity["service"].(map[string]interface{})["id"].(string)
ok, s, err := ensureService(kongState, serviceId)
serviceID := entity["service"].(map[string]interface{})["id"].(string)
ok, s, err := ensureService(kongState, serviceID)
if err != nil {
return DegraphqlRoute{}, err
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/state/degraphql_route.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func newDegraphqlRoutesCollection(common collection) *DegraphqlRoutesCollection
}
}

func getDegraphqlRouteByUriQuery(txn *memdb.Txn, uri, query string) (*DegraphqlRoute, error) {
func getDegraphqlRouteByURIQuery(txn *memdb.Txn, uri, query string) (*DegraphqlRoute, error) {
res, err := txn.First(pluginEntityType, "uriQuery", uri, query)
if err != nil {
return nil, err
Expand All @@ -48,9 +48,9 @@ func getDegraphqlRouteByUriQuery(txn *memdb.Txn, uri, query string) (*DegraphqlR
return &DegraphqlRoute{DegraphqlRoute: *d.DeepCopy()}, nil
}

// GetByUriQuery gets a degraphql route with
// GetByURIQuery gets a degraphql route with
// the same uri and query from the collection.
func (k *DegraphqlRoutesCollection) GetByUriQuery(uri,
func (k *DegraphqlRoutesCollection) GetByURIQuery(uri,
query string,
) (*DegraphqlRoute, error) {
if uri == "" || query == "" {
Expand All @@ -60,7 +60,7 @@ func (k *DegraphqlRoutesCollection) GetByUriQuery(uri,
txn := k.db.Txn(false)
defer txn.Abort()

return getDegraphqlRouteByUriQuery(txn, uri, query)
return getDegraphqlRouteByURIQuery(txn, uri, query)
}

// Add adds a degraphql route credential to DegraphqlRoutesCollection
Expand Down
8 changes: 4 additions & 4 deletions pkg/state/plugin_entities.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (k *pluginEntitiesCollection) Schema() *memdb.TableSchema {
}
}

func (k *pluginEntitiesCollection) getByPluginEntityId(txn *memdb.Txn, id string) (pluginEntity, error) {
func (k *pluginEntitiesCollection) getByPluginEntityID(txn *memdb.Txn, id string) (pluginEntity, error) {
if id == "" {
return nil, errIDRequired
}
Expand Down Expand Up @@ -68,7 +68,7 @@ func (k *pluginEntitiesCollection) Add(e pluginEntity) error {
txn := k.db.Txn(true)
defer txn.Abort()

_, err := k.getByPluginEntityId(txn, e.GetPluginEntityID())
_, err := k.getByPluginEntityID(txn, e.GetPluginEntityID())
if err == nil {
return fmt.Errorf("inserting plugin-entity %v - %v : %w", k.PluginEntityType, e.GetPluginEntityID(), ErrAlreadyExists)
} else if !errors.Is(err, ErrNotFound) {
Expand All @@ -91,7 +91,7 @@ func (k *pluginEntitiesCollection) Get(id string) (pluginEntity, error) {

txn := k.db.Txn(false)
defer txn.Abort()
return k.getByPluginEntityId(txn, id)
return k.getByPluginEntityID(txn, id)
}

// Update updates an existing pluginEntity
Expand All @@ -117,7 +117,7 @@ func (k *pluginEntitiesCollection) Update(e pluginEntity) error {
}

func (k *pluginEntitiesCollection) deleteCred(txn *memdb.Txn, nameOrID string) error {
e, err := k.getByPluginEntityId(txn, nameOrID)
e, err := k.getByPluginEntityID(txn, nameOrID)
if err != nil {
return err
}
Expand Down

0 comments on commit 3255847

Please sign in to comment.