Apply go fix modernizations

This commit is contained in:
Ian Gulliver
2026-03-05 11:39:12 -08:00
parent 1e0b2cd945
commit d1d30e1d50
3 changed files with 17 additions and 17 deletions

View File

@@ -164,17 +164,17 @@ func (a *FromAddr) parse(s string) error {
}
func parseChannelRange(spec string, start, end *int) error {
if idx := strings.Index(spec, "-"); idx != -1 {
s, err := strconv.Atoi(spec[:idx])
if before, after, ok := strings.Cut(spec, "-"); ok {
s, err := strconv.Atoi(before)
if err != nil {
return fmt.Errorf("invalid channel start: %w", err)
}
*start = s
if spec[idx+1:] == "" {
if after == "" {
*end = 512
} else {
e, err := strconv.Atoi(spec[idx+1:])
e, err := strconv.Atoi(after)
if err != nil {
return fmt.Errorf("invalid channel end: %w", err)
}
@@ -351,11 +351,11 @@ func Load(path string) (*Config, error) {
// NormalizedMapping is a processed mapping ready for the remapper
type NormalizedMapping struct {
From Universe
FromChan int // 0-indexed
To Universe
ToChan int // 0-indexed
Count int
From Universe
FromChan int // 0-indexed
To Universe
ToChan int // 0-indexed
Count int
}
// Normalize converts config mappings to normalized form (0-indexed channels)