Skip to content

Commit f2b2959

Browse files
cryptobiozmcanevet
authored andcommitted
Remove unused structs, fix lint
1 parent d0b944a commit f2b2959

File tree

1 file changed

+5
-24
lines changed

1 file changed

+5
-24
lines changed

main.go

+5-24
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import (
3030
var version = "undefined"
3131
var transport *http.Transport
3232

33+
// Config stores handler's configuration
3334
type Config struct {
3435
Version bool `short:"V" long:"version" description:"Display version."`
3536
PuppetDBURL string `short:"u" long:"puppetdb-url" description:"PuppetDB base URL." env:"PROMETHEUS_PUPPETDB_URL" default:"http://puppetdb:8080"`
@@ -46,38 +47,18 @@ type Config struct {
4647
Manpage bool `short:"m" long:"manpage" description:"Output manpage."`
4748
}
4849

50+
// Node contains Puppet node informations
4951
type Node struct {
5052
Certname string `json:"certname"`
5153
Exporters map[string][]string `json:"value"`
5254
}
5355

56+
// StaticConfig contains Prometheus static targets
5457
type StaticConfig struct {
5558
Targets []string `yaml:"targets"`
5659
Labels map[string]string `yaml:"labels"`
5760
}
5861

59-
type FileSdConfig struct {
60-
Files []string `yaml:"files,omitempty"`
61-
}
62-
63-
type RelabelConfig struct {
64-
SourceLabels []string `yaml:"source_labels,omitempty"`
65-
Regex string `yaml:"regex,omitempty"`
66-
Action string `yaml:"action,omitempty"`
67-
TargetLabel string `yaml:"target_label,omitempty"`
68-
Replacement string `yaml:"replacement,omitempty"`
69-
}
70-
71-
type ScrapeConfig struct {
72-
JobName string `yaml:"job_name,omitempty"`
73-
FileSdConfigs []FileSdConfig `yaml:"file_sd_configs,omitempty"`
74-
RelabelConfigs []RelabelConfig `yaml:"relabel_configs,omitempty"`
75-
}
76-
77-
type PrometheusConfig struct {
78-
ScrapeConfigs []ScrapeConfig `yaml:"scrape_configs,omitempty"`
79-
}
80-
8162
func loadConfig(version string) (c Config, err error) {
8263
parser := flags.NewParser(&c, flags.Default)
8364
_, err = parser.Parse()
@@ -94,7 +75,7 @@ func loadConfig(version string) (c Config, err error) {
9475
var buf bytes.Buffer
9576
parser.ShortDescription = "Prometheus scrape lists based on PuppetDB"
9677
parser.WriteManPage(&buf)
97-
fmt.Printf(buf.String())
78+
fmt.Printf("%s", buf.String())
9879
os.Exit(0)
9980
}
10081
return
@@ -221,7 +202,7 @@ func main() {
221202
if err != nil {
222203
log.Fatalf("failed to get exporters: %v", err)
223204
}
224-
fmt.Printf(string(c))
205+
fmt.Printf("%s", string(c))
225206
}
226207
if cfg.Output == "file" {
227208
os.MkdirAll(filepath.Dir(cfg.File), 0755)

0 commit comments

Comments
 (0)