diff options
Diffstat (limited to 'internal/config')
-rw-r--r-- | internal/config/config.go | 4 | ||||
-rw-r--r-- | internal/config/cspgenerator.go | 18 |
2 files changed, 11 insertions, 11 deletions
diff --git a/internal/config/config.go b/internal/config/config.go index 7ccad85..000dc6f 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -28,7 +28,7 @@ type URL struct { func (u *URL) UnmarshalText(text []byte) (err error) { u.URL, err = url.Parse(string(text)) - return errors.Wrapf(err, "could not parse URL %s", string(text)) + return errors.WithMessagef(err, "could not parse URL %s", string(text)) } type Config struct { @@ -65,7 +65,7 @@ func GetConfig(dir string, log *log.Logger) (*Config, error) { return nil, errors.WithMessage(t, t.ErrorWithUsage()) } - return nil, errors.Wrap(err, "config error") + return nil, errors.WithMessage(err, "config error") } return &config, nil diff --git a/internal/config/cspgenerator.go b/internal/config/cspgenerator.go index 9974819..389e778 100644 --- a/internal/config/cspgenerator.go +++ b/internal/config/cspgenerator.go @@ -17,7 +17,7 @@ func GenerateCSP() error { file, err := os.OpenFile("./csp.go", os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0) if err != nil { - return errors.Wrap(err, "could not write to output") + return errors.WithMessage(err, "could not write to output") } defer file.Close() @@ -32,12 +32,12 @@ import ( `) if err != nil { - return errors.Wrap(err, "could not write to output") + return errors.WithMessage(err, "could not write to output") } _, err = fmt.Fprintf(file, "type CSP struct {\n") if err != nil { - return errors.Wrap(err, "could not write to output") + return errors.WithMessage(err, "could not write to output") } for i := 0; i < t.NumField(); i++ { @@ -46,28 +46,28 @@ import ( t = field.Type tags, err := structtag.Parse(string(field.Tag)) if err != nil { - return errors.Wrap(err, "could not write to output") + return errors.WithMessage(err, "could not write to output") } cspTag, err := tags.Get("csp") if err != nil { - return errors.Wrap(err, "could not get csp tag") + return errors.WithMessage(err, "could not get csp tag") } err = tags.Set(&structtag.Tag{ Key: "toml", Name: cspTag.Name, }) if err != nil { - return errors.Wrap(err, "could not set toml tag") + return errors.WithMessage(err, "could not set toml tag") } _, err = fmt.Fprintf(file, "\t%-23s %-28s `%s`\n", field.Name, t, tags.String()) if err != nil { - return errors.Wrap(err, "could not write to output") + return errors.WithMessage(err, "could not write to output") } } _, err = fmt.Fprintln(file, "}") if err != nil { - return errors.Wrap(err, "could not write to output") + return errors.WithMessage(err, "could not write to output") } _, err = fmt.Fprintln(file, ` @@ -75,7 +75,7 @@ func (c *CSP) String() string { return csp.Header(*c).String() }`) if err != nil { - return errors.Wrap(err, "could not write to output") + return errors.WithMessage(err, "could not write to output") } return nil |