Hello world
This commit is contained in:
		
							
								
								
									
										18
									
								
								cmd/hello-world/main.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								cmd/hello-world/main.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,18 @@
 | 
			
		||||
package main
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"net/http"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func main() {
 | 
			
		||||
	http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
 | 
			
		||||
		n, err := fmt.Fprintf(w, "Hello world")
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			fmt.Println(err)
 | 
			
		||||
		}
 | 
			
		||||
		fmt.Printf("Number of bytes written: %d\n", n)
 | 
			
		||||
	})
 | 
			
		||||
 | 
			
		||||
	_ = http.ListenAndServe(":8080", nil)
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user