adopt latest golang enhancements (#91)

This commit is contained in:
T. von Dein
2026-07-13 14:33:41 +02:00
parent c5a21bd677
commit 97a509da9e
19 changed files with 159 additions and 114 deletions

View File

@@ -194,18 +194,18 @@ func (cluster *Cluster) getDefaultOptions() []elasticsearch.Option {
}
func (cluster *Cluster) getTransport() elastictransport.Option {
transport := &http.Transport{
transport := new(http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}
})
if cluster.DebugHTTP {
return elastictransport.WithTransport(
&DebugTransport{Transport: transport},
new(DebugTransport{Transport: transport}),
)
}
return elastictransport.WithTransport(
&CompatibilityTransport{Transport: transport},
new(CompatibilityTransport{Transport: transport}),
)
}

View File

@@ -28,7 +28,7 @@ import (
)
const (
Version string = `v0.0.26`
Version string = `v0.0.27`
)
var (
@@ -89,12 +89,13 @@ type Config struct {
Force bool // ccr follower renew: -f
DebugHTTP bool // root: --debug-http
Separator string // role diff: -s
NotDeployed bool // role diff: -n
Undefined bool // role diff: -u
Diff bool // role diff: -D
Hidden bool // ds ls: -H
DebugHTTP bool // root: --debug-http
DebugGoRoutines bool // root: --debug-goroutines
Separator string // role diff: -s
NotDeployed bool // role diff: -n
Undefined bool // role diff: -u
Diff bool // role diff: -D
Hidden bool // ds ls: -H
// rollover
MaxAge string
@@ -113,7 +114,7 @@ type Config struct {
}
func NewConfig() *Config {
return &Config{Clusters: map[string]*Cluster{}}
return new(Config{Clusters: map[string]*Cluster{}})
}
func getDefaultPath() string {
@@ -216,7 +217,7 @@ func (conf *Config) LoadConfig() error {
return fmt.Errorf("failed to read config file: %w", err)
}
newconf := &Config{}
newconf := new(Config{})
err = yaml.Unmarshal(data, newconf)
if err != nil {