Indent preformatted text in kstatus doc.go

This indents the code examples in the kstatus doc.go files so that
they'll be placed inside <pre> blocks by godoc. Without this change only
the coincidentally indented lines are marked as preformatted in godoc
HTML output.
This commit is contained in:
Lee Verberne
2020-01-10 15:53:44 +01:00
parent 4e7446540c
commit 4c6b995435
2 changed files with 40 additions and 36 deletions

View File

@@ -4,7 +4,7 @@
// Package kstatus contains functionality for computing the status // Package kstatus contains functionality for computing the status
// of Kubernetes resources. // of Kubernetes resources.
// //
// The statuses defined in this package is: // The statuses defined in this package are:
// * InProgress // * InProgress
// * Current // * Current
// * Failed // * Failed
@@ -13,11 +13,12 @@
// //
// Computing the status of a resources can be done by calling the // Computing the status of a resources can be done by calling the
// Compute function in the status package. // Compute function in the status package.
// import (
// "sigs.k8s.io/kustomize/kstatus/status"
// )
// res, err := status.Compute(resource)
// //
// import (
// "sigs.k8s.io/kustomize/kstatus/status"
// )
//
// res, err := status.Compute(resource)
// //
// The package also defines a set of new conditions: // The package also defines a set of new conditions:
// * InProgress // * InProgress
@@ -31,8 +32,10 @@
// the standard conditions described above. The values of // the standard conditions described above. The values of
// these conditions are decided based on other status information // these conditions are decided based on other status information
// available in the resources. // available in the resources.
// import ( //
// import (
// "sigs.k8s.io/kustomize/kstatus/status // "sigs.k8s.io/kustomize/kstatus/status
// ) // )
// err := status.Augment(resource) //
// err := status.Augment(resource)
package status package status

View File

@@ -15,24 +15,24 @@
// only requires functions for getting the apiVersion, kind, name // only requires functions for getting the apiVersion, kind, name
// and namespace of a resource. // and namespace of a resource.
// //
// import ( // import (
// "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" // "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
// "k8s.io/apimachinery/pkg/types" // "k8s.io/apimachinery/pkg/types"
// "sigs.k8s.io/kustomize/kstatus/wait" // "sigs.k8s.io/kustomize/kstatus/wait"
// ) // )
// //
// key := types.NamespacedName{Name: "name", Namespace: "namespace"} // key := types.NamespacedName{Name: "name", Namespace: "namespace"}
// deployment := &unstructured.Unstructured{ // deployment := &unstructured.Unstructured{
// Object: map[string]interface{}{ // Object: map[string]interface{}{
// "apiVersion": "apps/v1", // "apiVersion": "apps/v1",
// "kind": "Deployment", // "kind": "Deployment",
// }, // },
// } // }
// client.Get(context.Background(), key, deployment) // client.Get(context.Background(), key, deployment)
// resourceIdentifiers := []wait.ResourceIdentifier{deployment} // resourceIdentifiers := []wait.ResourceIdentifier{deployment}
// //
// resolver := wait.NewResolver(client) // resolver := wait.NewResolver(client)
// results := resolver.FetchAndResolve(context.Background(), resourceIdentifiers) // results := resolver.FetchAndResolve(context.Background(), resourceIdentifiers)
// //
// WaitForStatus also looks up status for a list of resources, but it will // WaitForStatus also looks up status for a list of resources, but it will
// block until all the provided resources has reached the Current status or // block until all the provided resources has reached the Current status or
@@ -40,18 +40,19 @@
// a channel that will provide updates as the status of the different // a channel that will provide updates as the status of the different
// resources change. // resources change.
// //
// import ( // import (
// "sigs.k8s.io/kustomize/kstatus/wait" // "sigs.k8s.io/kustomize/kstatus/wait"
// ) // )
// resolver := wait.NewResolver(client) //
// eventsChan := resolver.WaitForStatus(context.Background(), resourceIdentifiers, 2 * time.Second) // resolver := wait.NewResolver(client)
// for { // eventsChan := resolver.WaitForStatus(context.Background(), resourceIdentifiers, 2 * time.Second)
// select { // for {
// case event, ok := <-eventsChan: // select {
// if !ok { // case event, ok := <-eventsChan:
// return // if !ok {
// return
// }
// fmt.Printf(event) // do something useful here.
// } // }
// fmt.Printf(event) // do something useful here.
// } // }
// }
package wait package wait