https://github.com/gostaticanalysis/readonly
Analyzer: check for possible assigning package variables
https://github.com/gostaticanalysis/readonly
analyzer golang staticanalysis
Last synced: 25 days ago
JSON representation
Analyzer: check for possible assigning package variables
- Host: GitHub
- URL: https://github.com/gostaticanalysis/readonly
- Owner: gostaticanalysis
- License: mit
- Created: 2019-03-08T08:43:05.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-08T11:12:07.000Z (almost 7 years ago)
- Last Synced: 2024-11-17T12:49:56.324Z (over 1 year ago)
- Topics: analyzer, golang, staticanalysis
- Language: Go
- Homepage:
- Size: 7.81 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# readonly
[![godoc.org][godoc-badge]][godoc]
`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
}
```
[godoc]: https://godoc.org/github.com/gostaticanalysis/readonly
[godoc-badge]: https://img.shields.io/badge/godoc-reference-4F73B3.svg?style=flat-square&label=%20godoc.org