go hello world
// First Go program
package main
import "fmt"
// Main function
func main() {
fmt.Println("!... Hello World ...!")
}
3
3
go hello world on browser
=========================
run command
> go run main.go
------------------------
paste in address bar
> http://localhost:8080
=========================
package main
import (
"fmt"
"net/http"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello world", r.URL.Path)
})
http.ListenAndServe(":8080", nil)
}
Thank you!
3
0
5
2
package main
import "fmt"
func main() {
fmt.Println("hello world")
}
Thank you!
2
0
0
0
package main
import "fmt"
func main(){
fmt.Println("hello world")
}
Thank you!
0
0
3.9
10
package main
import fmt
func main() {
fmt.Println("hello, world!")
}
Thank you!
10
0
4
5
package mainimport "fmt"func main() { fmt.Println("Hello, World!")}
Thank you!
5
0
Are there any code examples left?
New code examples in category Other