Resolved linting issues
This commit is contained in:
@@ -109,7 +109,9 @@ func run(ctx context.Context, configPath string) error {
|
|||||||
return fmt.Errorf("failed to initialize config: %w", err)
|
return fmt.Errorf("failed to initialize config: %w", err)
|
||||||
}
|
}
|
||||||
log.Infof(ctx, "Initializing logger with config: %+v", cfg.Log)
|
log.Infof(ctx, "Initializing logger with config: %+v", cfg.Log)
|
||||||
log.InitLogger(cfg.Log)
|
if err := log.InitLogger(cfg.Log); err != nil {
|
||||||
|
return fmt.Errorf("failed to initialize logger: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize plugin manager.
|
// Initialize plugin manager.
|
||||||
log.Infof(ctx, "Initializing plugin manager")
|
log.Infof(ctx, "Initializing plugin manager")
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/beckn/beckn-onix/pkg/log"
|
||||||
"github.com/beckn/beckn-onix/pkg/model"
|
"github.com/beckn/beckn-onix/pkg/model"
|
||||||
"github.com/beckn/beckn-onix/pkg/plugin"
|
"github.com/beckn/beckn-onix/pkg/plugin"
|
||||||
"github.com/beckn/beckn-onix/pkg/plugin/definition"
|
"github.com/beckn/beckn-onix/pkg/plugin/definition"
|
||||||
@@ -112,6 +113,8 @@ func (s *Step) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
|||||||
func DummyHandler(ctx context.Context, mgr PluginManager, cfg *Config) (http.Handler, error) {
|
func DummyHandler(ctx context.Context, mgr PluginManager, cfg *Config) (http.Handler, error) {
|
||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
w.Write([]byte("Dummy Handler Response"))
|
if _, err := w.Write([]byte("Dummy Handler Response")); err != nil {
|
||||||
|
log.Error(context.Background(), err, "failed to write nack response")
|
||||||
|
}
|
||||||
}), nil
|
}), nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -164,18 +164,3 @@ func (b *broadcastStep) Run(ctx *model.StepContext) error {
|
|||||||
// TODO: Implement broadcast logic if needed
|
// TODO: Implement broadcast logic if needed
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// subscribeStep is a stub for subscription handling.
|
|
||||||
type subscribeStep struct{}
|
|
||||||
|
|
||||||
// Run is a placeholder for future implementation.
|
|
||||||
func (s *subscribeStep) Run(ctx *model.StepContext) error {
|
|
||||||
// TODO: Implement subscription logic if needed
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// tracingStep wraps a Step with OpenTelemetry tracing
|
|
||||||
type tracingStep struct {
|
|
||||||
step definition.Step
|
|
||||||
name string
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/beckn/beckn-onix/pkg/log"
|
||||||
"github.com/beckn/beckn-onix/pkg/model"
|
"github.com/beckn/beckn-onix/pkg/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -48,7 +49,10 @@ func SendAck(w http.ResponseWriter) {
|
|||||||
// Set headers and write response
|
// Set headers and write response
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
w.Write(data)
|
if _, err := w.Write(data); err != nil {
|
||||||
|
log.Error(context.Background(), err, "failed to write ack response")
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// nack sends a negative acknowledgment (NACK) response with an error message.
|
// nack sends a negative acknowledgment (NACK) response with an error message.
|
||||||
@@ -73,7 +77,10 @@ func nack(w http.ResponseWriter, err *model.Error, status int) {
|
|||||||
// Set headers and write response
|
// Set headers and write response
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
w.WriteHeader(status) // Assuming NACK means a bad request
|
w.WriteHeader(status) // Assuming NACK means a bad request
|
||||||
w.Write(data)
|
if _, err := w.Write(data); err != nil {
|
||||||
|
log.Error(context.Background(), err, "failed to write nack response")
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func internalServerError(ctx context.Context) *model.Error {
|
func internalServerError(ctx context.Context) *model.Error {
|
||||||
|
|||||||
Reference in New Issue
Block a user