test(config): add unit tests for loader, doc comments, fix fmt.Errorf misuse

- Add 808-line loader_test.go covering registerGroup, register, and Load
- Add package and exported symbol doc comments to loader.go
- Fix fmt.Errorf(resp.Status) → errors.New(resp.Status) in sd/plugin/http.go
  (resp.Status is a plain string, not a format string)
This commit is contained in:
ginuerzh
2026-05-24 12:36:51 +08:00
parent 82e7e50120
commit 8390ccadab
3 changed files with 823 additions and 2 deletions
+3 -2
View File
@@ -4,6 +4,7 @@ import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"net/http"
@@ -81,7 +82,7 @@ func (p *httpPlugin) Register(ctx context.Context, service *sd.Service, opts ...
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return fmt.Errorf(resp.Status)
return errors.New(resp.Status)
}
return nil
@@ -119,7 +120,7 @@ func (p *httpPlugin) Deregister(ctx context.Context, service *sd.Service) error
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return fmt.Errorf(resp.Status)
return errors.New(resp.Status)
}
return nil