set

package
v0.0.0-...-1570881 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2025 License: MIT Imports: 6 Imported by: 0

README

set analyzer

Detects map[string]bool values that are only ever written the constant true, signalling they are being used as sets. Recommends switching to map[string]struct{} to avoid wasted heap.

Run it

go install github.com/ribice/smgt/cmd/set@latest
set ./...

Typical finding

hosts := map[string]bool{} // flagged: prefer map[string]struct{}
hosts[h.Name] = true

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAnalyzer

func NewAnalyzer() *analysis.Analyzer

Types

This section is empty.

Jump to

Keyboard shortcuts

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