diff --git a/cmd/template/dbdriver/files/service/mongo.tmpl b/cmd/template/dbdriver/files/service/mongo.tmpl index 5f1f2ab5..9b062a24 100644 --- a/cmd/template/dbdriver/files/service/mongo.tmpl +++ b/cmd/template/dbdriver/files/service/mongo.tmpl @@ -44,7 +44,7 @@ func (s *service) Health() map[string]string { err := s.db.Ping(ctx, nil) if err != nil { - log.Fatalf(fmt.Sprintf("db down: %v", err)) + log.Fatalf("db down: %v", err) } return map[string]string{ diff --git a/cmd/template/dbdriver/files/service/mysql.tmpl b/cmd/template/dbdriver/files/service/mysql.tmpl index 5ee91597..bc68a5ff 100644 --- a/cmd/template/dbdriver/files/service/mysql.tmpl +++ b/cmd/template/dbdriver/files/service/mysql.tmpl @@ -73,7 +73,7 @@ func (s *service) Health() map[string]string { if err != nil { stats["status"] = "down" stats["error"] = fmt.Sprintf("db down: %v", err) - log.Fatalf(fmt.Sprintf("db down: %v", err)) // Log the error and terminate the program + log.Fatalf("db down: %v", err) // Log the error and terminate the program return stats } diff --git a/cmd/template/dbdriver/files/service/postgres.tmpl b/cmd/template/dbdriver/files/service/postgres.tmpl index 4c2a1bf8..0fececd0 100644 --- a/cmd/template/dbdriver/files/service/postgres.tmpl +++ b/cmd/template/dbdriver/files/service/postgres.tmpl @@ -67,7 +67,7 @@ func (s *service) Health() map[string]string { if err != nil { stats["status"] = "down" stats["error"] = fmt.Sprintf("db down: %v", err) - log.Fatalf(fmt.Sprintf("db down: %v", err)) // Log the error and terminate the program + log.Fatalf("db down: %v", err) // Log the error and terminate the program return stats } diff --git a/cmd/template/dbdriver/files/service/redis.tmpl b/cmd/template/dbdriver/files/service/redis.tmpl index e28da8dd..7d0b6e40 100644 --- a/cmd/template/dbdriver/files/service/redis.tmpl +++ b/cmd/template/dbdriver/files/service/redis.tmpl @@ -32,7 +32,7 @@ var ( func New() Service { num, err := strconv.Atoi(database) if err != nil { - log.Fatalf(fmt.Sprintf("database incorrect %v", err)) + log.Fatalf("database incorrect %v", err) } fullAddress := fmt.Sprintf("%s:%s", address, port) @@ -70,7 +70,7 @@ func (s *service) Health() map[string]string { func (s *service) checkRedisHealth(ctx context.Context, stats map[string]string) map[string]string { // Ping the Redis server to check its availability. pong, err := s.db.Ping(ctx).Result() - // Note: By extracting and simplifying like this, `log.Fatalf(fmt.Sprintf("db down: %v", err))` + // Note: By extracting and simplifying like this, `log.Fatalf("db down: %v", err)` // can be changed into a standard error instead of a fatal error. if err != nil { log.Fatalf(fmt.Sprintf("db down: %v", err)) diff --git a/cmd/template/dbdriver/files/service/sqlite.tmpl b/cmd/template/dbdriver/files/service/sqlite.tmpl index e7b5f0c7..4f65e760 100644 --- a/cmd/template/dbdriver/files/service/sqlite.tmpl +++ b/cmd/template/dbdriver/files/service/sqlite.tmpl @@ -65,7 +65,7 @@ func (s *service) Health() map[string]string { if err != nil { stats["status"] = "down" stats["error"] = fmt.Sprintf("db down: %v", err) - log.Fatalf(fmt.Sprintf("db down: %v", err)) // Log the error and terminate the program + log.Fatalf("db down: %v", err) // Log the error and terminate the program return stats } diff --git a/contributors.yml b/contributors.yml index e1c6a366..d07af317 100644 --- a/contributors.yml +++ b/contributors.yml @@ -53,3 +53,4 @@ - kobamkode - mikelerch - MohammadAlhallaq +- MatthewAraujo diff --git a/docs/docs/endpoints-test/mongo.md b/docs/docs/endpoints-test/mongo.md index d49b0e65..15557f30 100644 --- a/docs/docs/endpoints-test/mongo.md +++ b/docs/docs/endpoints-test/mongo.md @@ -33,7 +33,7 @@ func (s *service) Health() map[string]string { err := s.db.Ping(ctx, nil) if err != nil { - log.Fatalf(fmt.Sprintf("db down: %v", err)) + log.Fatalf("db down: %v", err) } return map[string]string{ diff --git a/docs/docs/endpoints-test/redis.md b/docs/docs/endpoints-test/redis.md index 3d5ca28a..ee375da7 100644 --- a/docs/docs/endpoints-test/redis.md +++ b/docs/docs/endpoints-test/redis.md @@ -180,7 +180,7 @@ func (s *service) Health() map[string]string { func (s *service) checkRedisHealth(ctx context.Context, stats map[string]string) map[string]string { pong, err := s.db.Ping(ctx).Result() if err != nil { - log.Fatalf(fmt.Sprintf("db down: %v", err)) + log.Fatalf("db down: %v", err) } stats["redis_status"] = "up" diff --git a/docs/docs/endpoints-test/sql.md b/docs/docs/endpoints-test/sql.md index 6c021e77..98007c59 100644 --- a/docs/docs/endpoints-test/sql.md +++ b/docs/docs/endpoints-test/sql.md @@ -57,7 +57,7 @@ func (s *service) Health() map[string]string { if err != nil { stats["status"] = "down" stats["error"] = fmt.Sprintf("db down: %v", err) - log.Fatalf(fmt.Sprintf("db down: %v", err)) + log.Fatalf("db down: %v", err) return stats }