hello world web app




    Go Code Snippets

    The code declares a package named main and imports the fmt and net/http packages. Next, the function greet is created and it takes two arguments, w and r. The first argument, w, is used to write to and the second argument, r, is used to write to. The function prints "Hello World! 9:21" to the console.

    Shortcut: helloweb

    package main
    import (
    func greet(w http.ResponseWriter, r *http.Request) {
      fmt.Fprintf(w, "Hello World! %s", time.Now())
    func main() {
      http.HandleFunc("/", greet)
      http.ListenAndServe(":8080", nil)
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    • Security
    • Privacy Policy
    • Code Privacy
    • Terms of Service
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.