### Install gettext-go Source: https://github.com/openshift/hypershift/blob/main/vendor/github.com/chai2010/gettext-go/README.md Instructions to install the gettext-go library using go get and run a basic example. ```Go go get github.com/chai2010/gettext-go ``` ```Go go run hello.go ``` -------------------------------- ### Basic Gorilla Mux Server Setup (Go) Source: https://github.com/openshift/hypershift/blob/main/vendor/github.com/gorilla/mux/README.md This snippet provides a complete, runnable example of a minimal web server using Gorilla Mux in Go. It demonstrates how to define a route, associate it with a handler function, and start the HTTP server listening on a specified port. ```Go package main import ( "net/http" "log" "github.com/gorilla/mux" ) func YourHandler(w http.ResponseWriter, r *http.Request) { w.Write([]byte("Gorilla!\n")) } func main() { r := mux.NewRouter() // Routes consist of a path and a handler function. r.HandleFunc("/", YourHandler) // Bind to a port and pass our router in log.Fatal(http.ListenAndServe(":8000", r)) } ``` -------------------------------- ### Installation and Usage Source: https://github.com/openshift/hypershift/blob/main/hack/tools/vendor/github.com/hashicorp/go-version/README.md Instructions on how to install the go-version library and basic usage examples for version parsing and comparison. ```APIDOC ## Installation To install the go-version library, use the following go get command: ```bash go get github.com/hashicorp/go-version ``` ## Version Parsing and Comparison This section demonstrates how to parse version strings and compare them. ### Method ```go version.NewVersion(versionString) ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```go v1, err := version.NewVersion("1.2") v2, err := version.NewVersion("1.5+metadata") if v1.LessThan(v2) { fmt.Printf("%s is less than %s", v1, v2) } ``` ### Response #### Success Response (200) Returns a `*version.Version` object and an error if parsing fails. #### Response Example ```go // v1 and v2 are *version.Version objects ``` ## Version Constraints This section shows how to define and check version constraints. ### Method ```go version.NewConstraint(constraintString) ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```go v1, err := version.NewVersion("1.2") constraints, err := version.NewConstraint(">= 1.0, < 1.4") if constraints.Check(v1) { fmt.Printf("%s satisfies constraints %s", v1, constraints) } ``` ### Response #### Success Response (200) Returns a `version.Constraints` object and an error if the constraint string is invalid. #### Response Example ```go // constraints is a version.Constraints object ``` ## Version Sorting This section explains how to sort a collection of versions. ### Method ```go sort.Sort(version.Collection(versions)) ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```go versionsRaw := []string{"1.1", "0.7.1", "1.4-beta", "1.4", "2"} versions := make([]*version.Version, len(versionsRaw)) for i, raw := range versionsRaw { v, _ := version.NewVersion(raw) versions[i] = v } sort.Sort(version.Collection(versions)) ``` ### Response #### Success Response (200) The `versions` slice will be sorted in ascending order. #### Response Example ```go // versions slice is now sorted ``` ``` -------------------------------- ### Install nestif using Go Get Source: https://github.com/openshift/hypershift/blob/main/hack/tools/vendor/github.com/nakabonne/nestif/README.md Installs the nestif command-line tool using the go get command. This is the standard way to install Go binaries. ```bash go get github.com/nakabonne/nestif/cmd/nestif ``` -------------------------------- ### Install go-playground/locales Source: https://github.com/openshift/hypershift/blob/main/vendor/github.com/go-playground/locales/README.md Instructions on how to install the go-playground/locales library using the go get command. ```shell go get github.com/go-playground/locales ``` -------------------------------- ### Install Golang Color Library Source: https://github.com/openshift/hypershift/blob/main/hack/tools/vendor/github.com/fatih/color/README.md Instructions to install the color library using go get. This is the initial step before using any of its functionalities. ```bash go get github.com/fatih/color ``` -------------------------------- ### Install Packages Source: https://github.com/openshift/hypershift/blob/main/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/README.md Install the `azsecrets` and `azidentity` packages using `go get`. ```APIDOC ## Install Packages Install `azsecrets` and `azidentity` with `go get`: ```bash go get github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets go get github.com/Azure/azure-sdk-for-go/sdk/azidentity ``` `azidentity` is used for Azure Active Directory authentication. ``` -------------------------------- ### Install Promlinter using Go Get Source: https://github.com/openshift/hypershift/blob/main/hack/tools/vendor/github.com/yeya24/promlinter/README.md Installs the promlinter command-line tool using the Go get command. This is a convenient way to obtain the latest version of the tool for use in your Go projects. ```bash go get github.com/yeya24/promlinter/cmd/promlinter ``` -------------------------------- ### Setup uv and Install Dependencies Source: https://github.com/openshift/hypershift/blob/main/contrib/repo_metrics/README.md Installs the uv dependency manager and synchronizes project dependencies using a pyproject.toml file. Requires curl for uv installation and uv CLI for sync. ```bash # Install uv if you don't have it curl -LsSf https://astral.sh/uv/install.sh | sh # Install dependencies (to be run inside the directory where pyproject.toml is) uv sync --dev ``` -------------------------------- ### Initialize Raft Node Source: https://github.com/openshift/hypershift/blob/main/vendor/go.etcd.io/raft/v3/README.md Demonstrates how to start a Raft node using raft.StartNode. Includes examples for a three-node cluster, a single-node cluster, and a node joining an existing cluster. ```go storage := raft.NewMemoryStorage() c := &raft.Config{ ID: 0x01, ElectionTick: 10, HeartbeatTick: 1, Storage: storage, MaxSizePerMsg: 4096, MaxInflightMsgs: 256, } n := raft.StartNode(c, []raft.Peer{{ID: 0x01}, {ID: 0x02}, {ID: 0x03}}) ``` ```go peers := []raft.Peer{{ID: 0x01}} n := raft.StartNode(c, peers) ``` ```go n := raft.StartNode(c, nil) ``` -------------------------------- ### Install pflag Go Package Source: https://github.com/openshift/hypershift/blob/main/api/vendor/github.com/spf13/pflag/README.md Instructions for installing the pflag library using the standard Go get command. Includes command to run tests. ```go go get github.com/spf13/pflag go test github.com/spf13/pflag ``` -------------------------------- ### Install contextcheck using go get Source: https://github.com/openshift/hypershift/blob/main/hack/tools/vendor/github.com/kkHAIKE/contextcheck/README.md Provides the command to install the contextcheck tool using the Go package manager. This is the recommended way to obtain the latest version of the tool. ```bash $ go get -u github.com/kkHAIKE/contextcheck ``` -------------------------------- ### Setup Development Environment Source: https://github.com/openshift/hypershift/blob/main/hack/tools/vendor/github.com/MirrexOne/unqueryvet/README.md Initializes the project by cloning the repository, downloading dependencies, and verifying the build and test status. ```bash git clone https://github.com/MirrexOne/unqueryvet.git cd unqueryvet go mod download go test ./... go build ./... ``` -------------------------------- ### Install tparallel using go get Source: https://github.com/openshift/hypershift/blob/main/hack/tools/vendor/github.com/moricho/tparallel/README.md This command installs the tparallel command-line tool globally using `go get`. This method is suitable for users who have Go installed and configured. ```go go get -u github.com/moricho/tparallel/cmd/tparallel ``` -------------------------------- ### Initialize and Use Diskv Store Source: https://github.com/openshift/hypershift/blob/main/vendor/github.com/peterbourgon/diskv/README.md Demonstrates how to initialize a new Diskv store with a base path and cache size, perform write and read operations, and erase keys. ```go package main import ( "fmt" "github.com/peterbourgon/diskv" ) func main() { flatTransform := func(s string) []string { return []string{} } d := diskv.New(diskv.Options{ BasePath: "my-data-dir", Transform: flatTransform, CacheSizeMax: 1024 * 1024, }) key := "alpha" d.Write(key, []byte{'1', '2', '3'}) value, _ := d.Read(key) fmt.Printf("%v\n", value) d.Erase(key) } ``` -------------------------------- ### Install goccy/go-yaml Source: https://github.com/openshift/hypershift/blob/main/hack/tools/vendor/github.com/goccy/go-yaml/README.md Command to install the goccy/go-yaml library using go get. ```shell go get github.com/goccy/go-yaml ``` -------------------------------- ### Setup Repository Environment Source: https://github.com/openshift/hypershift/blob/main/hack/tools/vendor/go.uber.org/zap/CONTRIBUTING.md Commands to clone the repository, set up the upstream remote, and prepare the local development environment. ```bash mkdir -p $GOPATH/src/go.uber.org cd $GOPATH/src/go.uber.org git clone git@github.com:your_github_username/zap.git cd zap git remote add upstream https://github.com/uber-go/zap.git git fetch upstream ``` -------------------------------- ### Installing Wastedassign Source: https://github.com/openshift/hypershift/blob/main/hack/tools/vendor/github.com/sanposhiho/wastedassign/v2/README.md Provides installation commands for different Go versions using the go get or go install utilities. ```bash # Go version < 1.16 go get -u github.com/sanposhiho/wastedassign/v2/cmd/wastedassign # Go version 1.16+ go install github.com/sanposhiho/wastedassign/v2/cmd/wastedassign@latest ``` -------------------------------- ### Preview documentation site locally Source: https://github.com/openshift/hypershift/blob/main/docs/content/contribute/contribute-docs.md Starts a live preview server for the documentation using a containerized environment. This command must be executed from the 'docs' directory and automatically refreshes upon content changes. ```shell make serve-containerized ``` -------------------------------- ### Install HyperShift CLI (Shell) Source: https://github.com/openshift/hypershift/blob/main/docs/content/how-to/agent/create-agent-cluster.md This command installs the HyperShift CLI. The first example shows a basic installation that defaults to the 'latest' image. The second, recommended example, specifies a particular image version matching the OpenShift cluster release, ensuring compatibility. ```sh # This install latest hypershift install # You may want to run this instead hypershift install --hypershift-image quay.io/hypershift/hypershift-operator:4.11 ``` -------------------------------- ### Go SpdyStream Client Example Source: https://github.com/openshift/hypershift/blob/main/vendor/github.com/moby/spdystream/README.md Demonstrates how to establish a SpdyStream connection as a client, create a stream, write data to it, read a response, and close the stream. This example connects to a mirroring server without authentication. ```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() } ``` -------------------------------- ### Flock Package Installation Source: https://github.com/openshift/hypershift/blob/main/hack/tools/vendor/github.com/gofrs/flock/README.md Instructions on how to install the flock package using go get. ```APIDOC ## Flock Package Installation ### Description This section provides the command to install the flock package using the Go build tools. ### Method `go get` ### Endpoint `github.com/gofrs/flock` ### Parameters No parameters are required for installation. ### Request Example ```bash go get -u github.com/gofrs/flock ``` ### Response #### Success Response (200) Installation is successful when the command completes without errors. #### Response Example No specific output is expected on success, other than the package being downloaded and installed. ``` -------------------------------- ### Go SpdyStream Server Example Source: https://github.com/openshift/hypershift/blob/main/vendor/github.com/moby/spdystream/README.md Demonstrates how to set up a SpdyStream server that listens for incoming TCP connections, accepts them, and serves streams using a mirroring handler. This server mirrors received data back to the client without authentication. ```go package main import ( "github.com/moby/spdystream" "net" ) func main() { listener, err := net.Listen("tcp", "localhost:8080") if err != nil { panic(err) } for { conn, err := listener.Accept() if err != nil { panic(err) } spdyConn, err := spdystream.NewConnection(conn, true) if err != nil { panic(err) } go spdyConn.Serve(spdystream.MirrorStreamHandler) } } ``` -------------------------------- ### Typep Package Installation Source: https://github.com/openshift/hypershift/blob/main/hack/tools/vendor/github.com/go-toolsmith/typep/README.md Instructions on how to install the typep package using go get. ```APIDOC ## Installation Go version 1.16+ ```bash go get github.com/go-toolsmith/typep ``` ``` -------------------------------- ### Run Local Go Documentation Site Source: https://github.com/openshift/hypershift/blob/main/hack/tools/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md Commands to install and launch a local instance of the Go documentation site for viewing package docs. ```bash go install golang.org/x/pkgsite/cmd/pkgsite@latest pkgsite ``` -------------------------------- ### Install and Run asasalint Source: https://github.com/openshift/hypershift/blob/main/hack/tools/vendor/github.com/alingse/asasalint/README.md Instructions for installing the linter via Go and running it against a project directory. It also demonstrates how to exclude specific functions from linting checks. ```shell go install github.com/alingse/asasalint/cmd/asasalint@latest asasalint ./... asasalint -e append,Append ./... ``` -------------------------------- ### Development Environment Setup Source: https://github.com/openshift/hypershift/blob/main/api/vendor/github.com/samber/lo/README.md Provides commands for setting up the development environment using Docker or local dependencies. Includes instructions for running tests and continuous testing. ```bash docker-compose run --rm dev ``` ```bash # Install some dev dependencies make tools # Run tests make test # or make watch-test ``` -------------------------------- ### Initialize and Start a SOCKS5 Server Source: https://github.com/openshift/hypershift/blob/main/vendor/github.com/armon/go-socks5/README.md This snippet demonstrates how to instantiate a new SOCKS5 server configuration and start the server on a specified TCP address and port. It handles basic error checking during server creation and binding. ```go // Create a SOCKS5 server conf := &socks5.Config{} server, err := socks5.New(conf) if err != nil { panic(err) } // Create SOCKS5 proxy on localhost port 8000 if err := server.ListenAndServe("tcp", "127.0.0.1:8000"); err != nil { panic(err) } ``` -------------------------------- ### Install Diskv via Go Get Source: https://github.com/openshift/hypershift/blob/main/vendor/github.com/peterbourgon/diskv/README.md The command to download and install the Diskv package into your Go environment. ```bash go get github.com/peterbourgon/diskv ``` -------------------------------- ### Install sanitized_anchor_name package Source: https://github.com/openshift/hypershift/blob/main/hack/tools/vendor/github.com/shurcooL/sanitized_anchor_name/README.md Use the go get command to download and install the library into your Go workspace. ```bash go get -u github.com/shurcooL/sanitized_anchor_name ``` -------------------------------- ### Defining a WebService and Route Source: https://github.com/openshift/hypershift/blob/main/api/vendor/github.com/emicklei/go-restful/v3/README.md Demonstrates how to initialize a WebService, configure its path and content types, and define a route with a handler function. ```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 go-json library Source: https://github.com/openshift/hypershift/blob/main/hack/tools/vendor/github.com/goccy/go-json/README.md Command to install the go-json package into your Go project using the go get tool. ```bash go get github.com/goccy/go-json ``` -------------------------------- ### Configure and Initialize Go Logging Source: https://github.com/openshift/hypershift/blob/main/hack/tools/vendor/gopkg.in/op/go-logging.v1/README.md Demonstrates how to initialize the go-logging library, define a custom format string, implement a redactor for sensitive data, and configure multiple backends with specific log levels. ```go package main import ( "os" "github.com/op/go-logging" ) var log = logging.MustGetLogger("example") var format = logging.MustStringFormatter( `%{color}%{time:15:04:05.000} %{shortfunc} ▶ %{level:.4s} %{id:03x}%{color:reset} %{message}`, ) type Password string func (p Password) Redacted() interface{} { return logging.Redact(string(p)) } func main() { backend1 := logging.NewLogBackend(os.Stderr, "", 0) backend2 := logging.NewLogBackend(os.Stderr, "", 0) backend2Formatter := logging.NewBackendFormatter(backend2, format) backend1Leveled := logging.AddModuleLevel(backend1) backend1Leveled.SetLevel(logging.ERROR, "") logging.SetBackend(backend1Leveled, backend2Formatter) log.Debugf("debug %s", Password("secret")) log.Info("info") log.Notice("notice") log.Warning("warning") log.Error("err") log.Critical("crit") } ``` -------------------------------- ### Install Ansible Prerequisites Source: https://github.com/openshift/hypershift/blob/main/contrib/oidc/README.md Installs necessary Python dependencies and Ansible collections required to execute the OIDC setup playbooks. ```bash pip install -r requirements.txt ansible-galaxy install -r requirements.yml ``` -------------------------------- ### Go Validator Installation and Import Source: https://github.com/openshift/hypershift/blob/main/vendor/github.com/go-playground/validator/v10/README.md Instructions for installing the validator package using go get and importing it into your Go project. ```go go get github.com/go-playground/validator/v10 import "github.com/go-playground/validator/v10" ``` -------------------------------- ### Basic etcd Client Usage in Go Source: https://github.com/openshift/hypershift/blob/main/vendor/go.etcd.io/etcd/server/v3/internal/clientv2/README.md Demonstrates the basic usage of the etcd/client Go library. It shows how to configure the client, connect to etcd endpoints, and perform fundamental operations like setting and getting key-value pairs. The example includes setting up client configuration with endpoints and timeouts, and handling potential errors during these operations. ```go package main import ( "context" "log" "time" "go.etcd.io/etcd/v3/client" ) func main() { cfg := client.Config{ Endpoints: []string{"http://127.0.0.1:2379"}, Transport: client.DefaultTransport, // set timeout per request to fail fast when the target endpoint is unavailable HeaderTimeoutPerRequest: time.Second, } c, err := client.New(cfg) if err != nil { log.Fatal(err) } kapi := client.NewKeysAPI(c) // set "/foo" key with "bar" value log.Print("Setting '/foo' key with 'bar' value") resp, err := kapi.Set(context.Background(), "/foo", "bar", nil) if err != nil { log.Fatal(err) } else { // print common key info log.Printf("Set is done. Metadata is %q\n", resp) } // get "/foo" key's value log.Print("Getting '/foo' key value") resp, err = kapi.Get(context.Background(), "/foo", nil) if err != nil { log.Fatal(err) } else { // print common key info log.Printf("Get is done. Metadata is %q\n", resp) // print value log.Printf("%q key has %q value\n", resp.Node.Key, resp.Node.Value) } } ``` -------------------------------- ### Install and Import kubernetes-sigs/yaml in Go Source: https://github.com/openshift/hypershift/blob/main/api/vendor/sigs.k8s.io/yaml/README.md Instructions for installing the kubernetes-sigs/yaml library using go get and importing it into your Go project. ```go go get sigs.k8s.io/yaml import "sigs.k8s.io/yaml" ``` -------------------------------- ### Initialism Support Examples Source: https://github.com/openshift/hypershift/blob/main/hack/tools/vendor/github.com/ettle/strcase/README.md Provides examples of how the package handles Go initialisms and how they can be customized. ```APIDOC ## Initialism Support ### Description This section demonstrates the built-in support for Go initialisms and how to customize them for specific needs. ### Method N/A (Package functions) ### Endpoint N/A (Package functions) ### Parameters N/A ### Request Example ```go import "github.com/ettle/strcase" // Using default initialisms strcase.ToGoPascal("http_response") // Output: HTTPResponse strcase.ToGoSnake("http_response") // Output: HTTP_response // Customization example (assuming a custom caser 'c' is created as shown in Custom Caser Creation section) // c.ToGoPascal("ssl_certificate") // If SSL is added as an initialism ``` ### Response N/A (These are function calls, not API responses) ### Response Example N/A ``` -------------------------------- ### Deploy and Scale Sample Application Source: https://github.com/openshift/hypershift/blob/main/docs/content/how-to/aws/create-aws-hosted-cluster-autonode.md Creates a deployment for a web application with specific resource requests and node affinity requirements. Includes commands to scale the deployment to trigger node provisioning. ```shell cat << EOF | oc apply -f - --- apiVersion: apps/v1 kind: Deployment metadata: name: web-app spec: replicas: 0 selector: matchLabels: app: web-app template: metadata: labels: app: web-app spec: affinity: podAntiAffinity: requiredDuringSchedulingIgnoredDuringExecution: - labelSelector: matchLabels: app: web-app topologyKey: "kubernetes.io/hostname" securityContext: runAsUser: 1000 runAsGroup: 3000 fsGroup: 2000 containers: - image: public.ecr.aws/eks-distro/kubernetes/pause:3.2 name: web-app resources: requests: cpu: "1" memory: 256M securityContext: allowPrivilegeEscalation: false nodeSelector: node.kubernetes.io/instance-type: "t3.large" EOF oc scale --replicas=1 deployment.apps/web-app ``` -------------------------------- ### Install regexp2 Go Package Source: https://github.com/openshift/hypershift/blob/main/hack/tools/vendor/github.com/dlclark/regexp2/README.md Instructions for installing the regexp2 Go package using `go get`. It also provides the command for installing the `code_gen` branch for beta features. ```go go get github.com/dlclark/regexp2 ``` ```go go get github.com/dlclark/regexp2@code_gen ``` -------------------------------- ### Configure Environment Variables Source: https://github.com/openshift/hypershift/blob/main/contrib/self-managed-azure/README.md Initializes the user-specific configuration by copying the example template to a local file. ```bash cp user-vars.sh.example user-vars.sh ``` -------------------------------- ### Installation Source: https://github.com/openshift/hypershift/blob/main/hack/tools/vendor/github.com/rivo/uniseg/README.md Instructions on how to install the uniseg package using the Go build tool. ```APIDOC ## Installation ```bash go get github.com/rivo/uniseg ``` ``` -------------------------------- ### Install Go TOML Package and CLI Tool Source: https://github.com/openshift/hypershift/blob/main/hack/tools/vendor/github.com/BurntSushi/toml/README.md Instructions for installing the BurntSushi/toml Go package and its associated TOML validator CLI tool using go get and go install. ```bash % go get github.com/BurntSushi/toml@latest % go install github.com/BurntSushi/toml/cmd/tomlv@latest ``` -------------------------------- ### Gocognit Command Examples Source: https://github.com/openshift/hypershift/blob/main/hack/tools/vendor/github.com/uudashr/gocognit/README.md Provides practical examples of how to use the gocognit tool with different flags to analyze Go code complexity. These examples cover analyzing the current directory, specific files, top N functions, functions exceeding a complexity threshold, average complexity, and ignoring specific files. ```shell $ gocognit . $ gocognit main.go $ gocognit -top 10 src/ $ gocognit -over 25 docker $ gocognit -avg . $ gocognit -ignore "_test|testdata" . ``` -------------------------------- ### Install Google UUID Package Source: https://github.com/openshift/hypershift/blob/main/hack/tools/vendor/github.com/google/uuid/README.md This command installs the google/uuid package into your Go project environment using the go get tool. ```shell go get github.com/google/uuid ``` -------------------------------- ### Initialize and Use go-cache Source: https://github.com/openshift/hypershift/blob/main/vendor/github.com/patrickmn/go-cache/README.md Demonstrates how to initialize a cache instance with default expiration settings, perform basic set and get operations, and handle type assertions for retrieved values. ```go import ( "fmt" "github.com/patrickmn/go-cache" "time" ) func main() { c := cache.New(5*time.Minute, 10*time.Minute) c.Set("foo", "bar", cache.DefaultExpiration) c.Set("baz", 42, cache.NoExpiration) foo, found := c.Get("foo") if found { fmt.Println(foo) } if x, found := c.Get("foo"); found { foo := x.(string) fmt.Println(foo) } } ``` -------------------------------- ### Install Go YAML Package Source: https://github.com/openshift/hypershift/blob/main/api/vendor/go.yaml.in/yaml/v3/README.md Command to install the latest version of the YAML package for Go using the go get tool. ```bash go get go.yaml.in/yaml/v3 ``` -------------------------------- ### Initialize Block Device Filesystem Source: https://github.com/openshift/hypershift/blob/main/api/vendor/github.com/prometheus/procfs/README.md Shows how to initialize a filesystem instance that requires access to both /proc and /sys to retrieve block device statistics. ```go fs, err := blockdevice.NewFS("/proc", "/sys") stats, err := fs.ProcDiskstats() ```