golang/go
GitHub で見るx/tools/go/analysis/cmd/vet: add -cgoinclude check for #include of code in subdirectories
Open
#26,506 opened on 2018年7月20日
AnalysisNeedsFixhelp wanted
Repository metrics
- Stars
- (133,883 stars)
- PR merge metrics
- (30d に merged PR はありません)
説明
The go build model is that all code for a package is in one directory. The cache relies on this. Vendoring tools rely on this. Probably many other things rely on this.
One of the few ways a package can violate this rule is by using #include in cgo source code to access code in nearby directories. This appears to work, in that the package builds, but it doesn't cache properly, doesn't vendor properly, and so on.
It seems reasonable for cmd/vet to notice such #includes and complain about them, and we could enable that check as one of the automatic ones run during go test.
Suggested in #26366.