package main
import (
"fmt"
"os"
"time"
)
func main() {
fmt.Println("=== Go Universal Tool ===")
showTime()
showEnv()
logMessage("Execution completed successfully π")
}
func showTime() {
fmt.Println("β° Current time:", time.Now().Format(time.RFC1123))
}
func showEnv() {
fmt.Println("π§ Current directory:", getCwd())
fmt.Println("π» User:", os.Getenv("USERNAME"))
}
func logMessage(msg string) {
file, err := os.Create("log.txt")
if err != nil {
fmt.Println("Error:", err)
return
}
defer file.Close()
file.WriteString(time.Now().String() + " - " + msg + "\n")
fmt.Println("π Log saved to log.txt")
}
func getCwd() string {
dir, _ := os.Getwd()
return dir
}