Skip to content

Commit

Permalink
fixed some code quality issues
Browse files Browse the repository at this point in the history
  • Loading branch information
hifly81 committed Dec 7, 2023
1 parent cb1adc9 commit e28096a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
3 changes: 3 additions & 0 deletions pkg/producers/elastic/elasticProducer.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ func (p *ElasticProducer) Initialize(configFile string) {
var config Config
file, err := ioutil.ReadFile(configFile)
err = json.Unmarshal(file, &config)
if err != nil {
log.Fatalf("Failed to ReadFile: %s", err)
}
if err != nil {
log.Fatalf("Failed to parse configuration parameters: %s", err)
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/producers/mongoDB/mongoProducer.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ type MongoProducer struct {
func (p *MongoProducer) Initialize(configFile string) {
var config Config
file, err := ioutil.ReadFile(configFile)
if err != nil {
log.Fatalf("Failed to ReadFile: %s", err)
}
err = json.Unmarshal(file, &config)
if err != nil {
log.Fatalf("Failed to parse configuration parameters: %s", err)
Expand Down
18 changes: 9 additions & 9 deletions pkg/producers/mongoDB/mongoProducer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import (
)

func TestProducer_Initialize(t *testing.T) {
configFile := "config.json.example"

producer, err := storage.ProducerFactory("mongo")
if err != nil {
t.Fatalf("Error reading configuration file: %v", err)
}
err = producer.Initialize(configFile)
if err != nil {
t.Fatalf("Error reading configuration file: %v", err)
configFile := "config.json.example"

producer, err := storage.ProducerFactory("mongo")
if err != nil {
t.Fatalf("Error reading configuration file: %v", err)
}
err = producer.Initialize(configFile)
if err != nil {
t.Fatalf("Error reading configuration file: %v", err)
}
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/producers/s3/s3Producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ type S3Producer struct {
func (p *S3Producer) Initialize(configFile string) {
var config Config
file, err := ioutil.ReadFile(configFile)
if err != nil {
log.Fatalf("Failed to ReadFile: %s", err)
}
err = json.Unmarshal(file, &config)
if err != nil {
log.Fatalf("Failed to parse configuration parameters: %s", err)
Expand Down

0 comments on commit e28096a

Please sign in to comment.