readonly

package module
v0.0.0-...-902245d Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2019 License: MIT Imports: 7 Imported by: 1

README

readonly

godoc.org

readonly checks assignment to package variables.

package a

var (
	V1 int = 10 // OK - first assignment
	V2 int
)

func init() {
	V1 = 20  // OK - in init
	V2 = 100 // OK - in init
}

func main() {
	V1 = 30  // NG
	V2 = 200 // NG
	// assign
	V2 = 300 // OK - explicit assign
}

Documentation

Index

Constants

View Source
const Doc = `check for assignment package variables`

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name: "readonly",
	Doc:  Doc,
	Run:  run,
	Requires: []*analysis.Analyzer{
		inspect.Analyzer,
		buildssa.Analyzer,
		commentmap.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