chore: fmt.Errorf(static) → errors.New
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
12c8456251
commit
c46516884a
3 changed files with 8 additions and 6 deletions
|
|
@ -2,6 +2,7 @@ package i18n
|
|||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
|
|
@ -48,7 +49,7 @@ func CalibrateDomains(ctx context.Context, modelA, modelB inference.TextModel,
|
|||
samples []CalibrationSample, opts ...ClassifyOption) (*CalibrationStats, error) {
|
||||
|
||||
if len(samples) == 0 {
|
||||
return nil, fmt.Errorf("calibrate: empty sample set")
|
||||
return nil, errors.New("calibrate: empty sample set")
|
||||
}
|
||||
|
||||
cfg := defaultClassifyConfig()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package reversal
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"errors"
|
||||
"math"
|
||||
"sort"
|
||||
)
|
||||
|
|
@ -45,7 +45,7 @@ type ImprintClassification struct {
|
|||
// per unique domain label.
|
||||
func BuildReferences(tokeniser *Tokeniser, samples []ClassifiedText) (*ReferenceSet, error) {
|
||||
if len(samples) == 0 {
|
||||
return nil, fmt.Errorf("empty sample set")
|
||||
return nil, errors.New("empty sample set")
|
||||
}
|
||||
|
||||
// Group imprints by domain.
|
||||
|
|
@ -60,7 +60,7 @@ func BuildReferences(tokeniser *Tokeniser, samples []ClassifiedText) (*Reference
|
|||
}
|
||||
|
||||
if len(grouped) == 0 {
|
||||
return nil, fmt.Errorf("no samples with domain labels")
|
||||
return nil, errors.New("no samples with domain labels")
|
||||
}
|
||||
|
||||
rs := &ReferenceSet{Domains: make(map[string]*ReferenceDistribution)}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package i18n
|
|||
import (
|
||||
"embed"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"maps"
|
||||
|
|
@ -97,7 +98,7 @@ func NewWithLoader(loader Loader, opts ...Option) (*Service, error) {
|
|||
|
||||
langs := loader.Languages()
|
||||
if len(langs) == 0 {
|
||||
return nil, fmt.Errorf("no languages available from loader")
|
||||
return nil, errors.New("no languages available from loader")
|
||||
}
|
||||
|
||||
for _, lang := range langs {
|
||||
|
|
@ -181,7 +182,7 @@ func (s *Service) SetLanguage(lang string) error {
|
|||
return fmt.Errorf("invalid language tag %q: %w", lang, err)
|
||||
}
|
||||
if len(s.availableLangs) == 0 {
|
||||
return fmt.Errorf("no languages available")
|
||||
return errors.New("no languages available")
|
||||
}
|
||||
matcher := language.NewMatcher(s.availableLangs)
|
||||
bestMatch, _, confidence := matcher.Match(requestedLang)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue