wip modernize code base
This commit is contained in:
parent
c562a21e8c
commit
2579999de0
37 changed files with 11104 additions and 190 deletions
24
yaml.go
Normal file
24
yaml.go
Normal file
|
@ -0,0 +1,24 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
)
|
||||
|
||||
func (t *Targets) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||
targets := []string{}
|
||||
err := unmarshal(&targets)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*t = Targets{
|
||||
targets: make([]*url.URL, len(targets)),
|
||||
}
|
||||
for i, u := range targets {
|
||||
u, err := url.Parse(u)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.targets[i] = u
|
||||
}
|
||||
return nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue