all: adopt strings, errors, and os helpers

This commit is contained in:
Kristoffer Dalby
2026-06-16 08:51:58 +00:00
parent 27468f944b
commit 4f4e95fc80
7 changed files with 19 additions and 44 deletions
+1 -8
View File
@@ -22,19 +22,12 @@ import (
)
func loadDERPMapFromPath(path string) (*tailcfg.DERPMap, error) {
derpFile, err := os.Open(path)
b, err := os.ReadFile(path)
if err != nil {
return nil, err
}
defer derpFile.Close()
var derpMap tailcfg.DERPMap
b, err := io.ReadAll(derpFile)
if err != nil {
return nil, err
}
err = yaml.Unmarshal(b, &derpMap)
return &derpMap, err