Skip to content

Instantly share code, notes, and snippets.

@seb-schulz
Last active April 26, 2024 09:49
Show Gist options
  • Save seb-schulz/b350619e452479fa6d09f6979e894ca7 to your computer and use it in GitHub Desktop.
Save seb-schulz/b350619e452479fa6d09f6979e894ca7 to your computer and use it in GitHub Desktop.
How to Quickly Get a Running Development Environment
{
"name": "hello-devcontainers",
"image": "mcr.microsoft.com/devcontainers/go:1.22",
"features": {
"ghcr.io/devcontainers-contrib/features/apt-get-packages:1": {
"packages": "inotify-tools,bash-completion"
}
},
"customizations": {
"vscode": {
"settings": {},
"extensions": [
"golang.go"
]
}
},
"runArgs": [
"--userns=keep-id"
],
"containerUser": "vscode"
}
module hello-devcontainers
go 1.22.1
package main
import (
"fmt"
"net/http"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello, World!\n")
})
if err := http.ListenAndServe(":9080", nil); err != nil {
fmt.Println("Error starting server:", err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment