Move to gopath dir and introduce new package
This commit is contained in:
		@@ -0,0 +1,8 @@
 | 
				
			|||||||
 | 
					package hello
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import ()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Hello writes a welcome string
 | 
				
			||||||
 | 
					func Hello() string {
 | 
				
			||||||
 | 
						return "Hello golang!"
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -7,17 +7,18 @@ package main
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
 | 
						"github.com/microsoft/vscode-remote-try-go/hello"
 | 
				
			||||||
	"io"
 | 
						"io"
 | 
				
			||||||
	"net/http"
 | 
						"net/http"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func hello(w http.ResponseWriter, r *http.Request) {
 | 
					func helloOld(w http.ResponseWriter, r *http.Request) {
 | 
				
			||||||
	io.WriteString(w, "Hello remote world!")
 | 
						io.WriteString(w, hello.Hello())
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func main() {
 | 
					func main() {
 | 
				
			||||||
	portNumber := "9000"
 | 
						portNumber := "9000"
 | 
				
			||||||
	http.HandleFunc("/", hello)
 | 
						http.HandleFunc("/", helloOld)
 | 
				
			||||||
	fmt.Println("Server listening on port ", portNumber)
 | 
						fmt.Println("Server listening on port ", portNumber)
 | 
				
			||||||
	http.ListenAndServe(":"+portNumber, nil)
 | 
						http.ListenAndServe(":"+portNumber, nil)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user