From 3506aba60d6448f1e702d377a763261e4910bb93 Mon Sep 17 00:00:00 2001 From: bilaldeveloper4312 Date: Mon, 3 Aug 2026 01:22:25 +0400 Subject: [PATCH] refactor: extract greeting logic into a testable greet function added some extra checks to prevent crashes --- main.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 49f4dee..56670fc 100644 --- a/main.go +++ b/main.go @@ -2,6 +2,11 @@ package main import "fmt" +// Greet returns a formatted greeting string. +func Greet(name string) string { + return fmt.Sprintf("Hello, %s!", name) +} + func main() { - fmt.Println("Hello, Bounty Hunter!") + fmt.Println(Greet("Bounty Hunter")) }