namedtypes

package module
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 30, 2026 License: MIT Imports: 6 Imported by: 0

README

yze-go-namedtypes

A yze analyzer (category types) enforcing the gomatic Go standard that function parameters use named domain types rather than bare primitives.

v1 flags parameters of non-method function declarations whose type is a bare predeclared primitive identifier (int, string, bool, …). A named domain type — whether a defined type (type Count int) or an alias (type Celsius = float64) — is exempt, as are the predeclared error/any interfaces and imported types. Method receivers (interface-satisfaction carve-outs) and composite types ([]string, …) are deferred.

  • Rule: yze/namedtypes
  • Library: exports Analyzer and Registration for the yze aggregator and stickler runner.
  • Binary: cmd/yze-go-namedtypes runs it standalone (text/-json, and as a go vet -vettool).

Built on the go-yze framework.

Documentation

Overview

Package namedtypes provides a go/analysis analyzer enforcing the gomatic Go standard that function parameters use named domain types rather than bare primitives. v1 covers non-method function declarations whose parameter type is a bare predeclared primitive identifier; methods and composite types are deferred.

Index

Constants

This section is empty.

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name:     "namedtypes",
	Doc:      "reports function parameters that use a bare primitive type instead of a named domain type",
	Requires: []*analysis.Analyzer{inspect.Analyzer},
	Run:      run,
}

Analyzer reports function parameters declared with a bare primitive type.

View Source
var Registration = goyze.Registration{
	Name:       "namedtypes",
	Categories: []goyze.Category{"types"},
	URL:        "https://docs.gomatic.dev/yze/namedtypes",
	Analyzer:   Analyzer,
}

Registration declares this analyzer to the yze framework.

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis
cmd
yze-go-namedtypes command
Command yze-go-namedtypes runs the namedtypes analyzer as a standalone go/analysis checker (text, -json, and -fix output, and usable as a `go vet -vettool`).
Command yze-go-namedtypes runs the namedtypes analyzer as a standalone go/analysis checker (text, -json, and -fix output, and usable as a `go vet -vettool`).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL