simple hello world
Makefile | |
.git | |
.gitignore |
###Go### | |
# Compiled Object files, Static and Dynamic libs (Shared Objects) | |
*.o | |
*.a | |
*.so | |
*.swo | |
*.swp | |
# Folders | |
_obj | |
_test | |
# Architecture specific extensions/prefixes | |
*.[568vq] | |
[568vq].out | |
*.cgo1.go | |
*.cgo2.c | |
_cgo_defun.c | |
_cgo_gotypes.go | |
_cgo_export.* | |
_testmain.go | |
*.exe | |
*.test | |
###OSX### | |
.DS_Store | |
.AppleDouble | |
.LSOverride | |
# Icon must ends with two \r. | |
Icon | |
# Thumbnails | |
._* | |
# Files that might appear on external disk | |
.Spotlight-V100 | |
.Trashes | |
hello |
FROM scratch | |
COPY hello /hello | |
CMD ["/hello"] |
package main | |
import ( | |
"fmt" | |
"log" | |
"net/http" | |
"os" | |
) | |
const defaultPort = "8080" | |
func handler(w http.ResponseWriter, r *http.Request) { | |
fmt.Fprintf(w, "Hello DCOS!") | |
} | |
func main() { | |
port := os.Getenv("PORT0") | |
if port == "" { | |
port = defaultPort | |
} | |
http.HandleFunc("/", handler) | |
log.Println("Starting server on port: ", port) | |
http.ListenAndServe(":"+port, nil) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment