Why in the Visual Studio Code terminal with the command "go run main.go" the server starts, but then no other command can be entered into the terminal?

Why in the Visual Studio Code terminal with the command “go run main.go” the server starts, but then no other command can be entered into the terminal (to do this, either restart the terminal or use CTRL+C to complete execution)? Is it because of incorrect code or because of the Visual Studio Code terminal? Do I need to fix this problem? Brandmauer Windows is also enabled after each run of go run main.go.

 package main

import (

    "fmt"

    "net/http"

)

func home_page(page http.ResponseWriter, r *http.Request) {

    fmt.Fprintf(page, "Go is super easy!!!")

}

func handleRequest() {

    http.HandleFunc("/", home_page)

    http.ListenAndServe(":8080", nil)

   

}

func main() {

    handleRequest()

}

That’s how it’s supposed to be. The server starts until killed.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.