Discover Packages
lesiw.io/tidytypes
package
module
Version:
v0.1.0
Opens a new window with list of versions in this module.
Published: Sep 28, 2025
License: MIT
Opens a new window with license information.
Imports: 4
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
README
¶
lesiw.io/tidytypes
An analysis.Analyzer
that reports redundant type declarations in function
parameters and results.
The analyzer identifies consecutive parameters or results with the same type
that can be grouped together using Go's type grouping syntax, making code more
concise and readable.
Usage (test)
package main
import (
"testing"
"lesiw.io/checker"
"lesiw.io/tidytypes"
)
func TestCheck(t *testing.T) { checker.Run(t, tidytypes.Analyzer) }
Usage (CLI)
go get -tool lesiw.io/tidytypes/cmd/tidytypes
go tool tidytypes ./...
Features
Detects redundant type declarations in function parameters and results.
Works with both named and unnamed parameters/results
Provides automatic fixes via suggested edits
Supports function literals and method declarations
Preserves existing grouped parameters that are already correct or cannot be
reduced
Fixes
Consecutive parameters with the same type: func(a int, b int)
→
func(a, b int)
Consecutive return values with the same type: func() (int, int)
→
func() (_, _ int)
Multiple redundant groups: func(a int, b int, c string, d string)
→
func(a, b int, c, d string)
Complex types: func(a []int, b []int)
→ func(a, b []int)
Function literals: var fn = func(x int, y int) {}
→
var fn = func(x, y int) {}
Expand ▾
Collapse ▴
Documentation
¶
View Source
var Analyzer = &analysis .Analyzer {
Name: "tidytypes",
Doc: "reports redundant type declarations in parameters and results",
Run: run,
}
Source Files
¶
Directories
¶
cmd
Click to show internal directories.
Click to hide internal directories.