unusedtypeparam

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2022 License: MIT Imports: 4 Imported by: 0

README

unusedtypeparam

unusedtypeparam is an analyzer that detects unused type parameter.

Instruction

go install github.com/sivchari/unusedtypeparam/cmd/unusedtypeparam@latest

Usage

package a

type C interface {
	string | ~int
}

func ok1[E C](arg E) {
	arg2 := arg
	_ = arg2
	var arg3 E
	_ = arg3
}

func ok2[E C](arg any) {
	var arg3 E
	_ = arg3
}

func ng[E C](arg any) { // want "This func unused type parameter."
	arg2 := arg
	_ = arg2
}
go vet -vettool=(which unusedtypeparam) ./...

# command-line-arguments
testdata/src/a/a.go:19:1: This func unused type parameter.

CI

CircleCI
- run:
    name: install unusedtypeparam
    command: go install github.com/sivchari/unusedtypeparam/cmd/unusedtypeparam@latest

- run:
    name: run unusedtypeparam
    command: go vet -vettool=`which unusedtypeparam` ./...
GitHub Actions
- name: install unusedtypeparam
  run: go install github.com/sivchari/unusedtypeparam/cmd/unusedtypeparam@latest

- name: run unusedtypeparam
  run: go vet -vettool=`which unusedtypeparam` ./...

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name: "unusedtypeparam",
	Doc:  doc,
	Run:  run,
	Requires: []*analysis.Analyzer{
		inspect.Analyzer,
	},
}

Analyzer is an analyzer.

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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