Apply go fix modernizations
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user