mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-02 14:46:31 +00:00
56a854fe14
* update github.com/docker/cli * update github.com/docker/distribution * update github.com/docker/docker * update github.com/gin-gonic/gin * update github.com/golang-jwt/jwt/v4 * update github.com/golangci/golangci-lint * update github.com/gorilla/securecookie * update github.com/mattn/go-sqlite3 * update github.com/moby/moby * update github.com/prometheus/client_golang * update github.com/xanzy/go-gitlab
29 lines
964 B
Go
29 lines
964 B
Go
package exhaustive
|
|
|
|
import "golang.org/x/tools/go/analysis"
|
|
|
|
// NOTE: Fact types must remain gob-coding compatible.
|
|
// See TestFactsGob.
|
|
|
|
var _ analysis.Fact = (*enumMembersFact)(nil)
|
|
|
|
type enumMembersFact struct{ Members enumMembers }
|
|
|
|
func (f *enumMembersFact) AFact() {}
|
|
func (f *enumMembersFact) String() string { return f.Members.factString() }
|
|
|
|
// exportFact exports the enum members for the given enum type.
|
|
func exportFact(pass *analysis.Pass, enumTyp enumType, members enumMembers) {
|
|
pass.ExportObjectFact(enumTyp.factObject(), &enumMembersFact{members})
|
|
}
|
|
|
|
// importFact imports the enum members for the given possible enum type.
|
|
// An (_, false) return indicates that the enum type is not a known one.
|
|
func importFact(pass *analysis.Pass, possibleEnumType enumType) (enumMembers, bool) {
|
|
var f enumMembersFact
|
|
ok := pass.ImportObjectFact(possibleEnumType.factObject(), &f)
|
|
if !ok {
|
|
return enumMembers{}, false
|
|
}
|
|
return f.Members, true
|
|
}
|