mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Use vendor when building (#201)
* Use vendor code for all go calls * Add missing vendor dependencies * Add travis_retry to yarn install * Fix go test call
This commit is contained in:
committed by
StashAppDev
parent
3e13103264
commit
6a75d5551f
47
vendor/github.com/99designs/gqlgen/codegen/util.go
generated
vendored
Normal file
47
vendor/github.com/99designs/gqlgen/codegen/util.go
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
package codegen
|
||||
|
||||
import (
|
||||
"go/types"
|
||||
"strings"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func findGoNamedType(def types.Type) (*types.Named, error) {
|
||||
if def == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
namedType, ok := def.(*types.Named)
|
||||
if !ok {
|
||||
return nil, errors.Errorf("expected %s to be a named type, instead found %T\n", def.String(), def)
|
||||
}
|
||||
|
||||
return namedType, nil
|
||||
}
|
||||
|
||||
func findGoInterface(def types.Type) (*types.Interface, error) {
|
||||
if def == nil {
|
||||
return nil, nil
|
||||
}
|
||||
namedType, err := findGoNamedType(def)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if namedType == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
underlying, ok := namedType.Underlying().(*types.Interface)
|
||||
if !ok {
|
||||
return nil, errors.Errorf("expected %s to be a named interface, instead found %s", def.String(), namedType.String())
|
||||
}
|
||||
|
||||
return underlying, nil
|
||||
}
|
||||
|
||||
func equalFieldName(source, target string) bool {
|
||||
source = strings.Replace(source, "_", "", -1)
|
||||
target = strings.Replace(target, "_", "", -1)
|
||||
return strings.EqualFold(source, target)
|
||||
}
|
||||
Reference in New Issue
Block a user