package main import ( "fmt" "net/http" ) func helloWorldHandler(w http.ResponseWriter, r *http.Request) { // Set the response content type to plain text w.Header().Set("Content-Type", "text/plain") // Write "Hello, World!" to the response fmt.Fprintf(w, "Hello, World!") } func main() { // Register a handler function for the root path ("/") http.HandleFunc("/", helloWorldHandler) // Start the HTTP server on port 8080 fmt.Println("Server is listening on port 8080...") if err := http.ListenAndServe(":8080", nil); err != nil { fmt.Println("Error:", err) } }