### Start Multi Stage Build Example Source: https://github.com/loft-sh/devpod/blob/main/examples/build-multi-stage/README.md Use this command to start the multi-stage build example project. ```bash devpod up ./examples/build-multi-stage ``` -------------------------------- ### Install clipboard Go Package Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/atotto/clipboard/README.md Use 'go get' to install the clipboard package. This is the initial setup step for using the library. ```bash go get github.com/atotto/clipboard ``` -------------------------------- ### Install go-ps Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/mitchellh/go-ps/README.md Install the go-ps library using the standard go get command. ```bash $ go get github.com/mitchellh/go-ps ... ``` -------------------------------- ### Install go-autorest/autorest/adal Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/Azure/go-autorest/autorest/adal/README.md Install the package using go get. ```bash go get -u github.com/Azure/go-autorest/autorest/adal ``` -------------------------------- ### Install Ginkgo Source: https://github.com/loft-sh/devpod/blob/main/e2e/README.md Installs the Ginkgo testing framework using go get. Ensure Go is installed and configured. ```bash go get github.com/onsi/ginkgo/ginkgo ``` -------------------------------- ### Install Ethtool Go Package Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/safchain/ethtool/README.md Use 'go get' to install the ethtool package. ```shell go get github.com/safchain/ethtool ``` -------------------------------- ### Real Daemon Example with Echo Service Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/takama/daemon/README.md A comprehensive example of a daemon implementing an echo service. It handles installation, removal, start, stop, and status commands, and listens for TCP connections. ```go // Example of a daemon with echo service package main import ( "fmt" "log" "net" "os" "os/signal" "syscall" "github.com/takama/daemon" ) const ( // name of the service name = "myservice" description = "My Echo Service" // port which daemon should be listen port = ":9977" ) // dependencies that are NOT required by the service, but might be used var dependencies = []string{"dummy.service"} var stdlog, errlog *log.Logger // Service has embedded daemon type Service struct { daemon.Daemon } // Manage by daemon commands or run the daemon func (service *Service) Manage() (string, error) { usage := "Usage: myservice install | remove | start | stop | status" // if received any kind of command, do it if len(os.Args) > 1 { command := os.Args[1] switch command { case "install": return service.Install() case "remove": return service.Remove() case "start": return service.Start() case "stop": return service.Stop() case "status": return service.Status() default: return usage, nil } } // Do something, call your goroutines, etc // Set up channel on which to send signal notifications. // We must use a buffered channel or risk missing the signal // if we're not ready to receive when the signal is sent. interrupt := make(chan os.Signal, 1) signal.Notify(interrupt, os.Interrupt, os.Kill, syscall.SIGTERM) // Set up listener for defined host and port listener, err := net.Listen("tcp", port) if err != nil { return "Possibly was a problem with the port binding", err } // set up channel on which to send accepted connections listen := make(chan net.Conn, 100) go acceptConnection(listener, listen) // loop work cycle with accept connections or interrupt // by system signal for { select { case conn := <-listen: go handleClient(conn) case killSignal := <-interrupt: stdlog.Println("Got signal:", killSignal) stdlog.Println("Stoping listening on ", listener.Addr()) listener.Close() if killSignal == os.Interrupt { return "Daemon was interruped by system signal", nil } return "Daemon was killed", nil } } // never happen, but need to complete code return usage, nil } // Accept a client connection and collect it in a channel func acceptConnection(listener net.Listener, listen chan<- net.Conn) { for { conn, err := listener.Accept() if err != nil { continue } listen <- conn } } func handleClient(client net.Conn) { for { buf := make([]byte, 4096) numbytes, err := client.Read(buf) if numbytes == 0 || err != nil { return } client.Write(buf[:numbytes]) } } func init() { stdlog = log.New(os.Stdout, "", log.Ldate|log.Ltime) errlog = log.New(os.Stderr, "", log.Ldate|log.Ltime) } func main() { srv, err := daemon.New(name, description, daemon.SystemDaemon, dependencies...) if err != nil { errlog.Println("Error: ", err) os.Exit(1) } service := &Service{srv} status, err := service.Manage() if err != nil { errlog.Println(status, "\nError: ", err) os.Exit(1) } fmt.Println(status) } ``` -------------------------------- ### Install gziphandler Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/NYTimes/gziphandler/README.md Use go get to install the gziphandler package. ```bash go get -u github.com/NYTimes/gziphandler ``` -------------------------------- ### Basic SSH Server Example Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/loft-sh/ssh/README.md This example demonstrates how to set up a basic SSH server that responds with 'Hello world' to any connection. It uses ssh.Handle to define the session handler and ssh.ListenAndServe to start the server on a specified port. ```go package main import ( "github.com/gliderlabs/ssh" "io" "log" ) func main() { ssh.Handle(func(s ssh.Session) { io.WriteString(s, "Hello world\n") }) log.Fatal(ssh.ListenAndServe(":2222", nil)) } ``` -------------------------------- ### Install miekg/dns Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/miekg/dns/README.md Use the go get command to download and install the library. Building is done with the standard go build command. ```bash go get github.com/miekg/dns go build github.com/miekg/dns ``` -------------------------------- ### Install websocket Go Package Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/coder/websocket/README.md Use 'go get' to install the websocket library. ```sh go get github.com/coder/websocket ``` -------------------------------- ### Install and Import YAML Library Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/ghodss/yaml/README.md Install the library using go get and import it in your Go projects. ```bash go get github.com/ghodss/yaml ``` ```go import "github.com/ghodss/yaml" ``` -------------------------------- ### Install go-isatty Package Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/mattn/go-isatty/README.md Install the go-isatty package using the go get command. ```bash go get github.com/mattn/go-isatty ``` -------------------------------- ### Install etcd/clientv3 Source: https://github.com/loft-sh/devpod/blob/main/vendor/go.etcd.io/etcd/client/v3/README.md Install the etcd client library using go get. Note the specific version for pre-release versions. ```bash go get go.etcd.io/etcd/client/v3 ``` ```bash go get go.etcd.io/etcd/client/v3@v3.5.0-pre ``` -------------------------------- ### Install GoDotEnv Library Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/joho/godotenv/README.md Use 'go get' to install the godotenv library for use in your Go projects. ```shell go get github.com/joho/godotenv ``` -------------------------------- ### Basic HttpRouter Usage in Go Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/julienschmidt/httprouter/README.md Demonstrates the basic setup and usage of HttpRouter, including defining routes for the root path and a path with a parameter, and starting the HTTP server. Ensure necessary packages are imported. ```go package main import ( "fmt" "net/http" "log" "github.com/julienschmidt/httprouter" ) func Index(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { fmt.Fprint(w, "Welcome!\n") } func Hello(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { fmt.Fprintf(w, "hello, %s!\n", ps.ByName("name")) } func main() { router := httprouter.New() router.GET("/", Index) router.GET("/hello/:name", Hello) log.Fatal(http.ListenAndServe(":8080", router)) } ``` -------------------------------- ### Install gojsonschema Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/xeipuuv/gojsonschema/README.md Use go get to install the gojsonschema library. ```bash go get github.com/xeipuuv/gojsonschema ``` -------------------------------- ### Install doublestar Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/bmatcuk/doublestar/v4/README.md Install the doublestar package using go get. ```bash go get github.com/bmatcuk/doublestar/v4 ``` -------------------------------- ### Install Go semver Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/blang/semver/README.md Use 'go get' to install the library. It is recommended to vendor dependencies or pin to a specific version tag. ```bash go get github.com/blang/semver ``` -------------------------------- ### Install machineid Library Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/denisbrodbeck/machineid/README.md Use 'go get' to download and install the machineid library. ```bash go get github.com/denisbrodbeck/machineid ``` -------------------------------- ### Install go-gitconfig Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/tcnksm/go-gitconfig/README.md Installs the go-gitconfig package using the go get command. ```bash $ go get -d github.com/tcnksm/go-gitconfig ``` -------------------------------- ### Install multierr Source: https://github.com/loft-sh/devpod/blob/main/vendor/go.uber.org/multierr/README.md Use 'go get' to install the latest version of the multierr package. ```bash go get -u go.uber.org/multierr@latest ``` -------------------------------- ### Install Cobra Library Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/spf13/cobra/README.md Use 'go get' to install the latest version of the Cobra library. ```bash go get -u github.com/spf13/cobra@latest ``` -------------------------------- ### Install go-colorful Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/lucasb-eyer/go-colorful/README.md Install the go-colorful library using the go get command. The package can then be imported into your Go projects. ```bash go get github.com/lucasb-eyer/go-colorful ``` -------------------------------- ### Install and Import Kubernetes YAML Library Source: https://github.com/loft-sh/devpod/blob/main/vendor/sigs.k8s.io/yaml/README.md Install the library using go get and import it into your Go projects. ```bash $ go get sigs.k8s.io/yaml ``` ```go import "sigs.k8s.io/yaml" ``` -------------------------------- ### Install uniseg Package Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/rivo/uniseg/README.md Use 'go get' to install the uniseg package for your Go project. ```bash go get github.com/rivo/uniseg ``` -------------------------------- ### Install lz4/v4 Package Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/pierrec/lz4/v4/README.md Use 'go get' to install the lz4/v4 package for use in your Go projects. ```go go get github.com/pierrec/lz4/v4 ``` -------------------------------- ### Install go-colorable Package Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/mattn/go-colorable/README.md Use the go get command to install the go-colorable package. This command fetches and installs the package and its dependencies into your Go workspace. ```bash go get github.com/mattn/go-colorable ``` -------------------------------- ### Go Installation for utfbom Package Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/dimchansky/utfbom/README.md Install the utfbom package using the go get command. This command fetches and installs the package, making it available for use in your Go projects. ```go go get -u github.com/dimchansky/utfbom ``` -------------------------------- ### Define a RESTful WebService Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/emicklei/go-restful/v3/README.md Example of setting up a WebService with a path, supported content types, and defining a GET route for retrieving a user. The route specifies documentation, a path parameter, and the expected response type. ```go ws := new(restful.WebService) ws. Path("/users"). Consumes(restful.MIME_XML, restful.MIME_JSON). Produces(restful.MIME_JSON, restful.MIME_XML) ws.Route(ws.GET("/{user-id}").To(u.findUser). Doc("get a user"). Param(ws.PathParameter("user-id", "identifier of the user").DataType("string")), Writes(User{})) ... func (u UserResource) findUser(request *restful.Request, response *restful.Response) { id := request.PathParameter("user-id") ... } ``` -------------------------------- ### Install hashstructure v2 Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/mitchellh/hashstructure/v2/README.md Use 'go get' to install the v2 release of the hashstructure library. It is recommended over v1 due to fixes for hash collision issues. ```bash go get github.com/mitchellh/hashstructure/v2 ``` -------------------------------- ### Install govalidator Package Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/asaskevich/govalidator/README.md Use `go get` to install the latest version or a specific release of the govalidator package. ```bash go get github.com/asaskevich/govalidator or you can get specified release of the package with `gopkg.in`: go get gopkg.in/asaskevich/govalidator.v10 ``` -------------------------------- ### Install gorilla/csrf Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/gorilla/csrf/README.md Install the gorilla/csrf library using the go get command. Ensure your Go toolchain is properly configured. ```sh go get github.com/gorilla/csrf ``` -------------------------------- ### Installing go-autorest Libraries Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/Azure/go-autorest/README.md Provides the necessary go get commands to install the core go-autorest libraries, including autorest, autorest/azure, and autorest/to, which are essential for interacting with Azure services and handling common patterns like pointer conversions. ```bash go get github.com/Azure/go-autorest/autorest go get github.com/Azure/go-autorest/autorest/azure go get github.com/Azure/go-autorest/autorest/date go get github.com/Azure/go-autorest/autorest/to ``` -------------------------------- ### Agent-Side Binary Configuration and Usage Source: https://github.com/loft-sh/devpod/blob/main/docs/pages/developing-providers/binaries.mdx This example illustrates how to define binaries that DevPod should install on the agent side using `agent.binaries`. It also shows how to use these binaries within the `agent.exec` section, for instance, to shut down a virtual machine. ```yaml agent: path: ${AGENT_PATH} binaries: GCLOUD_PROVIDER: - os: linux arch: amd64 path: https://github.com/loft-sh/devpod-provider-gcloud/releases/download/v0.0.1-alpha.10/devpod-provider-gcloud-linux-amd64 checksum: 38f92457507563ee56ea40a2ec40196d12ac2bbd50a924d76f55827e96e5f831 - os: linux arch: arm64 path: https://github.com/loft-sh/devpod-provider-gcloud/releases/download/v0.0.1-alpha.10/devpod-provider-gcloud-linux-arm64 checksum: 48e8dfa20962f1c3eb1e3da17d57842a0e26155df2b94377bcdf5b8070d7b17e exec: shutdown: |- ${GCLOUD_PROVIDER} stop --raw ``` -------------------------------- ### Install Daemon Service Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/takama/daemon/README.md Demonstrates the simplest way to install a service as a daemon. Ensure the service name and description are correctly provided. ```go package main import ( "fmt" "log" "github.com/takama/daemon" ) func main() { service, err := daemon.New("name", "description", daemon.SystemDaemon) if err != nil { log.Fatal("Error: ", err) } status, err := service.Install() if err != nil { log.Fatal(status, "\nError: ", err) } fmt.Println(status) } ``` -------------------------------- ### Go Get -u Installation Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/prometheus-community/pro-bing/README.md Installs the pro-bing library using the go get command. This is the standard method for adding Go packages to your project. ```bash go get -u github.com/prometheus-community/pro-bing ``` -------------------------------- ### Deploy Sample Application Source: https://github.com/loft-sh/devpod/blob/main/examples/ztunnel/README.md Create a namespace for the ambient mode test, label it appropriately, and deploy the sleep and helloworld applications. ```bash kubectl create ns my-ambient kubectl label namespace my-ambient istio.io/dataplane-mode=ambient --overwrite kubectl apply -f sleep.yaml -n my-ambient kubectl apply -f helloworld.yaml -n my-ambient ``` -------------------------------- ### SpdyStream Client Example Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/moby/spdystream/README.md Demonstrates how to connect to a mirroring server and create/manage streams. Requires a running spdy server on localhost:8080. ```go package main import ( "fmt" "github.com/moby/spdystream" "net" "net/http" ) func main() { conn, err := net.Dial("tcp", "localhost:8080") if err != nil { panic(err) } spdyConn, err := spdystream.NewConnection(conn, false) if err != nil { panic(err) } go spdyConn.Serve(spdystream.NoOpStreamHandler) stream, err := spdyConn.CreateStream(http.Header{}, nil, false) if err != nil { panic(err) } stream.Wait() fmt.Fprint(stream, "Writing to stream") buf := make([]byte, 25) stream.Read(buf) fmt.Println(string(buf)) stream.Close() } ``` -------------------------------- ### Install Strip ANSI Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/acarl005/stripansi/README.md Use go get to install the package. ```sh $ go get -u github.com/acarl005/stripansi ``` -------------------------------- ### Installing the Bitset Library Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/bits-and-blooms/bitset/README.md Standard Go command to fetch and install the bitset library. ```bash go get github.com/bits-and-blooms/bitset ``` -------------------------------- ### Start Simple Devcontainer with Devpod Source: https://github.com/loft-sh/devpod/blob/main/examples/simple/README.md Use this command to start the devcontainer configuration located in the ./examples/simple directory. ```bash devpod up ./examples/simple ``` -------------------------------- ### Install termenv Package Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/muesli/termenv/README.md Use go get to install the termenv package. ```bash go get github.com/muesli/termenv ``` -------------------------------- ### Install go-httpstat Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/tcnksm/go-httpstat/README.md Install the go-httpstat package using the go get command. ```bash go get github.com/tcnksm/go-httpstat ``` -------------------------------- ### Install and Test Go OLE Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/go-ole/go-ole/README.md Instructions for installing the go-ole library and running tests. This includes fetching the package, navigating to the directory, and executing tests. ```bash go get github.com/go-ole/go-ole cd /path/to/go-ole/ go test ``` ```bash cd /path/to/go-ole/example/excel go run excel.go ``` -------------------------------- ### Install go-localereader Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/mattn/go-localereader/README.md Install the go-localereader package using the go get command. ```bash $ go get github.com/mattn/go-localereader ``` -------------------------------- ### Install Pty Package Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/creack/pty/README.md Install the pty package using go get. ```sh go get github.com/creack/pty ``` -------------------------------- ### Install aec Package Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/morikuni/aec/README.md Use go get to install the aec package. This command fetches and installs the package and its dependencies. ```bash go get github.com/morikuni/aec ``` -------------------------------- ### Start Local Development Server Source: https://github.com/loft-sh/devpod/blob/main/docs/README.md Starts a local development server for live previewing changes. Changes are reflected without a server restart. ```bash yarn start ``` -------------------------------- ### HTTP Probing Example Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/prometheus-community/pro-bing/README.md Demonstrates how to set up and run an HTTP probe with custom response handling and graceful shutdown on interrupt. ```go httpCaller := probing.NewHttpCaller("https://www.google.com", probing.WithHTTPCallerCallFrequency(time.Second), probing.WithHTTPCallerOnResp(func(suite *probing.TraceSuite, info *probing.HTTPCallInfo) { fmt.Printf("got resp, status code: %d, latency: %s\n", info.StatusCode, suite.GetGeneralEnd().Sub(suite.GetGeneralStart()), ) }), ) // Listen for Ctrl-C. c := make(chan os.Signal, 1) signal.Notify(c, os.Interrupt) go func() { <-c httpCaller.Stop() }() httpCaller.Run() ``` -------------------------------- ### Coexist with glog Example Source: https://github.com/loft-sh/devpod/blob/main/vendor/k8s.io/klog/v2/README.md Demonstrates how to initialize and synchronize flags between klog and glog. It also shows how to set stderr as the combined output. ```go package main import ( "flag" "os" "k8s.io/klog/v2" ) func main() { // Initialize klog flags klog.InitFlags(nil) // Set stderr as combined output flag.Set("alsologtostderr", "true") // Parse flags flag.Parse() // Ensure klog is flushed before exiting defer klog.Flush() klog.Info("This is an informational message.") klog.Warning("This is a warning message.") klog.Error("This is an error message.") // Example of logging to stderr directly os.Stderr.Write([]byte("This is a direct stderr message.\n")) } ``` -------------------------------- ### Install json-iterator/go Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/json-iterator/go/README.md Use the go get command to install the json-iterator/go library into your project. ```bash go get github.com/json-iterator/go ``` -------------------------------- ### Install and Run Local Go Doc Site Source: https://github.com/loft-sh/devpod/blob/main/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md Installs and runs a local Go Doc site for previewing package documentation. Ensure you have the latest version of pkgsite. ```sh go install golang.org/x/pkgsite/cmd/pkgsite@latest pkgsite ``` -------------------------------- ### Install goupnp Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/tailscale/goupnp/README.md Run this command to install the goupnp library. ```bash go get -u github.com/tailscale/goupnp ``` -------------------------------- ### Install Go Flock Package Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/gofrs/flock/README.md Use 'go get' to install the flock package. This command fetches and installs the latest version. ```bash go get -u github.com/gofrs/flock ``` -------------------------------- ### Install mapstructure Go Library Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/go-viper/mapstructure/v2/README.md Use 'go get' to install the mapstructure library. This command fetches and installs the specified package and its dependencies. ```shell go get github.com/go-viper/mapstructure/v2 ``` -------------------------------- ### Basic Structured Logging vs. Standard Library Source: https://github.com/loft-sh/devpod/blob/main/vendor/sigs.k8s.io/controller-runtime/TMP-LOGGING.md Illustrates the difference between traditional formatted logging and structured logging with key-value pairs. ```go log.Printf("starting reconciliation for pod %s/%s", podNamespace, podName) ``` ```go logger.Info("starting reconciliation", "pod", req.NamespacedName) ``` -------------------------------- ### Install Compute API Go Client Source: https://github.com/loft-sh/devpod/blob/main/vendor/cloud.google.com/go/compute/metadata/README.md Use this command to install the compute API client library for Go. Ensure you have Go installed and configured. ```bash go get cloud.google.com/go/compute/metadata ``` -------------------------------- ### Create a Simple List Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/charmbracelet/lipgloss/README.md Define and print a basic list with string items. ```go l := list.New("A", "B", "C") ``` ```go fmt.Println(l) ``` -------------------------------- ### Install ansi Library Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/mgutz/ansi/README.md Use the go get command to install or update the ansi library. ```sh go get -u github.com/mgutz/ansi ``` -------------------------------- ### Start Workspace with Provider Source: https://github.com/loft-sh/devpod/blob/main/docs/pages/developing-providers/quickstart.mdx Command to start a new workspace using an added provider. ```bash devpod up github.com/microsoft/vscode-remote-try-go ``` -------------------------------- ### Clone and Setup Minikube Environment Source: https://github.com/loft-sh/devpod/blob/main/docs/pages/other-topics/advanced-guides/minikube-vscode-browser.mdx Clones the CKAD repository and runs a setup script for Minikube. This script prepares your environment for Minikube. ```sh git clone https://github.com/sandervanvugt/ckad.git cd ./ckad ./minikube-docker-setup.sh ``` -------------------------------- ### Install uuid Package Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/google/uuid/README.md Use 'go get' to install the uuid package. This command fetches and installs the package, making it available for use in your Go projects. ```sh go get github.com/google/uuid ``` -------------------------------- ### Create Root Logger Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/go-logr/logr/README.md Demonstrates how to create the root logger early in an application's lifecycle, choosing a specific logging implementation. ```go func main() { // ... other setup code ... // Create the "root" logger. We have chosen the "logimpl" implementation, // which takes some initial parameters and returns a logr.Logger. logger := logimpl.New(param1, param2) // ... other setup code ... } ``` -------------------------------- ### List All Containers with Go Client Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/docker/docker/client/README.md Demonstrates how to list all Docker containers, including stopped ones, using the Go client. Initializes the client from environment variables and handles potential errors. ```go package main import ( "context" "fmt" "github.com/docker/docker/api/types/container" "github.com/docker/docker/client" ) func main() { apiClient, err := client.NewClientWithOpts(client.FromEnv) if err != nil { panic(err) } defer apiClient.Close() containers, err := apiClient.ContainerList(context.Background(), container.ListOptions{All: true}) if err != nil { panic(err) } for _, ctr := range containers { fmt.Printf("%s %s (status: %s)\n", ctr.ID, ctr.Image, ctr.Status) } } ``` -------------------------------- ### Install zstd Package Source: https://github.com/loft-sh/devpod/blob/main/vendor/github.com/klauspost/compress/zstd/README.md Install the zstd package using the go get command. The package is located at github.com/klauspost/compress/zstd. ```bash go get -u github.com/klauspost/compress ``` -------------------------------- ### Start Minikube Source: https://github.com/loft-sh/devpod/blob/main/docs/pages/other-topics/advanced-guides/minikube-vscode-browser.mdx Executes the Minikube startup script. Note that Minikube needs to be restarted after VM shutdowns or reboots. ```sh ~./minikube-start.sh ```