Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/qawatake/globalcall
Linter `globalcall` detects that specific functions are called in a package scope.
https://github.com/qawatake/globalcall
go golang linter staticanalysis
Last synced: 7 days ago
JSON representation
Linter `globalcall` detects that specific functions are called in a package scope.
- Host: GitHub
- URL: https://github.com/qawatake/globalcall
- Owner: qawatake
- License: mit
- Created: 2024-03-23T10:34:08.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-04-07T12:48:49.000Z (9 months ago)
- Last Synced: 2024-10-29T12:57:12.697Z (about 2 months ago)
- Topics: go, golang, linter, staticanalysis
- Language: Go
- Homepage: https://pkg.go.dev/github.com/qawatake/globalcall
- Size: 19.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# globalcall
[![Go Reference](https://pkg.go.dev/badge/github.com/qawatake/globalcall.svg)](https://pkg.go.dev/github.com/qawatake/globalcall)
[![test](https://github.com/qawatake/globalcall/actions/workflows/test.yaml/badge.svg)](https://github.com/qawatake/globalcall/actions/workflows/test.yaml)Linter `globalcall` detects that specific functions are called in a package scope.
```go
var i = Int() // ng because Int must not be called in a package scope.func main() {
j := Int() // ok
fmt.Println(j)
}
```## How to use
Build your `globalcall` binary by writing `main.go` like below.
```go
package mainimport (
"github.com/qawatake/globalcall"
"golang.org/x/tools/go/analysis/unitchecker"
)func main() {
unitchecker.Main(
globalcall.NewAnalyzer(
globalcall.Func{
PkgPath: "pkg/in/which/target/func/is/defined",
FuncName: "Call",
},
),
)
}
```Then, run `go vet` with your `globalcall` binary.
```sh
go vet -vettool=/path/to/your/globalcall ./...
```