Skip to content

Commit 3d2cf0b

Browse files
authored
Indent example in godoc consistently (#1226)
* Indent example in godoc consistently Signed-off-by: Jon Kartago Lamida <[email protected]> * Add missed one line indentation fix Signed-off-by: Jon Kartago Lamida <[email protected]> --------- Signed-off-by: Jon Kartago Lamida <[email protected]>
1 parent ffbbe80 commit 3d2cf0b

File tree

2 files changed

+36
-36
lines changed

2 files changed

+36
-36
lines changed

prometheus/doc.go

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -37,35 +37,35 @@
3737
//
3838
// type metrics struct {
3939
// cpuTemp prometheus.Gauge
40-
// hdFailures *prometheus.CounterVec
40+
// hdFailures *prometheus.CounterVec
4141
// }
4242
//
4343
// func NewMetrics(reg prometheus.Registerer) *metrics {
44-
// m := &metrics{
45-
// cpuTemp: prometheus.NewGauge(prometheus.GaugeOpts{
46-
// Name: "cpu_temperature_celsius",
47-
// Help: "Current temperature of the CPU.",
48-
// }),
49-
// hdFailures: prometheus.NewCounterVec(
50-
// prometheus.CounterOpts{
51-
// Name: "hd_errors_total",
52-
// Help: "Number of hard-disk errors.",
53-
// },
54-
// []string{"device"},
55-
// ),
56-
// }
57-
// reg.MustRegister(m.cpuTemp)
58-
// reg.MustRegister(m.hdFailures)
59-
// return m
44+
// m := &metrics{
45+
// cpuTemp: prometheus.NewGauge(prometheus.GaugeOpts{
46+
// Name: "cpu_temperature_celsius",
47+
// Help: "Current temperature of the CPU.",
48+
// }),
49+
// hdFailures: prometheus.NewCounterVec(
50+
// prometheus.CounterOpts{
51+
// Name: "hd_errors_total",
52+
// Help: "Number of hard-disk errors.",
53+
// },
54+
// []string{"device"},
55+
// ),
56+
// }
57+
// reg.MustRegister(m.cpuTemp)
58+
// reg.MustRegister(m.hdFailures)
59+
// return m
6060
// }
6161
//
6262
// func main() {
63-
// // Create a non-global registry.
64-
// reg := prometheus.NewRegistry()
63+
// // Create a non-global registry.
64+
// reg := prometheus.NewRegistry()
6565
//
66-
// // Create new metrics and register them using the custom registry.
67-
// m := NewMetrics(reg)
68-
// // Set values for the new created metrics.
66+
// // Create new metrics and register them using the custom registry.
67+
// m := NewMetrics(reg)
68+
// // Set values for the new created metrics.
6969
// m.cpuTemp.Set(65.3)
7070
// m.hdFailures.With(prometheus.Labels{"device":"/dev/sda"}).Inc()
7171
//

prometheus/promauto/auto.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,30 +28,30 @@
2828
// package main
2929
//
3030
// import (
31-
// "math/rand"
32-
// "net/http"
31+
// "math/rand"
32+
// "net/http"
3333
//
34-
// "github.com/prometheus/client_golang/prometheus"
35-
// "github.com/prometheus/client_golang/prometheus/promauto"
36-
// "github.com/prometheus/client_golang/prometheus/promhttp"
34+
// "github.com/prometheus/client_golang/prometheus"
35+
// "github.com/prometheus/client_golang/prometheus/promauto"
36+
// "github.com/prometheus/client_golang/prometheus/promhttp"
3737
// )
3838
//
3939
// var histogram = promauto.NewHistogram(prometheus.HistogramOpts{
40-
// Name: "random_numbers",
41-
// Help: "A histogram of normally distributed random numbers.",
42-
// Buckets: prometheus.LinearBuckets(-3, .1, 61),
40+
// Name: "random_numbers",
41+
// Help: "A histogram of normally distributed random numbers.",
42+
// Buckets: prometheus.LinearBuckets(-3, .1, 61),
4343
// })
4444
//
4545
// func Random() {
46-
// for {
47-
// histogram.Observe(rand.NormFloat64())
48-
// }
46+
// for {
47+
// histogram.Observe(rand.NormFloat64())
48+
// }
4949
// }
5050
//
5151
// func main() {
52-
// go Random()
53-
// http.Handle("/metrics", promhttp.Handler())
54-
// http.ListenAndServe(":1971", nil)
52+
// go Random()
53+
// http.Handle("/metrics", promhttp.Handler())
54+
// http.ListenAndServe(":1971", nil)
5555
// }
5656
//
5757
// Prometheus's version of a minimal hello-world program:

0 commit comments

Comments
 (0)