From bc173e26d44349b96cafebd4682466b234666567 Mon Sep 17 00:00:00 2001 From: luowei Date: Thu, 23 Nov 2023 15:41:26 +0800 Subject: [PATCH 01/10] get parsed SQLs with source file --- sqle/api/controller/v1/sql_audit_record.go | 188 +++++++++++++-------- sqle/api/controller/v1/task.go | 148 ++++++++-------- sqle/api/controller/v2/task.go | 17 +- sqle/model/task.go | 22 +-- 4 files changed, 207 insertions(+), 168 deletions(-) diff --git a/sqle/api/controller/v1/sql_audit_record.go b/sqle/api/controller/v1/sql_audit_record.go index 287e43772e..f5c5c76a4e 100644 --- a/sqle/api/controller/v1/sql_audit_record.go +++ b/sqle/api/controller/v1/sql_audit_record.go @@ -2,6 +2,7 @@ package v1 import ( "archive/zip" + "bytes" "context" "encoding/json" e "errors" @@ -93,17 +94,15 @@ func CreateSQLAuditRecord(c echo.Context) error { } s := model.GetStorage() - + sqls := getSQLFromFileResp{} user, err := controller.GetCurrentUser(c, dms.GetUser) if err != nil { return controller.JSONBaseErrorReq(c, err) } - var sqls string - var source string if req.Sqls != "" { - sqls, source = req.Sqls, model.TaskSQLSourceFromFormData + sqls = getSQLFromFileResp{model.TaskSQLSourceFromFormData, []SQLsFromFile{{SQLs: req.Sqls}}} } else { - sqls, source, err = getSQLFromFile(c) + sqls, err = getSQLFromFile(c) if err != nil { return controller.JSONBaseErrorReq(c, err) } @@ -111,12 +110,12 @@ func CreateSQLAuditRecord(c echo.Context) error { var task *model.Task if req.InstanceName != "" { - task, err = buildOnlineTaskForAudit(c, s, uint64(user.ID), req.InstanceName, req.InstanceSchema, projectUid, source, sqls) + task, err = buildOnlineTaskForAudit(c, s, uint64(user.ID), req.InstanceName, req.InstanceSchema, projectUid, sqls) if err != nil { return controller.JSONBaseErrorReq(c, err) } } else { - task, err = buildOfflineTaskForAudit(uint64(user.ID), req.DbType, source, sqls) + task, err = buildOfflineTaskForAudit(uint64(user.ID), req.DbType, sqls) if err != nil { return controller.JSONBaseErrorReq(c, err) } @@ -165,7 +164,17 @@ func CreateSQLAuditRecord(c echo.Context) error { }) } -func buildOnlineTaskForAudit(c echo.Context, s *model.Storage, userId uint64, instanceName, instanceSchema, projectUid, sourceType, sqls string) (*model.Task, error) { +type getSQLFromFileResp struct { + SourceType string + SQLs []SQLsFromFile +} + +type SQLsFromFile struct { + FilePath string + SQLs string +} + +func buildOnlineTaskForAudit(c echo.Context, s *model.Storage, userId uint64, instanceName, instanceSchema, projectUid string, sqls getSQLFromFileResp) (*model.Task, error) { instance, exist, err := dms.GetInstanceInProjectByName(c.Request().Context(), projectUid, instanceName) if err != nil { return nil, err @@ -197,33 +206,38 @@ func buildOnlineTaskForAudit(c echo.Context, s *model.Storage, userId uint64, in Instance: instance, CreateUserId: userId, ExecuteSQLs: []*model.ExecuteSQL{}, - SQLSource: sourceType, + SQLSource: sqls.SourceType, DBType: instance.DbType, } createAt := time.Now() task.CreatedAt = createAt - nodes, err := plugin.Parse(context.TODO(), sqls) - if err != nil { - return nil, err - } - for n, node := range nodes { - task.ExecuteSQLs = append(task.ExecuteSQLs, &model.ExecuteSQL{ - BaseSQL: model.BaseSQL{ - Number: uint(n + 1), - Content: node.Text, - }, - }) + var num uint = 1 + for _, sqlsFromOneFile := range sqls.SQLs { + nodes, err := plugin.Parse(context.TODO(), sqlsFromOneFile.SQLs) + if err != nil { + return nil, err + } + for _, node := range nodes { + task.ExecuteSQLs = append(task.ExecuteSQLs, &model.ExecuteSQL{ + BaseSQL: model.BaseSQL{ + Number: num, + Content: node.Text, + SourceFile: sqlsFromOneFile.FilePath, + }, + }) + num++ + } } return task, nil } -func buildOfflineTaskForAudit(userId uint64, dbType, sourceType, sqls string) (*model.Task, error) { +func buildOfflineTaskForAudit(userId uint64, dbType string, sqls getSQLFromFileResp) (*model.Task, error) { task := &model.Task{ CreateUserId: userId, ExecuteSQLs: []*model.ExecuteSQL{}, - SQLSource: sourceType, + SQLSource: sqls.SourceType, DBType: dbType, } var err error @@ -234,54 +248,58 @@ func buildOfflineTaskForAudit(userId uint64, dbType, sourceType, sqls string) (* } defer plugin.Close(context.TODO()) - nodes, err = plugin.Parse(context.TODO(), sqls) - if err != nil { - return nil, fmt.Errorf("parse sqls failed: %v", err) + var num uint = 1 + for _, sqlsFromOneFile := range sqls.SQLs { + nodes, err = plugin.Parse(context.TODO(), sqlsFromOneFile.SQLs) + if err != nil { + return nil, fmt.Errorf("parse sqls failed: %v", err) + } + for _, node := range nodes { + task.ExecuteSQLs = append(task.ExecuteSQLs, &model.ExecuteSQL{ + BaseSQL: model.BaseSQL{ + Number: num, + Content: node.Text, + SourceFile: sqlsFromOneFile.FilePath, + }, + }) + num++ + } } createAt := time.Now() task.CreatedAt = createAt - for n, node := range nodes { - task.ExecuteSQLs = append(task.ExecuteSQLs, &model.ExecuteSQL{ - BaseSQL: model.BaseSQL{ - Number: uint(n + 1), - Content: node.Text, - }, - }) - } - return task, nil } -func getSqlsFromZip(c echo.Context) (sqls string, exist bool, err error) { +func getSqlsFromZip(c echo.Context) (sqls []SQLsFromFile, exist bool, err error) { file, err := c.FormFile(InputZipFileName) if err == http.ErrMissingFile { - return "", false, nil + return nil, false, nil } if err != nil { - return "", false, err + return nil, false, err } f, err := file.Open() if err != nil { - return "", false, err + return nil, false, err } defer f.Close() currentPos, err := f.Seek(0, io.SeekEnd) // get size of zip file if err != nil { - return "", false, err + return nil, false, err } size := currentPos + 1 if size > maxZipFileSize { - return "", false, fmt.Errorf("file can't be bigger than %vM", maxZipFileSize/1024/1024) + return nil, false, fmt.Errorf("file can't be bigger than %vM", maxZipFileSize/1024/1024) } r, err := zip.NewReader(f, size) if err != nil { - return "", false, err + return nil, false, err } - var sqlBuffer strings.Builder - xmlContents := make([]string, len(r.File)) + + var xmlContents []xmlParser.XmlFiles for i := range r.File { srcFile := r.File[i] if srcFile == nil { @@ -293,52 +311,72 @@ func getSqlsFromZip(c echo.Context) (sqls string, exist bool, err error) { r, err := srcFile.Open() if err != nil { - return "", false, fmt.Errorf("open src file failed: %v", err) + return nil, false, fmt.Errorf("open src file failed: %v", err) } content, err := io.ReadAll(r) if err != nil { - return "", false, fmt.Errorf("read src file failed: %v", err) + return nil, false, fmt.Errorf("read src file failed: %v", err) } if strings.HasSuffix(srcFile.Name, ".xml") { - xmlContents[i] = string(content) + xmlContents = append(xmlContents, xmlParser.XmlFiles{ + FilePath: srcFile.Name, + Content: string(content), + }) } else if strings.HasSuffix(srcFile.Name, ".sql") { - if _, err = sqlBuffer.Write(content); err != nil { - return "", false, fmt.Errorf("gather sqls from sql file failed: %v", err) - } + sqls = append(sqls, SQLsFromFile{ + FilePath: srcFile.Name, + SQLs: string(content), + }) } } // parse xml content - ss, err := xmlParser.ParseXMLs(xmlContents, false) - if err != nil { - return "", false, fmt.Errorf("parse sqls from xml failed: %v", err) - } - for i := range ss { - if !strings.HasSuffix(sqlBuffer.String(), ";") { - if _, err = sqlBuffer.WriteString(";"); err != nil { - return "", false, fmt.Errorf("gather sqls from xml file failed: %v", err) - } + // xml文件需要把所有文件内容同时解析,否则会无法解析跨namespace引用的SQL + { + allStmtsFromXml, err := xmlParser.ParseXMLsWithFilePath(xmlContents, false) + if err != nil { + return nil, false, fmt.Errorf("parse sqls from xml failed: %v", err) } - if _, err = sqlBuffer.WriteString(ss[i]); err != nil { - return "", false, fmt.Errorf("gather sqls from xml file failed: %v", err) + for _, xmlContent := range xmlContents { + var sqlBuffer bytes.Buffer + ss, ok := allStmtsFromXml[xmlContent.FilePath] + if !ok { + continue + } + + for _, sql := range ss { + if sqlBuffer.String() != "" && !strings.HasSuffix(sqlBuffer.String(), ";") { + if _, err = sqlBuffer.WriteString(";"); err != nil { + return nil, false, fmt.Errorf("gather sqls from xml file failed: %v", err) + } + } + if _, err = sqlBuffer.WriteString(sql); err != nil { + return nil, false, fmt.Errorf("gather sqls from xml file failed: %v", err) + } + } + + sqls = append(sqls, SQLsFromFile{ + FilePath: xmlContent.FilePath, + SQLs: sqlBuffer.String(), + }) } } - return sqlBuffer.String(), true, nil + return sqls, true, nil } -func getSqlsFromGit(c echo.Context) (sqls string, exist bool, err error) { +func getSqlsFromGit(c echo.Context) (sqls []SQLsFromFile, exist bool, err error) { // make a temp dir and clean up befor return dir, err := os.MkdirTemp("./", "git-repo-") if err != nil { - return "", false, err + return nil, false, err } defer os.RemoveAll(dir) // read http url from form and check if it's a git url url := c.FormValue(GitHttpURL) if !utils.IsGitHttpURL(url) { - return "", false, errors.New(errors.DataInvalid, fmt.Errorf("url is not a git url")) + return nil, false, errors.New(errors.DataInvalid, fmt.Errorf("url is not a git url")) } cloneOpts := &goGit.CloneOptions{ URL: url, @@ -355,12 +393,13 @@ func getSqlsFromGit(c echo.Context) (sqls string, exist bool, err error) { // clone from git _, err = goGit.PlainCloneContext(c.Request().Context(), dir, false, cloneOpts) if err != nil { - return "", false, err + return nil, false, err } // traverse the repository, parse and put SQL into sqlBuffer - var sqlBuffer strings.Builder err = filepath.Walk(dir, func(path string, info fs.FileInfo, err error) error { if !info.IsDir() { + var sqlBuffer strings.Builder + var sqlsFromOneFile string switch { case strings.HasSuffix(path, ".xml"): content, err := os.ReadFile(path) @@ -385,18 +424,17 @@ func getSqlsFromGit(c echo.Context) (sqls string, exist bool, err error) { return fmt.Errorf("gather sqls from xml file failed: %v", err) } } + sqlsFromOneFile = sqlBuffer.String() case strings.HasSuffix(path, ".sql"): content, err := os.ReadFile(path) if err != nil { return nil } - _, err = sqlBuffer.Write(content) - if err != nil { - return fmt.Errorf("gather sqls from sql file failed: %v", err) - } + sqlsFromOneFile = string(content) case strings.HasSuffix(path, ".java"): sqls, err := javaParser.GetSqlFromJavaFile(path) if err != nil { + l.Errorf("skip file [%v]. because get sql from java file failed: %v", path, err) return nil } for _, sql := range sqls { @@ -408,14 +446,20 @@ func getSqlsFromGit(c echo.Context) (sqls string, exist bool, err error) { return fmt.Errorf("gather sqls from java file failed: %v", err) } } + sqlsFromOneFile = sqlBuffer.String() } + + sqls = append(sqls, SQLsFromFile{ + FilePath: path, + SQLs: sqlsFromOneFile, + }) } return nil }) if err != nil { - return "", false, err + return nil, false, err } - return sqlBuffer.String(), true, nil + return sqls, true, nil } type UpdateSQLAuditRecordReqV1 struct { diff --git a/sqle/api/controller/v1/task.go b/sqle/api/controller/v1/task.go index 5b19e54406..6b70a0f714 100644 --- a/sqle/api/controller/v1/task.go +++ b/sqle/api/controller/v1/task.go @@ -15,6 +15,7 @@ import ( "github.com/actiontech/sqle/sqle/api/controller" "github.com/actiontech/sqle/sqle/common" "github.com/actiontech/sqle/sqle/dms" + driverV2 "github.com/actiontech/sqle/sqle/driver/v2" "github.com/actiontech/sqle/sqle/errors" "github.com/actiontech/sqle/sqle/log" "github.com/actiontech/sqle/sqle/model" @@ -76,90 +77,59 @@ const ( GitPassword = "git_user_password" ) -func getSQLFromFile(c echo.Context) (string, string, error) { +func getSQLFromFile(c echo.Context) (getSQLFromFileResp, error) { // Read it from sql file. - sqls, exist, err := controller.ReadFileContent(c, InputSQLFileName) + sqlsFromSQLFile, exist, err := controller.ReadFileContent(c, InputSQLFileName) if err != nil { - return "", model.TaskSQLSourceFromSQLFile, err + return getSQLFromFileResp{}, err } if exist { - return sqls, model.TaskSQLSourceFromSQLFile, nil + return getSQLFromFileResp{ + SourceType: model.TaskSQLSourceFromSQLFile, + SQLs: []SQLsFromFile{{SQLs: sqlsFromSQLFile}}, + }, nil } // If sql_file is not exist, read it from mybatis xml file. data, exist, err := controller.ReadFileContent(c, InputMyBatisXMLFileName) if err != nil { - return "", model.TaskSQLSourceFromMyBatisXMLFile, err + return getSQLFromFileResp{}, err } if exist { sql, err := mybatis_parser.ParseXML(data) if err != nil { - return "", model.TaskSQLSourceFromMyBatisXMLFile, errors.New(errors.ParseMyBatisXMLFileError, err) + return getSQLFromFileResp{}, errors.New(errors.ParseMyBatisXMLFileError, err) } - return sql, model.TaskSQLSourceFromMyBatisXMLFile, nil + return getSQLFromFileResp{ + SourceType: model.TaskSQLSourceFromMyBatisXMLFile, + SQLs: []SQLsFromFile{{SQLs: sql}}, + }, nil } // If mybatis xml file is not exist, read it from zip file. - sqls, exist, err = getSqlsFromZip(c) + sqlsFromZip, exist, err := getSqlsFromZip(c) if err != nil { - return "", model.TaskSQLSourceFromZipFile, err + return getSQLFromFileResp{}, err } if exist { - return sqls, model.TaskSQLSourceFromZipFile, nil + return getSQLFromFileResp{ + SourceType: model.TaskSQLSourceFromZipFile, + SQLs: sqlsFromZip, + }, nil } // If zip file is not exist, read it from git repository - sqls, exist, err = getSqlsFromGit(c) + sqlsFromGit, exist, err := getSqlsFromGit(c) if err != nil { - return "", model.TaskSQLSourceFromGitRepository, err + return getSQLFromFileResp{}, err } if exist { - return sqls, model.TaskSQLSourceFromGitRepository, nil + return getSQLFromFileResp{ + SourceType: model.TaskSQLSourceFromGitRepository, + SQLs: sqlsFromGit, + }, nil } - return "", "", errors.New(errors.DataInvalid, fmt.Errorf("input sql is empty")) -} - -func GetSQLFromFile(c echo.Context) (string, string, error) { - // Read it from sql file. - sqls, exist, err := controller.ReadFileContent(c, InputSQLFileName) - if err != nil { - return "", model.TaskSQLSourceFromSQLFile, err - } - if exist { - return sqls, model.TaskSQLSourceFromSQLFile, nil - } - - // If sql_file is not exist, read it from mybatis xml file. - data, exist, err := controller.ReadFileContent(c, InputMyBatisXMLFileName) - if err != nil { - return "", model.TaskSQLSourceFromMyBatisXMLFile, err - } - if exist { - sql, err := mybatis_parser.ParseXML(data) - if err != nil { - return "", model.TaskSQLSourceFromMyBatisXMLFile, errors.New(errors.ParseMyBatisXMLFileError, err) - } - return sql, model.TaskSQLSourceFromMyBatisXMLFile, nil - } - - // If mybatis xml file is not exist, read it from zip file. - sqls, exist, err = getSqlsFromZip(c) - if err != nil { - return "", model.TaskSQLSourceFromZipFile, err - } - if exist { - return sqls, model.TaskSQLSourceFromZipFile, nil - } - - // If zip file is not exist, read it from git repository - sqls, exist, err = getSqlsFromGit(c) - if err != nil { - return "", model.TaskSQLSourceFromGitRepository, err - } - if exist { - return sqls, model.TaskSQLSourceFromGitRepository, nil - } - return "", "", errors.New(errors.DataInvalid, fmt.Errorf("input sql is empty")) + return getSQLFromFileResp{}, errors.New(errors.DataInvalid, fmt.Errorf("input sql is empty")) } // @Summary 创建Sql扫描任务并提交审核 @@ -186,14 +156,21 @@ func CreateAndAuditTask(c echo.Context) error { if err := controller.BindAndValidateReq(c, req); err != nil { return err } - var sql string - var source string + var sqls getSQLFromFileResp var err error if req.Sql != "" { - sql, source = req.Sql, model.TaskSQLSourceFromFormData + sqls = getSQLFromFileResp{ + SourceType: model.TaskSQLSourceFromFormData, + SQLs: []SQLsFromFile{ + { + FilePath: "", + SQLs: req.Sql, + }, + }, + } } else { - sql, source, err = GetSQLFromFile(c) + sqls, err = getSQLFromFile(c) if err != nil { return controller.JSONBaseErrorReq(c, err) } @@ -211,7 +188,7 @@ func CreateAndAuditTask(c echo.Context) error { return controller.JSONBaseErrorReq(c, err) } - task, err := buildOnlineTaskForAudit(c, s, uint64(user.ID), req.InstanceName, req.InstanceSchema, projectUid, source, sql) + task, err := buildOnlineTaskForAudit(c, s, uint64(user.ID), req.InstanceName, req.InstanceSchema, projectUid, sqls) if err != nil { return controller.JSONBaseErrorReq(c, err) } @@ -783,13 +760,19 @@ func AuditTaskGroupV1(c echo.Context) error { } var err error - var sql string - var source string - + var sqls getSQLFromFileResp if req.Sql != "" { - sql, source = req.Sql, model.TaskSQLSourceFromFormData + sqls = getSQLFromFileResp{ + SourceType: model.TaskSQLSourceFromFormData, + SQLs: []SQLsFromFile{ + { + FilePath: "", + SQLs: req.Sql, + }, + }, + } } else { - sql, source, err = GetSQLFromFile(c) + sqls, err = getSQLFromFile(c) if err != nil { return controller.JSONBaseErrorReq(c, err) } @@ -834,20 +817,29 @@ func AuditTaskGroupV1(c echo.Context) error { } defer plugin.Close(context.TODO()) - nodes, err := plugin.Parse(context.TODO(), sql) - if err != nil { - return controller.JSONBaseErrorReq(c, err) + allNodes := make(map[string][]driverV2.Node, len(sqls.SQLs)) + for _, sqlsFromOneFile := range sqls.SQLs { + nodes, err := plugin.Parse(context.TODO(), sqlsFromOneFile.SQLs) + if err != nil { + return controller.JSONBaseErrorReq(c, err) + } + allNodes[sqlsFromOneFile.FilePath] = nodes } for _, task := range tasks { - task.SQLSource = source - for j, node := range nodes { - task.ExecuteSQLs = append(task.ExecuteSQLs, &model.ExecuteSQL{ - BaseSQL: model.BaseSQL{ - Number: uint(j + 1), - Content: node.Text, - }, - }) + task.SQLSource = sqls.SourceType + num := 1 + for filePath, nodes := range allNodes { + for _, node := range nodes { + task.ExecuteSQLs = append(task.ExecuteSQLs, &model.ExecuteSQL{ + BaseSQL: model.BaseSQL{ + Number: uint(num), + Content: node.Text, + SourceFile: filePath, + }, + }) + num += 1 + } } } } diff --git a/sqle/api/controller/v2/task.go b/sqle/api/controller/v2/task.go index 2539445e20..2b02eb41de 100644 --- a/sqle/api/controller/v2/task.go +++ b/sqle/api/controller/v2/task.go @@ -98,14 +98,15 @@ func GetTaskSQLs(c echo.Context) error { taskSQLsRes := make([]*AuditTaskSQLResV2, 0, len(taskSQLs)) for _, taskSQL := range taskSQLs { taskSQLRes := &AuditTaskSQLResV2{ - Number: taskSQL.Number, - Description: taskSQL.Description, - ExecSQL: taskSQL.ExecSQL, - AuditLevel: taskSQL.AuditLevel, - AuditStatus: taskSQL.AuditStatus, - ExecResult: taskSQL.ExecResult, - ExecStatus: taskSQL.ExecStatus, - RollbackSQL: taskSQL.RollbackSQL.String, + Number: taskSQL.Number, + Description: taskSQL.Description, + ExecSQL: taskSQL.ExecSQL, + SQLSourceFile: taskSQL.SQLSourceFile.String, + AuditLevel: taskSQL.AuditLevel, + AuditStatus: taskSQL.AuditStatus, + ExecResult: taskSQL.ExecResult, + ExecStatus: taskSQL.ExecStatus, + RollbackSQL: taskSQL.RollbackSQL.String, } for i := range taskSQL.AuditResults { ar := taskSQL.AuditResults[i] diff --git a/sqle/model/task.go b/sqle/model/task.go index f1e5221c26..84ca78bd59 100644 --- a/sqle/model/task.go +++ b/sqle/model/task.go @@ -114,6 +114,7 @@ type BaseSQL struct { ExecStatus string `json:"exec_status" gorm:"default:\"initialized\""` ExecResult string `json:"exec_result" gorm:"type:text"` Schema string `json:"schema"` + SourceFile string `json:"source_file"` } func (s *BaseSQL) GetExecStatusDesc() string { @@ -434,15 +435,16 @@ func (s *Storage) GetTaskByInstanceId(instanceId uint64) ([]Task, error) { } type TaskSQLDetail struct { - Number uint `json:"number"` - Description string `json:"description"` - ExecSQL string `json:"exec_sql"` - AuditResults AuditResults `json:"audit_results"` - AuditLevel string `json:"audit_level"` - AuditStatus string `json:"audit_status"` - ExecResult string `json:"exec_result"` - ExecStatus string `json:"exec_status"` - RollbackSQL sql.NullString `json:"rollback_sql"` + Number uint `json:"number"` + Description string `json:"description"` + ExecSQL string `json:"exec_sql"` + SQLSourceFile sql.NullString `json:"sql_source_file"` + AuditResults AuditResults `json:"audit_results"` + AuditLevel string `json:"audit_level"` + AuditStatus string `json:"audit_status"` + ExecResult string `json:"exec_result"` + ExecStatus string `json:"exec_status"` + RollbackSQL sql.NullString `json:"rollback_sql"` } func (t *TaskSQLDetail) GetAuditResults() string { @@ -453,7 +455,7 @@ func (t *TaskSQLDetail) GetAuditResults() string { return t.AuditResults.String() } -var taskSQLsQueryTpl = `SELECT e_sql.number, e_sql.description, e_sql.content AS exec_sql, r_sql.content AS rollback_sql, +var taskSQLsQueryTpl = `SELECT e_sql.number, e_sql.description, e_sql.content AS exec_sql, e_sql.source_file AS sql_source_file, r_sql.content AS rollback_sql, e_sql.audit_results, e_sql.audit_level, e_sql.audit_status, e_sql.exec_result, e_sql.exec_status {{- template "body" . -}} From c28d66340539af8e9c90620bfd9edaeb030a15d6 Mon Sep 17 00:00:00 2001 From: luowei Date: Thu, 23 Nov 2023 17:37:30 +0800 Subject: [PATCH 02/10] relate xml in different namespace when audit git repository --- sqle/api/controller/v1/sql_audit_record.go | 98 ++++++++++++---------- 1 file changed, 55 insertions(+), 43 deletions(-) diff --git a/sqle/api/controller/v1/sql_audit_record.go b/sqle/api/controller/v1/sql_audit_record.go index f5c5c76a4e..cebb0af84b 100644 --- a/sqle/api/controller/v1/sql_audit_record.go +++ b/sqle/api/controller/v1/sql_audit_record.go @@ -334,36 +334,47 @@ func getSqlsFromZip(c echo.Context) (sqls []SQLsFromFile, exist bool, err error) // parse xml content // xml文件需要把所有文件内容同时解析,否则会无法解析跨namespace引用的SQL { - allStmtsFromXml, err := xmlParser.ParseXMLsWithFilePath(xmlContents, false) + sqlsFromXmls, err := parseXMLsWithFilePath(xmlContents) if err != nil { - return nil, false, fmt.Errorf("parse sqls from xml failed: %v", err) + return nil, false, err } - for _, xmlContent := range xmlContents { - var sqlBuffer bytes.Buffer - ss, ok := allStmtsFromXml[xmlContent.FilePath] - if !ok { - continue - } + sqls = append(sqls, sqlsFromXmls...) + } - for _, sql := range ss { - if sqlBuffer.String() != "" && !strings.HasSuffix(sqlBuffer.String(), ";") { - if _, err = sqlBuffer.WriteString(";"); err != nil { - return nil, false, fmt.Errorf("gather sqls from xml file failed: %v", err) - } - } - if _, err = sqlBuffer.WriteString(sql); err != nil { - return nil, false, fmt.Errorf("gather sqls from xml file failed: %v", err) + return sqls, true, nil +} + +func parseXMLsWithFilePath(xmlContents []xmlParser.XmlFiles) ([]SQLsFromFile, error) { + allStmtsFromXml, err := xmlParser.ParseXMLsWithFilePath(xmlContents, false) + if err != nil { + return nil, fmt.Errorf("parse sqls from xml failed: %v", err) + } + + var sqls []SQLsFromFile + for _, xmlContent := range xmlContents { + var sqlBuffer bytes.Buffer + ss, ok := allStmtsFromXml[xmlContent.FilePath] + if !ok { + continue + } + + for _, sql := range ss { + if sqlBuffer.String() != "" && !strings.HasSuffix(sqlBuffer.String(), ";") { + if _, err = sqlBuffer.WriteString(";"); err != nil { + return nil, fmt.Errorf("gather sqls from xml file failed: %v", err) } } - - sqls = append(sqls, SQLsFromFile{ - FilePath: xmlContent.FilePath, - SQLs: sqlBuffer.String(), - }) + if _, err = sqlBuffer.WriteString(sql); err != nil { + return nil, fmt.Errorf("gather sqls from xml file failed: %v", err) + } } - } - return sqls, true, nil + sqls = append(sqls, SQLsFromFile{ + FilePath: xmlContent.FilePath, + SQLs: sqlBuffer.String(), + }) + } + return sqls, nil } func getSqlsFromGit(c echo.Context) (sqls []SQLsFromFile, exist bool, err error) { @@ -395,8 +406,11 @@ func getSqlsFromGit(c echo.Context) (sqls []SQLsFromFile, exist bool, err error) if err != nil { return nil, false, err } + l := log.NewEntry().WithField("function", "getSqlsFromGit") + var xmlContents []xmlParser.XmlFiles // traverse the repository, parse and put SQL into sqlBuffer err = filepath.Walk(dir, func(path string, info fs.FileInfo, err error) error { + gitPath := strings.TrimPrefix(path, strings.TrimPrefix(dir, "./")) if !info.IsDir() { var sqlBuffer strings.Builder var sqlsFromOneFile string @@ -404,30 +418,17 @@ func getSqlsFromGit(c echo.Context) (sqls []SQLsFromFile, exist bool, err error) case strings.HasSuffix(path, ".xml"): content, err := os.ReadFile(path) if err != nil { + l.Errorf("skip file [%v]. because read file failed: %v", path, err) return nil } - ss, err := xmlParser.ParseXMLs([]string{string(content)}, false) - if err != nil { - return nil - } - if len(ss) == 0 { - return nil - } - if sqlBuffer.Len() > 0 && !strings.HasSuffix(sqlBuffer.String(), ";") { - if _, err = sqlBuffer.WriteString(";"); err != nil { - return fmt.Errorf("gather sqls from xml file failed: %v", err) - } - } - for i := range ss { - _, err = sqlBuffer.WriteString(ss[i] + ";") - if err != nil { - return fmt.Errorf("gather sqls from xml file failed: %v", err) - } - } - sqlsFromOneFile = sqlBuffer.String() + xmlContents = append(xmlContents, xmlParser.XmlFiles{ + FilePath: gitPath, + Content: string(content), + }) case strings.HasSuffix(path, ".sql"): content, err := os.ReadFile(path) if err != nil { + l.Errorf("skip file [%v]. because read file failed: %v", path, err) return nil } sqlsFromOneFile = string(content) @@ -450,7 +451,7 @@ func getSqlsFromGit(c echo.Context) (sqls []SQLsFromFile, exist bool, err error) } sqls = append(sqls, SQLsFromFile{ - FilePath: path, + FilePath: gitPath, SQLs: sqlsFromOneFile, }) } @@ -459,6 +460,17 @@ func getSqlsFromGit(c echo.Context) (sqls []SQLsFromFile, exist bool, err error) if err != nil { return nil, false, err } + + // parse xml content + // xml文件需要把所有文件内容同时解析,否则会无法解析跨namespace引用的SQL + { + sqlsFromXmls, err := parseXMLsWithFilePath(xmlContents) + if err != nil { + return nil, false, err + } + sqls = append(sqls, sqlsFromXmls...) + } + return sqls, true, nil } From e8b80a8fccc321096dcf0fd310bf92bfa140652c Mon Sep 17 00:00:00 2001 From: luowei Date: Tue, 28 Nov 2023 11:24:02 +0800 Subject: [PATCH 03/10] update function usage --- sqle/api/controller/v1/sql_audit_record.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/sqle/api/controller/v1/sql_audit_record.go b/sqle/api/controller/v1/sql_audit_record.go index cebb0af84b..d9388e6f44 100644 --- a/sqle/api/controller/v1/sql_audit_record.go +++ b/sqle/api/controller/v1/sql_audit_record.go @@ -17,6 +17,7 @@ import ( javaParser "github.com/actiontech/java-sql-extractor/parser" xmlParser "github.com/actiontech/mybatis-mapper-2-sql" + xmlAst "github.com/actiontech/mybatis-mapper-2-sql/ast" "github.com/actiontech/sqle/sqle/api/controller" "github.com/actiontech/sqle/sqle/common" "github.com/actiontech/sqle/sqle/dms" @@ -345,6 +346,16 @@ func getSqlsFromZip(c echo.Context) (sqls []SQLsFromFile, exist bool, err error) } func parseXMLsWithFilePath(xmlContents []xmlParser.XmlFiles) ([]SQLsFromFile, error) { + getSQLsByFilePath := func(filePath string, stmtsInfo []xmlAst.StmtsInfo) []string { + for _, info := range stmtsInfo { + if info.FilePath != filePath { + continue + } + return info.SQLs + } + return nil + } + allStmtsFromXml, err := xmlParser.ParseXMLsWithFilePath(xmlContents, false) if err != nil { return nil, fmt.Errorf("parse sqls from xml failed: %v", err) @@ -353,8 +364,8 @@ func parseXMLsWithFilePath(xmlContents []xmlParser.XmlFiles) ([]SQLsFromFile, er var sqls []SQLsFromFile for _, xmlContent := range xmlContents { var sqlBuffer bytes.Buffer - ss, ok := allStmtsFromXml[xmlContent.FilePath] - if !ok { + ss := getSQLsByFilePath(xmlContent.FilePath, allStmtsFromXml) + if ss == nil { continue } From 4ecab778576f0e2054b1bac12a358f9904a9c724 Mon Sep 17 00:00:00 2001 From: luowei Date: Tue, 28 Nov 2023 11:31:12 +0800 Subject: [PATCH 04/10] fix lint --- sqle/api/controller/v1/sql_audit_record.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqle/api/controller/v1/sql_audit_record.go b/sqle/api/controller/v1/sql_audit_record.go index d9388e6f44..bcc2660c9c 100644 --- a/sqle/api/controller/v1/sql_audit_record.go +++ b/sqle/api/controller/v1/sql_audit_record.go @@ -361,7 +361,7 @@ func parseXMLsWithFilePath(xmlContents []xmlParser.XmlFiles) ([]SQLsFromFile, er return nil, fmt.Errorf("parse sqls from xml failed: %v", err) } - var sqls []SQLsFromFile + sqls := []SQLsFromFile{} for _, xmlContent := range xmlContents { var sqlBuffer bytes.Buffer ss := getSQLsByFilePath(xmlContent.FilePath, allStmtsFromXml) From b021bdfd013172437a692c6e52a7ff528cd77dba Mon Sep 17 00:00:00 2001 From: luowei Date: Tue, 5 Dec 2023 13:18:14 +0800 Subject: [PATCH 05/10] update parser --- sqle/api/controller/v1/sql_audit.go | 14 +++++++++-- sqle/api/controller/v1/sql_audit_record.go | 27 +++++++++++----------- sqle/api/controller/v2/sql_audit.go | 14 +++++++++-- 3 files changed, 38 insertions(+), 17 deletions(-) diff --git a/sqle/api/controller/v1/sql_audit.go b/sqle/api/controller/v1/sql_audit.go index a041054b7b..714511d3f7 100644 --- a/sqle/api/controller/v1/sql_audit.go +++ b/sqle/api/controller/v1/sql_audit.go @@ -1,6 +1,7 @@ package v1 import ( + "bytes" "context" e "errors" "fmt" @@ -194,11 +195,20 @@ func DirectAuditFiles(c echo.Context) error { sqls := "" if req.SQLType == SQLTypeMyBatis { - ss, err := parser.ParseXMLs(req.FileContents, false) + data := make([]parser.XmlFile, len(req.FileContents)) + for i, content := range req.FileContents { + data[i] = parser.XmlFile{Content: content} + } + sqlsInfo, err := parser.ParseXMLs(data, false) if err != nil { return controller.JSONBaseErrorReq(c, err) } - sqls = strings.Join(ss, ";") + buf := bytes.Buffer{} + for _, info := range sqlsInfo { + buf.WriteString(info.SQL) + buf.WriteString(";") + } + sqls = strings.TrimSuffix(buf.String(), ";") } else { // sql文件暂时只支持一次解析一个文件 sqls = req.FileContents[0] diff --git a/sqle/api/controller/v1/sql_audit_record.go b/sqle/api/controller/v1/sql_audit_record.go index bcc2660c9c..97e1d9d32f 100644 --- a/sqle/api/controller/v1/sql_audit_record.go +++ b/sqle/api/controller/v1/sql_audit_record.go @@ -300,7 +300,7 @@ func getSqlsFromZip(c echo.Context) (sqls []SQLsFromFile, exist bool, err error) return nil, false, err } - var xmlContents []xmlParser.XmlFiles + var xmlContents []xmlParser.XmlFile for i := range r.File { srcFile := r.File[i] if srcFile == nil { @@ -320,7 +320,7 @@ func getSqlsFromZip(c echo.Context) (sqls []SQLsFromFile, exist bool, err error) } if strings.HasSuffix(srcFile.Name, ".xml") { - xmlContents = append(xmlContents, xmlParser.XmlFiles{ + xmlContents = append(xmlContents, xmlParser.XmlFile{ FilePath: srcFile.Name, Content: string(content), }) @@ -345,18 +345,19 @@ func getSqlsFromZip(c echo.Context) (sqls []SQLsFromFile, exist bool, err error) return sqls, true, nil } -func parseXMLsWithFilePath(xmlContents []xmlParser.XmlFiles) ([]SQLsFromFile, error) { - getSQLsByFilePath := func(filePath string, stmtsInfo []xmlAst.StmtsInfo) []string { - for _, info := range stmtsInfo { - if info.FilePath != filePath { - continue - } - return info.SQLs +func getSQLsByFilePath(filePath string, stmtsInfo []xmlAst.StmtInfo) []string { + sqls := []string{} + for _, info := range stmtsInfo { + if info.FilePath != filePath { + continue } - return nil + sqls = append(sqls, info.SQL) } + return sqls +} - allStmtsFromXml, err := xmlParser.ParseXMLsWithFilePath(xmlContents, false) +func parseXMLsWithFilePath(xmlContents []xmlParser.XmlFile) ([]SQLsFromFile, error) { + allStmtsFromXml, err := xmlParser.ParseXMLs(xmlContents, false) if err != nil { return nil, fmt.Errorf("parse sqls from xml failed: %v", err) } @@ -418,7 +419,7 @@ func getSqlsFromGit(c echo.Context) (sqls []SQLsFromFile, exist bool, err error) return nil, false, err } l := log.NewEntry().WithField("function", "getSqlsFromGit") - var xmlContents []xmlParser.XmlFiles + var xmlContents []xmlParser.XmlFile // traverse the repository, parse and put SQL into sqlBuffer err = filepath.Walk(dir, func(path string, info fs.FileInfo, err error) error { gitPath := strings.TrimPrefix(path, strings.TrimPrefix(dir, "./")) @@ -432,7 +433,7 @@ func getSqlsFromGit(c echo.Context) (sqls []SQLsFromFile, exist bool, err error) l.Errorf("skip file [%v]. because read file failed: %v", path, err) return nil } - xmlContents = append(xmlContents, xmlParser.XmlFiles{ + xmlContents = append(xmlContents, xmlParser.XmlFile{ FilePath: gitPath, Content: string(content), }) diff --git a/sqle/api/controller/v2/sql_audit.go b/sqle/api/controller/v2/sql_audit.go index 7823c77d5f..b43cd23d8b 100644 --- a/sqle/api/controller/v2/sql_audit.go +++ b/sqle/api/controller/v2/sql_audit.go @@ -1,6 +1,7 @@ package v2 import ( + "bytes" e "errors" "net/http" "strings" @@ -156,11 +157,20 @@ func DirectAuditFiles(c echo.Context) error { sqls := "" if req.SQLType == v1.SQLTypeMyBatis { - ss, err := parser.ParseXMLs(req.FileContents, false) + data := make([]parser.XmlFile, len(req.FileContents)) + for i, content := range req.FileContents { + data[i] = parser.XmlFile{Content: content} + } + sqlsInfo, err := parser.ParseXMLs(data, false) if err != nil { return controller.JSONBaseErrorReq(c, err) } - sqls = strings.Join(ss, ";") + buf := bytes.Buffer{} + for _, info := range sqlsInfo { + buf.WriteString(info.SQL) + buf.WriteString(";") + } + sqls = strings.TrimSuffix(buf.String(), ";") } else { // sql文件暂时只支持一次解析一个文件 sqls = req.FileContents[0] From 17cb344c5451ebd996634548d1b4cea47cbe04f7 Mon Sep 17 00:00:00 2001 From: luowei Date: Tue, 5 Dec 2023 16:27:55 +0800 Subject: [PATCH 06/10] update parser package --- go.mod | 5 +- go.sum | 32 +- vendor/github.com/99designs/gqlgen/LICENSE | 19 - .../99designs/gqlgen/api/generate.go | 139 - .../github.com/99designs/gqlgen/api/option.go | 47 - .../99designs/gqlgen/codegen/args.go | 122 - .../99designs/gqlgen/codegen/args.gotpl | 36 - .../99designs/gqlgen/codegen/complexity.go | 11 - .../99designs/gqlgen/codegen/config/binder.go | 493 - .../99designs/gqlgen/codegen/config/config.go | 656 - .../99designs/gqlgen/codegen/config/exec.go | 97 - .../gqlgen/codegen/config/package.go | 63 - .../gqlgen/codegen/config/resolver.go | 100 - .../99designs/gqlgen/codegen/data.go | 233 - .../99designs/gqlgen/codegen/directive.go | 174 - .../99designs/gqlgen/codegen/directives.gotpl | 149 - .../99designs/gqlgen/codegen/field.go | 580 - .../99designs/gqlgen/codegen/field.gotpl | 158 - .../99designs/gqlgen/codegen/generate.go | 220 - .../99designs/gqlgen/codegen/generated!.gotpl | 258 - .../99designs/gqlgen/codegen/input.gotpl | 77 - .../99designs/gqlgen/codegen/interface.go | 87 - .../99designs/gqlgen/codegen/interface.gotpl | 21 - .../99designs/gqlgen/codegen/object.go | 171 - .../99designs/gqlgen/codegen/object.gotpl | 112 - .../99designs/gqlgen/codegen/root_.gotpl | 230 - .../gqlgen/codegen/templates/import.go | 139 - .../gqlgen/codegen/templates/templates.go | 740 - .../gqlgen/codegen/templates/test.gotpl | 1 - .../gqlgen/codegen/templates/test_.gotpl | 1 - .../99designs/gqlgen/codegen/type.go | 32 - .../99designs/gqlgen/codegen/type.gotpl | 192 - .../99designs/gqlgen/codegen/util.go | 46 - .../99designs/gqlgen/graphql/any.go | 19 - .../99designs/gqlgen/graphql/bool.go | 27 - .../99designs/gqlgen/graphql/cache.go | 29 - .../99designs/gqlgen/graphql/coercion.go | 56 - .../99designs/gqlgen/graphql/context_field.go | 113 - .../gqlgen/graphql/context_operation.go | 117 - .../99designs/gqlgen/graphql/context_path.go | 77 - .../gqlgen/graphql/context_response.go | 153 - .../gqlgen/graphql/context_root_field.go | 25 - .../99designs/gqlgen/graphql/error.go | 33 - .../gqlgen/graphql/executable_schema.go | 167 - .../gqlgen/graphql/executable_schema_mock.go | 172 - .../99designs/gqlgen/graphql/fieldset.go | 63 - .../99designs/gqlgen/graphql/float.go | 47 - .../99designs/gqlgen/graphql/handler.go | 131 - .../github.com/99designs/gqlgen/graphql/id.go | 58 - .../99designs/gqlgen/graphql/input.go | 55 - .../99designs/gqlgen/graphql/int.go | 79 - .../graphql/introspection/introspection.go | 101 - .../gqlgen/graphql/introspection/query.go | 106 - .../gqlgen/graphql/introspection/schema.go | 93 - .../gqlgen/graphql/introspection/type.go | 191 - .../99designs/gqlgen/graphql/jsonw.go | 93 - .../99designs/gqlgen/graphql/map.go | 24 - .../99designs/gqlgen/graphql/oneshot.go | 16 - .../99designs/gqlgen/graphql/recovery.go | 20 - .../99designs/gqlgen/graphql/response.go | 24 - .../99designs/gqlgen/graphql/root.go | 7 - .../99designs/gqlgen/graphql/stats.go | 60 - .../99designs/gqlgen/graphql/string.go | 70 - .../99designs/gqlgen/graphql/time.go | 25 - .../99designs/gqlgen/graphql/uint.go | 81 - .../99designs/gqlgen/graphql/upload.go | 27 - .../99designs/gqlgen/graphql/version.go | 3 - .../99designs/gqlgen/internal/code/compare.go | 161 - .../99designs/gqlgen/internal/code/imports.go | 174 - .../gqlgen/internal/code/packages.go | 223 - .../99designs/gqlgen/internal/code/util.go | 61 - .../gqlgen/internal/imports/prune.go | 100 - .../gqlgen/internal/rewrite/rewriter.go | 226 - .../gqlgen/plugin/federation/federation.go | 424 - .../gqlgen/plugin/federation/federation.gotpl | 259 - .../plugin/federation/fieldset/fieldset.go | 181 - .../gqlgen/plugin/federation/readme.md | 39 - .../gqlgen/plugin/modelgen/models.go | 470 - .../gqlgen/plugin/modelgen/models.gotpl | 102 - .../99designs/gqlgen/plugin/plugin.go | 31 - .../gqlgen/plugin/resolvergen/resolver.go | 227 - .../gqlgen/plugin/resolvergen/resolver.gotpl | 46 - .../mybatis-mapper-2-sql/ast/mapper.go | 1 + .../mybatis-mapper-2-sql/ast/mappers.go | 16 +- .../actiontech/mybatis-mapper-2-sql/parser.go | 14 +- .../agnivade/levenshtein/.gitignore | 5 - .../agnivade/levenshtein/.travis.yml | 23 - .../agnivade/levenshtein/License.txt | 21 - .../github.com/agnivade/levenshtein/Makefile | 15 - .../github.com/agnivade/levenshtein/README.md | 80 - .../agnivade/levenshtein/levenshtein.go | 89 - .../github.com/vektah/gqlparser/v2/.gitignore | 5 - vendor/github.com/vektah/gqlparser/v2/LICENSE | 19 - .../vektah/gqlparser/v2/ast/argmap.go | 37 - .../vektah/gqlparser/v2/ast/collections.go | 148 - .../vektah/gqlparser/v2/ast/decode.go | 216 - .../vektah/gqlparser/v2/ast/definition.go | 94 - .../vektah/gqlparser/v2/ast/directive.go | 43 - .../vektah/gqlparser/v2/ast/document.go | 79 - .../vektah/gqlparser/v2/ast/dumper.go | 159 - .../vektah/gqlparser/v2/ast/fragment.go | 38 - .../vektah/gqlparser/v2/ast/operation.go | 30 - .../vektah/gqlparser/v2/ast/path.go | 67 - .../vektah/gqlparser/v2/ast/selection.go | 39 - .../vektah/gqlparser/v2/ast/source.go | 19 - .../vektah/gqlparser/v2/ast/type.go | 68 - .../vektah/gqlparser/v2/ast/value.go | 120 - .../vektah/gqlparser/v2/gqlerror/error.go | 145 - .../vektah/gqlparser/v2/gqlparser.go | 43 - .../vektah/gqlparser/v2/lexer/blockstring.go | 58 - .../vektah/gqlparser/v2/lexer/lexer.go | 515 - .../vektah/gqlparser/v2/lexer/lexer_test.yml | 692 - .../vektah/gqlparser/v2/lexer/token.go | 148 - .../vektah/gqlparser/v2/parser/parser.go | 136 - .../vektah/gqlparser/v2/parser/query.go | 348 - .../vektah/gqlparser/v2/parser/query_test.yml | 544 - .../vektah/gqlparser/v2/parser/schema.go | 534 - .../gqlparser/v2/parser/schema_test.yml | 646 - .../github.com/vektah/gqlparser/v2/readme.md | 17 - .../vektah/gqlparser/v2/validator/error.go | 55 - .../gqlparser/v2/validator/messaging.go | 39 - .../vektah/gqlparser/v2/validator/prelude.go | 15 - .../gqlparser/v2/validator/prelude.graphql | 121 - .../validator/rules/fields_on_correct_type.go | 94 - .../rules/fragments_on_composite_types.go | 39 - .../validator/rules/known_argument_names.go | 57 - .../v2/validator/rules/known_directives.go | 47 - .../validator/rules/known_fragment_names.go | 19 - .../v2/validator/rules/known_root_type.go | 35 - .../v2/validator/rules/known_type_names.go | 59 - .../rules/lone_anonymous_operation.go | 19 - .../v2/validator/rules/no_fragment_cycles.go | 93 - .../validator/rules/no_undefined_variables.go | 28 - .../v2/validator/rules/no_unused_fragments.go | 30 - .../v2/validator/rules/no_unused_variables.go | 30 - .../rules/overlapping_fields_can_be_merged.go | 560 - .../rules/possible_fragment_spreads.go | 68 - .../rules/provided_required_arguments.go | 62 - .../v2/validator/rules/scalar_leafs.go | 36 - .../rules/single_field_subscriptions.go | 86 - .../validator/rules/unique_argument_names.go | 33 - .../rules/unique_directives_per_location.go | 24 - .../validator/rules/unique_fragment_names.go | 22 - .../rules/unique_input_field_names.go | 27 - .../validator/rules/unique_operation_names.go | 22 - .../validator/rules/unique_variable_names.go | 24 - .../validator/rules/values_of_correct_type.go | 168 - .../rules/variables_are_input_types.go | 28 - .../rules/variables_in_allowed_position.go | 38 - .../vektah/gqlparser/v2/validator/schema.go | 512 - .../gqlparser/v2/validator/schema_test.yml | 678 - .../gqlparser/v2/validator/suggestionList.go | 69 - .../gqlparser/v2/validator/validator.go | 44 - .../vektah/gqlparser/v2/validator/vars.go | 258 - .../vektah/gqlparser/v2/validator/walk.go | 292 - .../x/mod/internal/lazyregexp/lazyre.go | 78 - vendor/golang.org/x/mod/module/module.go | 841 -- vendor/golang.org/x/mod/module/pseudo.go | 250 - vendor/golang.org/x/tools/imports/forward.go | 77 - .../x/tools/internal/fastwalk/fastwalk.go | 196 - .../internal/fastwalk/fastwalk_darwin.go | 119 - .../fastwalk/fastwalk_dirent_fileno.go | 14 - .../internal/fastwalk/fastwalk_dirent_ino.go | 15 - .../fastwalk/fastwalk_dirent_namlen_bsd.go | 14 - .../fastwalk/fastwalk_dirent_namlen_linux.go | 29 - .../internal/fastwalk/fastwalk_portable.go | 38 - .../tools/internal/fastwalk/fastwalk_unix.go | 153 - .../x/tools/internal/gopathwalk/walk.go | 260 - .../x/tools/internal/imports/fix.go | 1766 --- .../x/tools/internal/imports/imports.go | 356 - .../x/tools/internal/imports/mod.go | 724 - .../x/tools/internal/imports/mod_cache.go | 236 - .../x/tools/internal/imports/sortimports.go | 297 - .../x/tools/internal/imports/zstdlib.go | 11345 ---------------- vendor/modules.txt | 36 +- 175 files changed, 28 insertions(+), 36445 deletions(-) delete mode 100644 vendor/github.com/99designs/gqlgen/LICENSE delete mode 100644 vendor/github.com/99designs/gqlgen/api/generate.go delete mode 100644 vendor/github.com/99designs/gqlgen/api/option.go delete mode 100644 vendor/github.com/99designs/gqlgen/codegen/args.go delete mode 100644 vendor/github.com/99designs/gqlgen/codegen/args.gotpl delete mode 100644 vendor/github.com/99designs/gqlgen/codegen/complexity.go delete mode 100644 vendor/github.com/99designs/gqlgen/codegen/config/binder.go delete mode 100644 vendor/github.com/99designs/gqlgen/codegen/config/config.go delete mode 100644 vendor/github.com/99designs/gqlgen/codegen/config/exec.go delete mode 100644 vendor/github.com/99designs/gqlgen/codegen/config/package.go delete mode 100644 vendor/github.com/99designs/gqlgen/codegen/config/resolver.go delete mode 100644 vendor/github.com/99designs/gqlgen/codegen/data.go delete mode 100644 vendor/github.com/99designs/gqlgen/codegen/directive.go delete mode 100644 vendor/github.com/99designs/gqlgen/codegen/directives.gotpl delete mode 100644 vendor/github.com/99designs/gqlgen/codegen/field.go delete mode 100644 vendor/github.com/99designs/gqlgen/codegen/field.gotpl delete mode 100644 vendor/github.com/99designs/gqlgen/codegen/generate.go delete mode 100644 vendor/github.com/99designs/gqlgen/codegen/generated!.gotpl delete mode 100644 vendor/github.com/99designs/gqlgen/codegen/input.gotpl delete mode 100644 vendor/github.com/99designs/gqlgen/codegen/interface.go delete mode 100644 vendor/github.com/99designs/gqlgen/codegen/interface.gotpl delete mode 100644 vendor/github.com/99designs/gqlgen/codegen/object.go delete mode 100644 vendor/github.com/99designs/gqlgen/codegen/object.gotpl delete mode 100644 vendor/github.com/99designs/gqlgen/codegen/root_.gotpl delete mode 100644 vendor/github.com/99designs/gqlgen/codegen/templates/import.go delete mode 100644 vendor/github.com/99designs/gqlgen/codegen/templates/templates.go delete mode 100644 vendor/github.com/99designs/gqlgen/codegen/templates/test.gotpl delete mode 100644 vendor/github.com/99designs/gqlgen/codegen/templates/test_.gotpl delete mode 100644 vendor/github.com/99designs/gqlgen/codegen/type.go delete mode 100644 vendor/github.com/99designs/gqlgen/codegen/type.gotpl delete mode 100644 vendor/github.com/99designs/gqlgen/codegen/util.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/any.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/bool.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/cache.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/coercion.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/context_field.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/context_operation.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/context_path.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/context_response.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/context_root_field.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/error.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/executable_schema.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/executable_schema_mock.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/fieldset.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/float.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/handler.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/id.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/input.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/int.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/introspection/introspection.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/introspection/query.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/introspection/schema.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/introspection/type.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/jsonw.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/map.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/oneshot.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/recovery.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/response.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/root.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/stats.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/string.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/time.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/uint.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/upload.go delete mode 100644 vendor/github.com/99designs/gqlgen/graphql/version.go delete mode 100644 vendor/github.com/99designs/gqlgen/internal/code/compare.go delete mode 100644 vendor/github.com/99designs/gqlgen/internal/code/imports.go delete mode 100644 vendor/github.com/99designs/gqlgen/internal/code/packages.go delete mode 100644 vendor/github.com/99designs/gqlgen/internal/code/util.go delete mode 100644 vendor/github.com/99designs/gqlgen/internal/imports/prune.go delete mode 100644 vendor/github.com/99designs/gqlgen/internal/rewrite/rewriter.go delete mode 100644 vendor/github.com/99designs/gqlgen/plugin/federation/federation.go delete mode 100644 vendor/github.com/99designs/gqlgen/plugin/federation/federation.gotpl delete mode 100644 vendor/github.com/99designs/gqlgen/plugin/federation/fieldset/fieldset.go delete mode 100644 vendor/github.com/99designs/gqlgen/plugin/federation/readme.md delete mode 100644 vendor/github.com/99designs/gqlgen/plugin/modelgen/models.go delete mode 100644 vendor/github.com/99designs/gqlgen/plugin/modelgen/models.gotpl delete mode 100644 vendor/github.com/99designs/gqlgen/plugin/plugin.go delete mode 100644 vendor/github.com/99designs/gqlgen/plugin/resolvergen/resolver.go delete mode 100644 vendor/github.com/99designs/gqlgen/plugin/resolvergen/resolver.gotpl delete mode 100644 vendor/github.com/agnivade/levenshtein/.gitignore delete mode 100644 vendor/github.com/agnivade/levenshtein/.travis.yml delete mode 100644 vendor/github.com/agnivade/levenshtein/License.txt delete mode 100644 vendor/github.com/agnivade/levenshtein/Makefile delete mode 100644 vendor/github.com/agnivade/levenshtein/README.md delete mode 100644 vendor/github.com/agnivade/levenshtein/levenshtein.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/.gitignore delete mode 100644 vendor/github.com/vektah/gqlparser/v2/LICENSE delete mode 100644 vendor/github.com/vektah/gqlparser/v2/ast/argmap.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/ast/collections.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/ast/decode.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/ast/definition.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/ast/directive.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/ast/document.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/ast/dumper.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/ast/fragment.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/ast/operation.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/ast/path.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/ast/selection.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/ast/source.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/ast/type.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/ast/value.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/gqlerror/error.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/gqlparser.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/lexer/blockstring.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/lexer/lexer.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/lexer/lexer_test.yml delete mode 100644 vendor/github.com/vektah/gqlparser/v2/lexer/token.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/parser/parser.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/parser/query.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/parser/query_test.yml delete mode 100644 vendor/github.com/vektah/gqlparser/v2/parser/schema.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/parser/schema_test.yml delete mode 100644 vendor/github.com/vektah/gqlparser/v2/readme.md delete mode 100644 vendor/github.com/vektah/gqlparser/v2/validator/error.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/validator/messaging.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/validator/prelude.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/validator/prelude.graphql delete mode 100644 vendor/github.com/vektah/gqlparser/v2/validator/rules/fields_on_correct_type.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/validator/rules/fragments_on_composite_types.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/validator/rules/known_argument_names.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/validator/rules/known_directives.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/validator/rules/known_fragment_names.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/validator/rules/known_root_type.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/validator/rules/known_type_names.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/validator/rules/lone_anonymous_operation.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/validator/rules/no_fragment_cycles.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/validator/rules/no_undefined_variables.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/validator/rules/no_unused_fragments.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/validator/rules/no_unused_variables.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/validator/rules/overlapping_fields_can_be_merged.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/validator/rules/possible_fragment_spreads.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/validator/rules/provided_required_arguments.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/validator/rules/scalar_leafs.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/validator/rules/single_field_subscriptions.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/validator/rules/unique_argument_names.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/validator/rules/unique_directives_per_location.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/validator/rules/unique_fragment_names.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/validator/rules/unique_input_field_names.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/validator/rules/unique_operation_names.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/validator/rules/unique_variable_names.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/validator/rules/values_of_correct_type.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/validator/rules/variables_are_input_types.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/validator/rules/variables_in_allowed_position.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/validator/schema.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/validator/schema_test.yml delete mode 100644 vendor/github.com/vektah/gqlparser/v2/validator/suggestionList.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/validator/validator.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/validator/vars.go delete mode 100644 vendor/github.com/vektah/gqlparser/v2/validator/walk.go delete mode 100644 vendor/golang.org/x/mod/internal/lazyregexp/lazyre.go delete mode 100644 vendor/golang.org/x/mod/module/module.go delete mode 100644 vendor/golang.org/x/mod/module/pseudo.go delete mode 100644 vendor/golang.org/x/tools/imports/forward.go delete mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk.go delete mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk_darwin.go delete mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_fileno.go delete mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_ino.go delete mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_bsd.go delete mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_linux.go delete mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk_portable.go delete mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk_unix.go delete mode 100644 vendor/golang.org/x/tools/internal/gopathwalk/walk.go delete mode 100644 vendor/golang.org/x/tools/internal/imports/fix.go delete mode 100644 vendor/golang.org/x/tools/internal/imports/imports.go delete mode 100644 vendor/golang.org/x/tools/internal/imports/mod.go delete mode 100644 vendor/golang.org/x/tools/internal/imports/mod_cache.go delete mode 100644 vendor/golang.org/x/tools/internal/imports/sortimports.go delete mode 100644 vendor/golang.org/x/tools/internal/imports/zstdlib.go diff --git a/go.mod b/go.mod index eebdd458d6..f5a3708a80 100644 --- a/go.mod +++ b/go.mod @@ -3,12 +3,11 @@ module github.com/actiontech/sqle go 1.19 require ( - github.com/99designs/gqlgen v0.17.20 github.com/DATA-DOG/go-sqlmock v1.5.0 github.com/Masterminds/semver/v3 v3.1.1 github.com/actiontech/dms v0.0.0-20231019085256-6c3ffc8b3489 github.com/actiontech/java-sql-extractor v0.0.0-20231103015812-cdd5fc040f62 - github.com/actiontech/mybatis-mapper-2-sql v0.4.0 + github.com/actiontech/mybatis-mapper-2-sql v0.5.0 github.com/agiledragon/gomonkey v2.0.2+incompatible github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 github.com/alibabacloud-go/darabonba-openapi v0.1.18 @@ -66,7 +65,6 @@ require ( github.com/swaggo/swag v1.6.7 github.com/ungerik/go-dry v0.0.0-20210209114055-a3e162a9e62e github.com/urfave/cli/v2 v2.8.1 - github.com/vektah/gqlparser/v2 v2.5.1 golang.org/x/net v0.15.0 google.golang.org/grpc v1.50.1 gopkg.in/natefinch/lumberjack.v2 v2.0.0 @@ -83,7 +81,6 @@ require ( github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect github.com/acomagu/bufpipe v1.0.4 // indirect - github.com/agnivade/levenshtein v1.1.1 // indirect github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.4 // indirect github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68 // indirect github.com/alibabacloud-go/endpoint-util v1.1.0 // indirect diff --git a/go.sum b/go.sum index 229c91cc3e..9aad57bc6a 100644 --- a/go.sum +++ b/go.sum @@ -19,11 +19,8 @@ cloud.google.com/go/storage v1.10.0 h1:STgFzyU5/8miMl0//zKh2aQeTyeaUH3WN9bSUiJ09 dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/99designs/gqlgen v0.17.20 h1:O7WzccIhKB1dm+7g6dhQcULINftfiLSBg2l/mwbpJMw= -github.com/99designs/gqlgen v0.17.20/go.mod h1:Mja2HI23kWT1VRH09hvWshFgOzKswpO20o4ScpJIES4= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v1.1.0 h1:ksErzDEI1khOiGPgpwuI7x2ebx/uXQNw7xJpn9Eq1+I= -github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60= github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= @@ -55,13 +52,10 @@ github.com/actiontech/dms v0.0.0-20231019085256-6c3ffc8b3489 h1:K+fg7bPud+sMFyjb github.com/actiontech/dms v0.0.0-20231019085256-6c3ffc8b3489/go.mod h1:NjDg7X3pKEQCaXSSphdwEGTh+D6nvB19OnKj/AF2CX0= github.com/actiontech/java-sql-extractor v0.0.0-20231103015812-cdd5fc040f62 h1:JM7WnLzlvXOGE90KKd+aigi+qUDS+U5dLwQMNpTKZxE= github.com/actiontech/java-sql-extractor v0.0.0-20231103015812-cdd5fc040f62/go.mod h1:adDZHhAf2LRMx2h0JzofPXn12x2XlyQjVE116KXquwo= -github.com/actiontech/mybatis-mapper-2-sql v0.4.0 h1:FSzK3qnnD9/JjOUJMRcctGxQjK7cg1M01yRMq59TSZg= -github.com/actiontech/mybatis-mapper-2-sql v0.4.0/go.mod h1:ZMmUEDfbjm8oWxSAZkejqeOzlXa1BWNCfhNIxCMu7lw= +github.com/actiontech/mybatis-mapper-2-sql v0.5.0 h1:TGovwZpLT+DUE5W0ZeSNE//LQLpVuQx8ghx0r8rPVBY= +github.com/actiontech/mybatis-mapper-2-sql v0.5.0/go.mod h1:ZMmUEDfbjm8oWxSAZkejqeOzlXa1BWNCfhNIxCMu7lw= github.com/agiledragon/gomonkey v2.0.2+incompatible h1:eXKi9/piiC3cjJD1658mEE2o3NjkJ5vDLgYjCQu0Xlw= github.com/agiledragon/gomonkey v2.0.2+incompatible/go.mod h1:2NGfXu1a80LLr2cmWXGBDaHEjb1idR6+FVlX5T3D9hw= -github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM= -github.com/agnivade/levenshtein v1.1.1 h1:QY8M92nrzkmr798gCo3kmMyqXFzdQVpxLlGPRBij0P8= -github.com/agnivade/levenshtein v1.1.1/go.mod h1:veldBMzWxcCG2ZvUTKD2kJNRdCk5hVbJomOvKkmgYbo= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= @@ -102,8 +96,6 @@ github.com/alibabacloud-go/tea-xml v1.1.2 h1:oLxa7JUXm2EDFzMg+7oRsYc+kutgCVwm+bZ github.com/alibabacloud-go/tea-xml v1.1.2/go.mod h1:Rq08vgCcCAjHyRi/M7xlHKUykZCEtyBy9+DPF6GgEu8= github.com/aliyun/credentials-go v1.1.2 h1:qU1vwGIBb3UJ8BwunHDRFtAhS6jnQLnde/yk0+Ih2GY= github.com/aliyun/credentials-go v1.1.2/go.mod h1:ozcZaMR5kLM7pwtCMEpVmQ242suV6qTJya2bDq4X1Tw= -github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ= -github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y= github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8= github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q= @@ -111,8 +103,6 @@ github.com/antlr4-go/antlr/v4 v4.13.0 h1:lxCg3LAv+EUK6t1i0y1V6/SLeUi0eKEKdhQAlS8 github.com/antlr4-go/antlr/v4 v4.13.0/go.mod h1:pfChB/xh/Unjila75QW7+VU4TSnWnnk9UTnmpPaOR2g= github.com/appleboy/gin-jwt/v2 v2.6.3/go.mod h1:MfPYA4ogzvOcVkRwAxT7quHOtQmVKDpTwxyUrC2DNw0= github.com/appleboy/gofight/v2 v2.1.2/go.mod h1:frW+U1QZEdDgixycTj4CygQ48yLTUhplt43+Wczp3rw= -github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig+0+Ap1h4unLjW6YQJpKZVmUzxsD4E/Q= -github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= @@ -177,7 +167,6 @@ github.com/corona10/goimagehash v1.0.2/go.mod h1:/l9umBhvcHQXVtQO1V6Gp1yD20STawk github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= @@ -215,8 +204,6 @@ github.com/dgryski/go-farm v0.0.0-20190104051053-3adb47b1fb0f/go.mod h1:SqUrOPUn github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48 h1:fRzb/w+pyskVMQ+UbP35JkH8yB7MYb4q/qhBarqZE6g= -github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v0.0.0-20180421182945-02af3965c54e/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= @@ -416,8 +403,6 @@ github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY github.com/gorilla/websocket v1.2.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= -github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.1.0 h1:THDBEeQ9xZ8JEaCLyLQqXMMdRqNr0QAUJTIkQAUtFjg= @@ -449,8 +434,6 @@ github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/b github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= -github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= @@ -550,7 +533,6 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V github.com/kevinburke/go-bindata v3.18.0+incompatible/go.mod h1:/pEEZ72flUW2p0yi30bslSp9YqD9pysLxunQDdb2CPM= github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= -github.com/kevinmbeaulieu/eq-go v1.0.0/go.mod h1:G3S8ajA56gKBZm4UB9AOyoOS37JO3roToPzKNM8dtdM= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= @@ -589,7 +571,6 @@ github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.10.2 h1:AqzbZs4ZoCBp+GtejcpCpcxM3zlSMx29dXbUSeVtJb8= github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/logrusorgru/aurora/v3 v3.0.0/go.mod h1:vsR12bk5grlLvLXAYrBsb5Oc/N+LxAlxggSjiwMnCUc= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= @@ -600,7 +581,6 @@ github.com/mailru/easyjson v0.7.1 h1:mdxE1MF9o53iCb2Ghj1VfWvh7ZOwHpnVG/xwXrV90U8 github.com/mailru/easyjson v0.7.1/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs= github.com/matryer/is v1.2.0 h1:92UTHpy8CDwaJ08GqLDzhhuixiBUUD1p3AU6PHddz4A= github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA= -github.com/matryer/moq v0.2.7/go.mod h1:kITsx543GOENm48TUAQyJ9+SAvFSr7iGQXPoth/VUBk= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.0/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= @@ -653,7 +633,6 @@ github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS4 github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.3.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -957,8 +936,6 @@ github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPU github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo= github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= -github.com/vektah/gqlparser/v2 v2.5.1 h1:ZGu+bquAY23jsxDRcYpWjttRZrUz07LbiY77gUOHcr4= -github.com/vektah/gqlparser/v2 v2.5.1/go.mod h1:mPgqFBu/woKTVYWyNk8cO3kh4S/f4aRFZrvOnp3hmCs= github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= @@ -976,7 +953,6 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.30/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= @@ -1078,7 +1054,6 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= @@ -1120,7 +1095,6 @@ golang.org/x/net v0.0.0-20210224082022-3d97a244fca7/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210913180222-943fd674d43e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= @@ -1188,7 +1162,6 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210910150752-751e447fb3d0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1270,7 +1243,6 @@ golang.org/x/tools v0.0.0-20200325203130-f53864d0dba1/go.mod h1:Sl4aGygMT6LrqrWc golang.org/x/tools v0.0.0-20200509030707-2212a7e161a5/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20201125231158-b5590deeca9b/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= diff --git a/vendor/github.com/99designs/gqlgen/LICENSE b/vendor/github.com/99designs/gqlgen/LICENSE deleted file mode 100644 index 10bb21c07e..0000000000 --- a/vendor/github.com/99designs/gqlgen/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2020 gqlgen authors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/99designs/gqlgen/api/generate.go b/vendor/github.com/99designs/gqlgen/api/generate.go deleted file mode 100644 index 6619dd5cd2..0000000000 --- a/vendor/github.com/99designs/gqlgen/api/generate.go +++ /dev/null @@ -1,139 +0,0 @@ -package api - -import ( - "fmt" - "regexp" - "syscall" - - "github.com/99designs/gqlgen/codegen" - "github.com/99designs/gqlgen/codegen/config" - "github.com/99designs/gqlgen/plugin" - "github.com/99designs/gqlgen/plugin/federation" - "github.com/99designs/gqlgen/plugin/modelgen" - "github.com/99designs/gqlgen/plugin/resolvergen" -) - -func Generate(cfg *config.Config, option ...Option) error { - _ = syscall.Unlink(cfg.Exec.Filename) - if cfg.Model.IsDefined() { - _ = syscall.Unlink(cfg.Model.Filename) - } - - plugins := []plugin.Plugin{} - if cfg.Model.IsDefined() { - plugins = append(plugins, modelgen.New()) - } - plugins = append(plugins, resolvergen.New()) - if cfg.Federation.IsDefined() { - if cfg.Federation.Version == 0 { // default to using the user's choice of version, but if unset, try to sort out which federation version to use - urlRegex := regexp.MustCompile(`(?s)@link.*\(.*url:.*?"(.*?)"[^)]+\)`) // regex to grab the url of a link directive, should it exist - - // check the sources, and if one is marked as federation v2, we mark the entirety to be generated using that format - for _, v := range cfg.Sources { - cfg.Federation.Version = 1 - urlString := urlRegex.FindStringSubmatch(v.Input) - if urlString != nil && urlString[1] == "https://specs.apollo.dev/federation/v2.0" { - cfg.Federation.Version = 2 - break - } - } - } - plugins = append([]plugin.Plugin{federation.New(cfg.Federation.Version)}, plugins...) - } - - for _, o := range option { - o(cfg, &plugins) - } - - for _, p := range plugins { - if inj, ok := p.(plugin.EarlySourceInjector); ok { - if s := inj.InjectSourceEarly(); s != nil { - cfg.Sources = append(cfg.Sources, s) - } - } - } - - if err := cfg.LoadSchema(); err != nil { - return fmt.Errorf("failed to load schema: %w", err) - } - - for _, p := range plugins { - if inj, ok := p.(plugin.LateSourceInjector); ok { - if s := inj.InjectSourceLate(cfg.Schema); s != nil { - cfg.Sources = append(cfg.Sources, s) - } - } - } - - // LoadSchema again now we have everything - if err := cfg.LoadSchema(); err != nil { - return fmt.Errorf("failed to load schema: %w", err) - } - - if err := cfg.Init(); err != nil { - return fmt.Errorf("generating core failed: %w", err) - } - - for _, p := range plugins { - if mut, ok := p.(plugin.ConfigMutator); ok { - err := mut.MutateConfig(cfg) - if err != nil { - return fmt.Errorf("%s: %w", p.Name(), err) - } - } - } - // Merge again now that the generated models have been injected into the typemap - data, err := codegen.BuildData(cfg) - if err != nil { - return fmt.Errorf("merging type systems failed: %w", err) - } - - if err = codegen.GenerateCode(data); err != nil { - return fmt.Errorf("generating core failed: %w", err) - } - - if !cfg.SkipModTidy { - if err = cfg.Packages.ModTidy(); err != nil { - return fmt.Errorf("tidy failed: %w", err) - } - } - - for _, p := range plugins { - if mut, ok := p.(plugin.CodeGenerator); ok { - err := mut.GenerateCode(data) - if err != nil { - return fmt.Errorf("%s: %w", p.Name(), err) - } - } - } - - if err = codegen.GenerateCode(data); err != nil { - return fmt.Errorf("generating core failed: %w", err) - } - - if !cfg.SkipValidation { - if err := validate(cfg); err != nil { - return fmt.Errorf("validation failed: %w", err) - } - } - - return nil -} - -func validate(cfg *config.Config) error { - roots := []string{cfg.Exec.ImportPath()} - if cfg.Model.IsDefined() { - roots = append(roots, cfg.Model.ImportPath()) - } - - if cfg.Resolver.IsDefined() { - roots = append(roots, cfg.Resolver.ImportPath()) - } - - cfg.Packages.LoadAll(roots...) - errs := cfg.Packages.Errors() - if len(errs) > 0 { - return errs - } - return nil -} diff --git a/vendor/github.com/99designs/gqlgen/api/option.go b/vendor/github.com/99designs/gqlgen/api/option.go deleted file mode 100644 index d376193dfe..0000000000 --- a/vendor/github.com/99designs/gqlgen/api/option.go +++ /dev/null @@ -1,47 +0,0 @@ -package api - -import ( - "github.com/99designs/gqlgen/codegen/config" - "github.com/99designs/gqlgen/plugin" -) - -type Option func(cfg *config.Config, plugins *[]plugin.Plugin) - -func NoPlugins() Option { - return func(cfg *config.Config, plugins *[]plugin.Plugin) { - *plugins = nil - } -} - -func AddPlugin(p plugin.Plugin) Option { - return func(cfg *config.Config, plugins *[]plugin.Plugin) { - *plugins = append(*plugins, p) - } -} - -// PrependPlugin prepends plugin any existing plugins -func PrependPlugin(p plugin.Plugin) Option { - return func(cfg *config.Config, plugins *[]plugin.Plugin) { - *plugins = append([]plugin.Plugin{p}, *plugins...) - } -} - -// ReplacePlugin replaces any existing plugin with a matching plugin name -func ReplacePlugin(p plugin.Plugin) Option { - return func(cfg *config.Config, plugins *[]plugin.Plugin) { - if plugins != nil { - found := false - ps := *plugins - for i, o := range ps { - if p.Name() == o.Name() { - ps[i] = p - found = true - } - } - if !found { - ps = append(ps, p) - } - *plugins = ps - } - } -} diff --git a/vendor/github.com/99designs/gqlgen/codegen/args.go b/vendor/github.com/99designs/gqlgen/codegen/args.go deleted file mode 100644 index 0fd30fffd5..0000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/args.go +++ /dev/null @@ -1,122 +0,0 @@ -package codegen - -import ( - "fmt" - "go/types" - "strings" - - "github.com/99designs/gqlgen/codegen/config" - "github.com/99designs/gqlgen/codegen/templates" - "github.com/vektah/gqlparser/v2/ast" -) - -type ArgSet struct { - Args []*FieldArgument - FuncDecl string -} - -type FieldArgument struct { - *ast.ArgumentDefinition - TypeReference *config.TypeReference - VarName string // The name of the var in go - Object *Object // A link back to the parent object - Default interface{} // The default value - Directives []*Directive - Value interface{} // value set in Data -} - -// ImplDirectives get not Builtin and location ARGUMENT_DEFINITION directive -func (f *FieldArgument) ImplDirectives() []*Directive { - d := make([]*Directive, 0) - for i := range f.Directives { - if !f.Directives[i].Builtin && f.Directives[i].IsLocation(ast.LocationArgumentDefinition) { - d = append(d, f.Directives[i]) - } - } - - return d -} - -func (f *FieldArgument) DirectiveObjName() string { - return "rawArgs" -} - -func (f *FieldArgument) Stream() bool { - return f.Object != nil && f.Object.Stream -} - -func (b *builder) buildArg(obj *Object, arg *ast.ArgumentDefinition) (*FieldArgument, error) { - tr, err := b.Binder.TypeReference(arg.Type, nil) - if err != nil { - return nil, err - } - - argDirs, err := b.getDirectives(arg.Directives) - if err != nil { - return nil, err - } - newArg := FieldArgument{ - ArgumentDefinition: arg, - TypeReference: tr, - Object: obj, - VarName: templates.ToGoPrivate(arg.Name), - Directives: argDirs, - } - - if arg.DefaultValue != nil { - newArg.Default, err = arg.DefaultValue.Value(nil) - if err != nil { - return nil, fmt.Errorf("default value is not valid: %w", err) - } - } - - return &newArg, nil -} - -func (b *builder) bindArgs(field *Field, sig *types.Signature, params *types.Tuple) ([]*FieldArgument, error) { - n := params.Len() - newArgs := make([]*FieldArgument, 0, len(field.Args)) - // Accept variadic methods (i.e. have optional parameters). - if params.Len() > len(field.Args) && sig.Variadic() { - n = len(field.Args) - } -nextArg: - for j := 0; j < n; j++ { - param := params.At(j) - for _, oldArg := range field.Args { - if strings.EqualFold(oldArg.Name, param.Name()) { - tr, err := b.Binder.TypeReference(oldArg.Type, param.Type()) - if err != nil { - return nil, err - } - oldArg.TypeReference = tr - - newArgs = append(newArgs, oldArg) - continue nextArg - } - } - - // no matching arg found, abort - return nil, fmt.Errorf("arg %s not in schema", param.Name()) - } - - return newArgs, nil -} - -func (a *Data) Args() map[string][]*FieldArgument { - ret := map[string][]*FieldArgument{} - for _, o := range a.Objects { - for _, f := range o.Fields { - if len(f.Args) > 0 { - ret[f.ArgsFunc()] = f.Args - } - } - } - - for _, d := range a.Directives() { - if len(d.Args) > 0 { - ret[d.ArgsFunc()] = d.Args - } - } - return ret -} diff --git a/vendor/github.com/99designs/gqlgen/codegen/args.gotpl b/vendor/github.com/99designs/gqlgen/codegen/args.gotpl deleted file mode 100644 index 7b541ae1f2..0000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/args.gotpl +++ /dev/null @@ -1,36 +0,0 @@ -{{ range $name, $args := .Args }} -func (ec *executionContext) {{ $name }}(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - {{- range $i, $arg := . }} - var arg{{$i}} {{ $arg.TypeReference.GO | ref}} - if tmp, ok := rawArgs[{{$arg.Name|quote}}]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField({{$arg.Name|quote}})) - {{- if $arg.ImplDirectives }} - directive0 := func(ctx context.Context) (interface{}, error) { return ec.{{ $arg.TypeReference.UnmarshalFunc }}(ctx, tmp) } - {{ template "implDirectives" $arg }} - tmp, err = directive{{$arg.ImplDirectives|len}}(ctx) - if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) - } - if data, ok := tmp.({{ $arg.TypeReference.GO | ref }}) ; ok { - arg{{$i}} = data - {{- if $arg.TypeReference.IsNilable }} - } else if tmp == nil { - arg{{$i}} = nil - {{- end }} - } else { - return nil, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be {{ $arg.TypeReference.GO }}`, tmp)) - } - {{- else }} - arg{{$i}}, err = ec.{{ $arg.TypeReference.UnmarshalFunc }}(ctx, tmp) - if err != nil { - return nil, err - } - {{- end }} - } - args[{{$arg.Name|quote}}] = arg{{$i}} - {{- end }} - return args, nil -} -{{ end }} diff --git a/vendor/github.com/99designs/gqlgen/codegen/complexity.go b/vendor/github.com/99designs/gqlgen/codegen/complexity.go deleted file mode 100644 index e9c6a20ee8..0000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/complexity.go +++ /dev/null @@ -1,11 +0,0 @@ -package codegen - -func (o *Object) UniqueFields() map[string][]*Field { - m := map[string][]*Field{} - - for _, f := range o.Fields { - m[f.GoFieldName] = append(m[f.GoFieldName], f) - } - - return m -} diff --git a/vendor/github.com/99designs/gqlgen/codegen/config/binder.go b/vendor/github.com/99designs/gqlgen/codegen/config/binder.go deleted file mode 100644 index bedc23bc61..0000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/config/binder.go +++ /dev/null @@ -1,493 +0,0 @@ -package config - -import ( - "errors" - "fmt" - "go/token" - "go/types" - - "golang.org/x/tools/go/packages" - - "github.com/99designs/gqlgen/codegen/templates" - "github.com/99designs/gqlgen/internal/code" - "github.com/vektah/gqlparser/v2/ast" -) - -var ErrTypeNotFound = errors.New("unable to find type") - -// Binder connects graphql types to golang types using static analysis -type Binder struct { - pkgs *code.Packages - schema *ast.Schema - cfg *Config - References []*TypeReference - SawInvalid bool - objectCache map[string]map[string]types.Object -} - -func (c *Config) NewBinder() *Binder { - return &Binder{ - pkgs: c.Packages, - schema: c.Schema, - cfg: c, - } -} - -func (b *Binder) TypePosition(typ types.Type) token.Position { - named, isNamed := typ.(*types.Named) - if !isNamed { - return token.Position{ - Filename: "unknown", - } - } - - return b.ObjectPosition(named.Obj()) -} - -func (b *Binder) ObjectPosition(typ types.Object) token.Position { - if typ == nil { - return token.Position{ - Filename: "unknown", - } - } - pkg := b.pkgs.Load(typ.Pkg().Path()) - return pkg.Fset.Position(typ.Pos()) -} - -func (b *Binder) FindTypeFromName(name string) (types.Type, error) { - pkgName, typeName := code.PkgAndType(name) - return b.FindType(pkgName, typeName) -} - -func (b *Binder) FindType(pkgName string, typeName string) (types.Type, error) { - if pkgName == "" { - if typeName == "map[string]interface{}" { - return MapType, nil - } - - if typeName == "interface{}" { - return InterfaceType, nil - } - } - - obj, err := b.FindObject(pkgName, typeName) - if err != nil { - return nil, err - } - - if fun, isFunc := obj.(*types.Func); isFunc { - return fun.Type().(*types.Signature).Params().At(0).Type(), nil - } - return obj.Type(), nil -} - -var ( - MapType = types.NewMap(types.Typ[types.String], types.NewInterfaceType(nil, nil).Complete()) - InterfaceType = types.NewInterfaceType(nil, nil) -) - -func (b *Binder) DefaultUserObject(name string) (types.Type, error) { - models := b.cfg.Models[name].Model - if len(models) == 0 { - return nil, fmt.Errorf(name + " not found in typemap") - } - - if models[0] == "map[string]interface{}" { - return MapType, nil - } - - if models[0] == "interface{}" { - return InterfaceType, nil - } - - pkgName, typeName := code.PkgAndType(models[0]) - if pkgName == "" { - return nil, fmt.Errorf("missing package name for %s", name) - } - - obj, err := b.FindObject(pkgName, typeName) - if err != nil { - return nil, err - } - - return obj.Type(), nil -} - -func (b *Binder) FindObject(pkgName string, typeName string) (types.Object, error) { - if pkgName == "" { - return nil, fmt.Errorf("package cannot be nil") - } - - pkg := b.pkgs.LoadWithTypes(pkgName) - if pkg == nil { - err := b.pkgs.Errors() - if err != nil { - return nil, fmt.Errorf("package could not be loaded: %s.%s: %w", pkgName, typeName, err) - } - return nil, fmt.Errorf("required package was not loaded: %s.%s", pkgName, typeName) - } - - if b.objectCache == nil { - b.objectCache = make(map[string]map[string]types.Object, b.pkgs.Count()) - } - - defsIndex, ok := b.objectCache[pkgName] - if !ok { - defsIndex = indexDefs(pkg) - b.objectCache[pkgName] = defsIndex - } - - // function based marshalers take precedence - if val, ok := defsIndex["Marshal"+typeName]; ok { - return val, nil - } - - if val, ok := defsIndex[typeName]; ok { - return val, nil - } - - return nil, fmt.Errorf("%w: %s.%s", ErrTypeNotFound, pkgName, typeName) -} - -func indexDefs(pkg *packages.Package) map[string]types.Object { - res := make(map[string]types.Object) - - scope := pkg.Types.Scope() - for astNode, def := range pkg.TypesInfo.Defs { - // only look at defs in the top scope - if def == nil { - continue - } - parent := def.Parent() - if parent == nil || parent != scope { - continue - } - - if _, ok := res[astNode.Name]; !ok { - // The above check may not be really needed, it is only here to have a consistent behavior with - // previous implementation of FindObject() function which only honored the first inclusion of a def. - // If this is still needed, we can consider something like sync.Map.LoadOrStore() to avoid two lookups. - res[astNode.Name] = def - } - } - - return res -} - -func (b *Binder) PointerTo(ref *TypeReference) *TypeReference { - newRef := *ref - newRef.GO = types.NewPointer(ref.GO) - b.References = append(b.References, &newRef) - return &newRef -} - -// TypeReference is used by args and field types. The Definition can refer to both input and output types. -type TypeReference struct { - Definition *ast.Definition - GQL *ast.Type - GO types.Type // Type of the field being bound. Could be a pointer or a value type of Target. - Target types.Type // The actual type that we know how to bind to. May require pointer juggling when traversing to fields. - CastType types.Type // Before calling marshalling functions cast from/to this base type - Marshaler *types.Func // When using external marshalling functions this will point to the Marshal function - Unmarshaler *types.Func // When using external marshalling functions this will point to the Unmarshal function - IsMarshaler bool // Does the type implement graphql.Marshaler and graphql.Unmarshaler - IsContext bool // Is the Marshaler/Unmarshaller the context version; applies to either the method or interface variety. -} - -func (ref *TypeReference) Elem() *TypeReference { - if p, isPtr := ref.GO.(*types.Pointer); isPtr { - newRef := *ref - newRef.GO = p.Elem() - return &newRef - } - - if ref.IsSlice() { - newRef := *ref - newRef.GO = ref.GO.(*types.Slice).Elem() - newRef.GQL = ref.GQL.Elem - return &newRef - } - return nil -} - -func (t *TypeReference) IsPtr() bool { - _, isPtr := t.GO.(*types.Pointer) - return isPtr -} - -// fix for https://github.com/golang/go/issues/31103 may make it possible to remove this (may still be useful) -func (t *TypeReference) IsPtrToPtr() bool { - if p, isPtr := t.GO.(*types.Pointer); isPtr { - _, isPtr := p.Elem().(*types.Pointer) - return isPtr - } - return false -} - -func (t *TypeReference) IsNilable() bool { - return IsNilable(t.GO) -} - -func (t *TypeReference) IsSlice() bool { - _, isSlice := t.GO.(*types.Slice) - return t.GQL.Elem != nil && isSlice -} - -func (t *TypeReference) IsPtrToSlice() bool { - if t.IsPtr() { - _, isPointerToSlice := t.GO.(*types.Pointer).Elem().(*types.Slice) - return isPointerToSlice - } - return false -} - -func (t *TypeReference) IsNamed() bool { - _, isSlice := t.GO.(*types.Named) - return isSlice -} - -func (t *TypeReference) IsStruct() bool { - _, isStruct := t.GO.Underlying().(*types.Struct) - return isStruct -} - -func (t *TypeReference) IsScalar() bool { - return t.Definition.Kind == ast.Scalar -} - -func (t *TypeReference) UniquenessKey() string { - nullability := "O" - if t.GQL.NonNull { - nullability = "N" - } - - elemNullability := "" - if t.GQL.Elem != nil && t.GQL.Elem.NonNull { - // Fix for #896 - elemNullability = "ᚄ" - } - return nullability + t.Definition.Name + "2" + templates.TypeIdentifier(t.GO) + elemNullability -} - -func (t *TypeReference) MarshalFunc() string { - if t.Definition == nil { - panic(errors.New("Definition missing for " + t.GQL.Name())) - } - - if t.Definition.Kind == ast.InputObject { - return "" - } - - return "marshal" + t.UniquenessKey() -} - -func (t *TypeReference) UnmarshalFunc() string { - if t.Definition == nil { - panic(errors.New("Definition missing for " + t.GQL.Name())) - } - - if !t.Definition.IsInputType() { - return "" - } - - return "unmarshal" + t.UniquenessKey() -} - -func (t *TypeReference) IsTargetNilable() bool { - return IsNilable(t.Target) -} - -func (b *Binder) PushRef(ret *TypeReference) { - b.References = append(b.References, ret) -} - -func isMap(t types.Type) bool { - if t == nil { - return true - } - _, ok := t.(*types.Map) - return ok -} - -func isIntf(t types.Type) bool { - if t == nil { - return true - } - _, ok := t.(*types.Interface) - return ok -} - -func (b *Binder) TypeReference(schemaType *ast.Type, bindTarget types.Type) (ret *TypeReference, err error) { - if !isValid(bindTarget) { - b.SawInvalid = true - return nil, fmt.Errorf("%s has an invalid type", schemaType.Name()) - } - - var pkgName, typeName string - def := b.schema.Types[schemaType.Name()] - defer func() { - if err == nil && ret != nil { - b.PushRef(ret) - } - }() - - if len(b.cfg.Models[schemaType.Name()].Model) == 0 { - return nil, fmt.Errorf("%s was not found", schemaType.Name()) - } - - for _, model := range b.cfg.Models[schemaType.Name()].Model { - if model == "map[string]interface{}" { - if !isMap(bindTarget) { - continue - } - return &TypeReference{ - Definition: def, - GQL: schemaType, - GO: MapType, - }, nil - } - - if model == "interface{}" { - if !isIntf(bindTarget) { - continue - } - return &TypeReference{ - Definition: def, - GQL: schemaType, - GO: InterfaceType, - }, nil - } - - pkgName, typeName = code.PkgAndType(model) - if pkgName == "" { - return nil, fmt.Errorf("missing package name for %s", schemaType.Name()) - } - - ref := &TypeReference{ - Definition: def, - GQL: schemaType, - } - - obj, err := b.FindObject(pkgName, typeName) - if err != nil { - return nil, err - } - - if fun, isFunc := obj.(*types.Func); isFunc { - ref.GO = fun.Type().(*types.Signature).Params().At(0).Type() - ref.IsContext = fun.Type().(*types.Signature).Results().At(0).Type().String() == "github.com/99designs/gqlgen/graphql.ContextMarshaler" - ref.Marshaler = fun - ref.Unmarshaler = types.NewFunc(0, fun.Pkg(), "Unmarshal"+typeName, nil) - } else if hasMethod(obj.Type(), "MarshalGQLContext") && hasMethod(obj.Type(), "UnmarshalGQLContext") { - ref.GO = obj.Type() - ref.IsContext = true - ref.IsMarshaler = true - } else if hasMethod(obj.Type(), "MarshalGQL") && hasMethod(obj.Type(), "UnmarshalGQL") { - ref.GO = obj.Type() - ref.IsMarshaler = true - } else if underlying := basicUnderlying(obj.Type()); def.IsLeafType() && underlying != nil && underlying.Kind() == types.String { - // TODO delete before v1. Backwards compatibility case for named types wrapping strings (see #595) - - ref.GO = obj.Type() - ref.CastType = underlying - - underlyingRef, err := b.TypeReference(&ast.Type{NamedType: "String"}, nil) - if err != nil { - return nil, err - } - - ref.Marshaler = underlyingRef.Marshaler - ref.Unmarshaler = underlyingRef.Unmarshaler - } else { - ref.GO = obj.Type() - } - - ref.Target = ref.GO - ref.GO = b.CopyModifiersFromAst(schemaType, ref.GO) - - if bindTarget != nil { - if err = code.CompatibleTypes(ref.GO, bindTarget); err != nil { - continue - } - ref.GO = bindTarget - } - - return ref, nil - } - - return nil, fmt.Errorf("%s is incompatible with %s", schemaType.Name(), bindTarget.String()) -} - -func isValid(t types.Type) bool { - basic, isBasic := t.(*types.Basic) - if !isBasic { - return true - } - return basic.Kind() != types.Invalid -} - -func (b *Binder) CopyModifiersFromAst(t *ast.Type, base types.Type) types.Type { - if t.Elem != nil { - child := b.CopyModifiersFromAst(t.Elem, base) - if _, isStruct := child.Underlying().(*types.Struct); isStruct && !b.cfg.OmitSliceElementPointers { - child = types.NewPointer(child) - } - return types.NewSlice(child) - } - - var isInterface bool - if named, ok := base.(*types.Named); ok { - _, isInterface = named.Underlying().(*types.Interface) - } - - if !isInterface && !IsNilable(base) && !t.NonNull { - return types.NewPointer(base) - } - - return base -} - -func IsNilable(t types.Type) bool { - if namedType, isNamed := t.(*types.Named); isNamed { - return IsNilable(namedType.Underlying()) - } - _, isPtr := t.(*types.Pointer) - _, isMap := t.(*types.Map) - _, isInterface := t.(*types.Interface) - _, isSlice := t.(*types.Slice) - _, isChan := t.(*types.Chan) - return isPtr || isMap || isInterface || isSlice || isChan -} - -func hasMethod(it types.Type, name string) bool { - if ptr, isPtr := it.(*types.Pointer); isPtr { - it = ptr.Elem() - } - namedType, ok := it.(*types.Named) - if !ok { - return false - } - - for i := 0; i < namedType.NumMethods(); i++ { - if namedType.Method(i).Name() == name { - return true - } - } - return false -} - -func basicUnderlying(it types.Type) *types.Basic { - if ptr, isPtr := it.(*types.Pointer); isPtr { - it = ptr.Elem() - } - namedType, ok := it.(*types.Named) - if !ok { - return nil - } - - if basic, ok := namedType.Underlying().(*types.Basic); ok { - return basic - } - - return nil -} diff --git a/vendor/github.com/99designs/gqlgen/codegen/config/config.go b/vendor/github.com/99designs/gqlgen/codegen/config/config.go deleted file mode 100644 index c6de8625f0..0000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/config/config.go +++ /dev/null @@ -1,656 +0,0 @@ -package config - -import ( - "bytes" - "fmt" - "os" - "path/filepath" - "regexp" - "sort" - "strings" - - "github.com/99designs/gqlgen/internal/code" - "github.com/vektah/gqlparser/v2" - "github.com/vektah/gqlparser/v2/ast" - "gopkg.in/yaml.v3" -) - -type Config struct { - SchemaFilename StringList `yaml:"schema,omitempty"` - Exec ExecConfig `yaml:"exec"` - Model PackageConfig `yaml:"model,omitempty"` - Federation PackageConfig `yaml:"federation,omitempty"` - Resolver ResolverConfig `yaml:"resolver,omitempty"` - AutoBind []string `yaml:"autobind"` - Models TypeMap `yaml:"models,omitempty"` - StructTag string `yaml:"struct_tag,omitempty"` - Directives map[string]DirectiveConfig `yaml:"directives,omitempty"` - OmitSliceElementPointers bool `yaml:"omit_slice_element_pointers,omitempty"` - OmitGetters bool `yaml:"omit_getters,omitempty"` - StructFieldsAlwaysPointers bool `yaml:"struct_fields_always_pointers,omitempty"` - ResolversAlwaysReturnPointers bool `yaml:"resolvers_always_return_pointers,omitempty"` - SkipValidation bool `yaml:"skip_validation,omitempty"` - SkipModTidy bool `yaml:"skip_mod_tidy,omitempty"` - Sources []*ast.Source `yaml:"-"` - Packages *code.Packages `yaml:"-"` - Schema *ast.Schema `yaml:"-"` - - // Deprecated: use Federation instead. Will be removed next release - Federated bool `yaml:"federated,omitempty"` -} - -var cfgFilenames = []string{".gqlgen.yml", "gqlgen.yml", "gqlgen.yaml"} - -// DefaultConfig creates a copy of the default config -func DefaultConfig() *Config { - return &Config{ - SchemaFilename: StringList{"schema.graphql"}, - Model: PackageConfig{Filename: "models_gen.go"}, - Exec: ExecConfig{Filename: "generated.go"}, - Directives: map[string]DirectiveConfig{}, - Models: TypeMap{}, - StructFieldsAlwaysPointers: true, - ResolversAlwaysReturnPointers: true, - } -} - -// LoadDefaultConfig loads the default config so that it is ready to be used -func LoadDefaultConfig() (*Config, error) { - config := DefaultConfig() - - for _, filename := range config.SchemaFilename { - filename = filepath.ToSlash(filename) - var err error - var schemaRaw []byte - schemaRaw, err = os.ReadFile(filename) - if err != nil { - return nil, fmt.Errorf("unable to open schema: %w", err) - } - - config.Sources = append(config.Sources, &ast.Source{Name: filename, Input: string(schemaRaw)}) - } - - return config, nil -} - -// LoadConfigFromDefaultLocations looks for a config file in the current directory, and all parent directories -// walking up the tree. The closest config file will be returned. -func LoadConfigFromDefaultLocations() (*Config, error) { - cfgFile, err := findCfg() - if err != nil { - return nil, err - } - - err = os.Chdir(filepath.Dir(cfgFile)) - if err != nil { - return nil, fmt.Errorf("unable to enter config dir: %w", err) - } - return LoadConfig(cfgFile) -} - -var path2regex = strings.NewReplacer( - `.`, `\.`, - `*`, `.+`, - `\`, `[\\/]`, - `/`, `[\\/]`, -) - -// LoadConfig reads the gqlgen.yml config file -func LoadConfig(filename string) (*Config, error) { - config := DefaultConfig() - - b, err := os.ReadFile(filename) - if err != nil { - return nil, fmt.Errorf("unable to read config: %w", err) - } - - dec := yaml.NewDecoder(bytes.NewReader(b)) - dec.KnownFields(true) - - if err := dec.Decode(config); err != nil { - return nil, fmt.Errorf("unable to parse config: %w", err) - } - - if err := CompleteConfig(config); err != nil { - return nil, err - } - - return config, nil -} - -// CompleteConfig fills in the schema and other values to a config loaded from -// YAML. -func CompleteConfig(config *Config) error { - defaultDirectives := map[string]DirectiveConfig{ - "skip": {SkipRuntime: true}, - "include": {SkipRuntime: true}, - "deprecated": {SkipRuntime: true}, - "specifiedBy": {SkipRuntime: true}, - } - - for key, value := range defaultDirectives { - if _, defined := config.Directives[key]; !defined { - config.Directives[key] = value - } - } - - preGlobbing := config.SchemaFilename - config.SchemaFilename = StringList{} - for _, f := range preGlobbing { - var matches []string - - // for ** we want to override default globbing patterns and walk all - // subdirectories to match schema files. - if strings.Contains(f, "**") { - pathParts := strings.SplitN(f, "**", 2) - rest := strings.TrimPrefix(strings.TrimPrefix(pathParts[1], `\`), `/`) - // turn the rest of the glob into a regex, anchored only at the end because ** allows - // for any number of dirs in between and walk will let us match against the full path name - globRe := regexp.MustCompile(path2regex.Replace(rest) + `$`) - - if err := filepath.Walk(pathParts[0], func(path string, info os.FileInfo, err error) error { - if err != nil { - return err - } - - if globRe.MatchString(strings.TrimPrefix(path, pathParts[0])) { - matches = append(matches, path) - } - - return nil - }); err != nil { - return fmt.Errorf("failed to walk schema at root %s: %w", pathParts[0], err) - } - } else { - var err error - matches, err = filepath.Glob(f) - if err != nil { - return fmt.Errorf("failed to glob schema filename %s: %w", f, err) - } - } - - for _, m := range matches { - if config.SchemaFilename.Has(m) { - continue - } - config.SchemaFilename = append(config.SchemaFilename, m) - } - } - - for _, filename := range config.SchemaFilename { - filename = filepath.ToSlash(filename) - var err error - var schemaRaw []byte - schemaRaw, err = os.ReadFile(filename) - if err != nil { - return fmt.Errorf("unable to open schema: %w", err) - } - - config.Sources = append(config.Sources, &ast.Source{Name: filename, Input: string(schemaRaw)}) - } - return nil -} - -func (c *Config) Init() error { - if c.Packages == nil { - c.Packages = &code.Packages{} - } - - if c.Schema == nil { - if err := c.LoadSchema(); err != nil { - return err - } - } - - err := c.injectTypesFromSchema() - if err != nil { - return err - } - - err = c.autobind() - if err != nil { - return err - } - - c.injectBuiltins() - // prefetch all packages in one big packages.Load call - c.Packages.LoadAll(c.packageList()...) - - // check everything is valid on the way out - err = c.check() - if err != nil { - return err - } - - return nil -} - -func (c *Config) packageList() []string { - pkgs := []string{ - "github.com/99designs/gqlgen/graphql", - "github.com/99designs/gqlgen/graphql/introspection", - } - pkgs = append(pkgs, c.Models.ReferencedPackages()...) - pkgs = append(pkgs, c.AutoBind...) - return pkgs -} - -func (c *Config) ReloadAllPackages() { - c.Packages.ReloadAll(c.packageList()...) -} - -func (c *Config) injectTypesFromSchema() error { - c.Directives["goModel"] = DirectiveConfig{ - SkipRuntime: true, - } - - c.Directives["goField"] = DirectiveConfig{ - SkipRuntime: true, - } - - c.Directives["goTag"] = DirectiveConfig{ - SkipRuntime: true, - } - - for _, schemaType := range c.Schema.Types { - if schemaType == c.Schema.Query || schemaType == c.Schema.Mutation || schemaType == c.Schema.Subscription { - continue - } - - if bd := schemaType.Directives.ForName("goModel"); bd != nil { - if ma := bd.Arguments.ForName("model"); ma != nil { - if mv, err := ma.Value.Value(nil); err == nil { - c.Models.Add(schemaType.Name, mv.(string)) - } - } - if ma := bd.Arguments.ForName("models"); ma != nil { - if mvs, err := ma.Value.Value(nil); err == nil { - for _, mv := range mvs.([]interface{}) { - c.Models.Add(schemaType.Name, mv.(string)) - } - } - } - } - - if schemaType.Kind == ast.Object || schemaType.Kind == ast.InputObject { - for _, field := range schemaType.Fields { - if fd := field.Directives.ForName("goField"); fd != nil { - forceResolver := c.Models[schemaType.Name].Fields[field.Name].Resolver - fieldName := c.Models[schemaType.Name].Fields[field.Name].FieldName - - if ra := fd.Arguments.ForName("forceResolver"); ra != nil { - if fr, err := ra.Value.Value(nil); err == nil { - forceResolver = fr.(bool) - } - } - - if na := fd.Arguments.ForName("name"); na != nil { - if fr, err := na.Value.Value(nil); err == nil { - fieldName = fr.(string) - } - } - - if c.Models[schemaType.Name].Fields == nil { - c.Models[schemaType.Name] = TypeMapEntry{ - Model: c.Models[schemaType.Name].Model, - Fields: map[string]TypeMapField{}, - } - } - - c.Models[schemaType.Name].Fields[field.Name] = TypeMapField{ - FieldName: fieldName, - Resolver: forceResolver, - } - } - } - } - } - - return nil -} - -type TypeMapEntry struct { - Model StringList `yaml:"model"` - Fields map[string]TypeMapField `yaml:"fields,omitempty"` -} - -type TypeMapField struct { - Resolver bool `yaml:"resolver"` - FieldName string `yaml:"fieldName"` - GeneratedMethod string `yaml:"-"` -} - -type StringList []string - -func (a *StringList) UnmarshalYAML(unmarshal func(interface{}) error) error { - var single string - err := unmarshal(&single) - if err == nil { - *a = []string{single} - return nil - } - - var multi []string - err = unmarshal(&multi) - if err != nil { - return err - } - - *a = multi - return nil -} - -func (a StringList) Has(file string) bool { - for _, existing := range a { - if existing == file { - return true - } - } - return false -} - -func (c *Config) check() error { - if c.Models == nil { - c.Models = TypeMap{} - } - - type FilenamePackage struct { - Filename string - Package string - Declaree string - } - - fileList := map[string][]FilenamePackage{} - - if err := c.Models.Check(); err != nil { - return fmt.Errorf("config.models: %w", err) - } - if err := c.Exec.Check(); err != nil { - return fmt.Errorf("config.exec: %w", err) - } - fileList[c.Exec.ImportPath()] = append(fileList[c.Exec.ImportPath()], FilenamePackage{ - Filename: c.Exec.Filename, - Package: c.Exec.Package, - Declaree: "exec", - }) - - if c.Model.IsDefined() { - if err := c.Model.Check(); err != nil { - return fmt.Errorf("config.model: %w", err) - } - fileList[c.Model.ImportPath()] = append(fileList[c.Model.ImportPath()], FilenamePackage{ - Filename: c.Model.Filename, - Package: c.Model.Package, - Declaree: "model", - }) - } - if c.Resolver.IsDefined() { - if err := c.Resolver.Check(); err != nil { - return fmt.Errorf("config.resolver: %w", err) - } - fileList[c.Resolver.ImportPath()] = append(fileList[c.Resolver.ImportPath()], FilenamePackage{ - Filename: c.Resolver.Filename, - Package: c.Resolver.Package, - Declaree: "resolver", - }) - } - if c.Federation.IsDefined() { - if err := c.Federation.Check(); err != nil { - return fmt.Errorf("config.federation: %w", err) - } - fileList[c.Federation.ImportPath()] = append(fileList[c.Federation.ImportPath()], FilenamePackage{ - Filename: c.Federation.Filename, - Package: c.Federation.Package, - Declaree: "federation", - }) - if c.Federation.ImportPath() != c.Exec.ImportPath() { - return fmt.Errorf("federation and exec must be in the same package") - } - } - if c.Federated { - return fmt.Errorf("federated has been removed, instead use\nfederation:\n filename: path/to/federated.go") - } - - for importPath, pkg := range fileList { - for _, file1 := range pkg { - for _, file2 := range pkg { - if file1.Package != file2.Package { - return fmt.Errorf("%s and %s define the same import path (%s) with different package names (%s vs %s)", - file1.Declaree, - file2.Declaree, - importPath, - file1.Package, - file2.Package, - ) - } - } - } - } - - return nil -} - -type TypeMap map[string]TypeMapEntry - -func (tm TypeMap) Exists(typeName string) bool { - _, ok := tm[typeName] - return ok -} - -func (tm TypeMap) UserDefined(typeName string) bool { - m, ok := tm[typeName] - return ok && len(m.Model) > 0 -} - -func (tm TypeMap) Check() error { - for typeName, entry := range tm { - for _, model := range entry.Model { - if strings.LastIndex(model, ".") < strings.LastIndex(model, "/") { - return fmt.Errorf("model %s: invalid type specifier \"%s\" - you need to specify a struct to map to", typeName, entry.Model) - } - } - } - return nil -} - -func (tm TypeMap) ReferencedPackages() []string { - var pkgs []string - - for _, typ := range tm { - for _, model := range typ.Model { - if model == "map[string]interface{}" || model == "interface{}" { - continue - } - pkg, _ := code.PkgAndType(model) - if pkg == "" || inStrSlice(pkgs, pkg) { - continue - } - pkgs = append(pkgs, code.QualifyPackagePath(pkg)) - } - } - - sort.Slice(pkgs, func(i, j int) bool { - return pkgs[i] > pkgs[j] - }) - return pkgs -} - -func (tm TypeMap) Add(name string, goType string) { - modelCfg := tm[name] - modelCfg.Model = append(modelCfg.Model, goType) - tm[name] = modelCfg -} - -type DirectiveConfig struct { - SkipRuntime bool `yaml:"skip_runtime"` -} - -func inStrSlice(haystack []string, needle string) bool { - for _, v := range haystack { - if needle == v { - return true - } - } - - return false -} - -// findCfg searches for the config file in this directory and all parents up the tree -// looking for the closest match -func findCfg() (string, error) { - dir, err := os.Getwd() - if err != nil { - return "", fmt.Errorf("unable to get working dir to findCfg: %w", err) - } - - cfg := findCfgInDir(dir) - - for cfg == "" && dir != filepath.Dir(dir) { - dir = filepath.Dir(dir) - cfg = findCfgInDir(dir) - } - - if cfg == "" { - return "", os.ErrNotExist - } - - return cfg, nil -} - -func findCfgInDir(dir string) string { - for _, cfgName := range cfgFilenames { - path := filepath.Join(dir, cfgName) - if _, err := os.Stat(path); err == nil { - return path - } - } - return "" -} - -func (c *Config) autobind() error { - if len(c.AutoBind) == 0 { - return nil - } - - ps := c.Packages.LoadAll(c.AutoBind...) - - for _, t := range c.Schema.Types { - if c.Models.UserDefined(t.Name) { - continue - } - - for i, p := range ps { - if p == nil || p.Module == nil { - return fmt.Errorf("unable to load %s - make sure you're using an import path to a package that exists", c.AutoBind[i]) - } - if t := p.Types.Scope().Lookup(t.Name); t != nil { - c.Models.Add(t.Name(), t.Pkg().Path()+"."+t.Name()) - break - } - } - } - - for i, t := range c.Models { - for j, m := range t.Model { - pkg, typename := code.PkgAndType(m) - - // skip anything that looks like an import path - if strings.Contains(pkg, "/") { - continue - } - - for _, p := range ps { - if p.Name != pkg { - continue - } - if t := p.Types.Scope().Lookup(typename); t != nil { - c.Models[i].Model[j] = t.Pkg().Path() + "." + t.Name() - break - } - } - } - } - - return nil -} - -func (c *Config) injectBuiltins() { - builtins := TypeMap{ - "__Directive": {Model: StringList{"github.com/99designs/gqlgen/graphql/introspection.Directive"}}, - "__DirectiveLocation": {Model: StringList{"github.com/99designs/gqlgen/graphql.String"}}, - "__Type": {Model: StringList{"github.com/99designs/gqlgen/graphql/introspection.Type"}}, - "__TypeKind": {Model: StringList{"github.com/99designs/gqlgen/graphql.String"}}, - "__Field": {Model: StringList{"github.com/99designs/gqlgen/graphql/introspection.Field"}}, - "__EnumValue": {Model: StringList{"github.com/99designs/gqlgen/graphql/introspection.EnumValue"}}, - "__InputValue": {Model: StringList{"github.com/99designs/gqlgen/graphql/introspection.InputValue"}}, - "__Schema": {Model: StringList{"github.com/99designs/gqlgen/graphql/introspection.Schema"}}, - "Float": {Model: StringList{"github.com/99designs/gqlgen/graphql.FloatContext"}}, - "String": {Model: StringList{"github.com/99designs/gqlgen/graphql.String"}}, - "Boolean": {Model: StringList{"github.com/99designs/gqlgen/graphql.Boolean"}}, - "Int": {Model: StringList{ - "github.com/99designs/gqlgen/graphql.Int", - "github.com/99designs/gqlgen/graphql.Int32", - "github.com/99designs/gqlgen/graphql.Int64", - }}, - "ID": { - Model: StringList{ - "github.com/99designs/gqlgen/graphql.ID", - "github.com/99designs/gqlgen/graphql.IntID", - }, - }, - } - - for typeName, entry := range builtins { - if !c.Models.Exists(typeName) { - c.Models[typeName] = entry - } - } - - // These are additional types that are injected if defined in the schema as scalars. - extraBuiltins := TypeMap{ - "Time": {Model: StringList{"github.com/99designs/gqlgen/graphql.Time"}}, - "Map": {Model: StringList{"github.com/99designs/gqlgen/graphql.Map"}}, - "Upload": {Model: StringList{"github.com/99designs/gqlgen/graphql.Upload"}}, - "Any": {Model: StringList{"github.com/99designs/gqlgen/graphql.Any"}}, - } - - for typeName, entry := range extraBuiltins { - if t, ok := c.Schema.Types[typeName]; !c.Models.Exists(typeName) && ok && t.Kind == ast.Scalar { - c.Models[typeName] = entry - } - } -} - -func (c *Config) LoadSchema() error { - if c.Packages != nil { - c.Packages = &code.Packages{} - } - - if err := c.check(); err != nil { - return err - } - - schema, err := gqlparser.LoadSchema(c.Sources...) - if err != nil { - return err - } - - if schema.Query == nil { - schema.Query = &ast.Definition{ - Kind: ast.Object, - Name: "Query", - } - schema.Types["Query"] = schema.Query - } - - c.Schema = schema - return nil -} - -func abs(path string) string { - absPath, err := filepath.Abs(path) - if err != nil { - panic(err) - } - return filepath.ToSlash(absPath) -} diff --git a/vendor/github.com/99designs/gqlgen/codegen/config/exec.go b/vendor/github.com/99designs/gqlgen/codegen/config/exec.go deleted file mode 100644 index fe1dccd21d..0000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/config/exec.go +++ /dev/null @@ -1,97 +0,0 @@ -package config - -import ( - "fmt" - "go/types" - "path/filepath" - "strings" - - "github.com/99designs/gqlgen/internal/code" -) - -type ExecConfig struct { - Package string `yaml:"package,omitempty"` - Layout ExecLayout `yaml:"layout,omitempty"` // Default: single-file - - // Only for single-file layout: - Filename string `yaml:"filename,omitempty"` - - // Only for follow-schema layout: - FilenameTemplate string `yaml:"filename_template,omitempty"` // String template with {name} as placeholder for base name. - DirName string `yaml:"dir"` -} - -type ExecLayout string - -var ( - // Write all generated code to a single file. - ExecLayoutSingleFile ExecLayout = "single-file" - // Write generated code to a directory, generating one Go source file for each GraphQL schema file. - ExecLayoutFollowSchema ExecLayout = "follow-schema" -) - -func (r *ExecConfig) Check() error { - if r.Layout == "" { - r.Layout = ExecLayoutSingleFile - } - - switch r.Layout { - case ExecLayoutSingleFile: - if r.Filename == "" { - return fmt.Errorf("filename must be specified when using single-file layout") - } - if !strings.HasSuffix(r.Filename, ".go") { - return fmt.Errorf("filename should be path to a go source file when using single-file layout") - } - r.Filename = abs(r.Filename) - case ExecLayoutFollowSchema: - if r.DirName == "" { - return fmt.Errorf("dir must be specified when using follow-schema layout") - } - r.DirName = abs(r.DirName) - default: - return fmt.Errorf("invalid layout %s", r.Layout) - } - - if strings.ContainsAny(r.Package, "./\\") { - return fmt.Errorf("package should be the output package name only, do not include the output filename") - } - - if r.Package == "" && r.Dir() != "" { - r.Package = code.NameForDir(r.Dir()) - } - - return nil -} - -func (r *ExecConfig) ImportPath() string { - if r.Dir() == "" { - return "" - } - return code.ImportPathForDir(r.Dir()) -} - -func (r *ExecConfig) Dir() string { - switch r.Layout { - case ExecLayoutSingleFile: - if r.Filename == "" { - return "" - } - return filepath.Dir(r.Filename) - case ExecLayoutFollowSchema: - return abs(r.DirName) - default: - panic("invalid layout " + r.Layout) - } -} - -func (r *ExecConfig) Pkg() *types.Package { - if r.Dir() == "" { - return nil - } - return types.NewPackage(r.ImportPath(), r.Package) -} - -func (r *ExecConfig) IsDefined() bool { - return r.Filename != "" || r.DirName != "" -} diff --git a/vendor/github.com/99designs/gqlgen/codegen/config/package.go b/vendor/github.com/99designs/gqlgen/codegen/config/package.go deleted file mode 100644 index faacd1496f..0000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/config/package.go +++ /dev/null @@ -1,63 +0,0 @@ -package config - -import ( - "fmt" - "go/types" - "path/filepath" - "strings" - - "github.com/99designs/gqlgen/internal/code" -) - -type PackageConfig struct { - Filename string `yaml:"filename,omitempty"` - Package string `yaml:"package,omitempty"` - Version int `yaml:"version,omitempty"` -} - -func (c *PackageConfig) ImportPath() string { - if !c.IsDefined() { - return "" - } - return code.ImportPathForDir(c.Dir()) -} - -func (c *PackageConfig) Dir() string { - if !c.IsDefined() { - return "" - } - return filepath.Dir(c.Filename) -} - -func (c *PackageConfig) Pkg() *types.Package { - if !c.IsDefined() { - return nil - } - return types.NewPackage(c.ImportPath(), c.Package) -} - -func (c *PackageConfig) IsDefined() bool { - return c.Filename != "" -} - -func (c *PackageConfig) Check() error { - if strings.ContainsAny(c.Package, "./\\") { - return fmt.Errorf("package should be the output package name only, do not include the output filename") - } - if c.Filename == "" { - return fmt.Errorf("filename must be specified") - } - if !strings.HasSuffix(c.Filename, ".go") { - return fmt.Errorf("filename should be path to a go source file") - } - - c.Filename = abs(c.Filename) - - // If Package is not set, first attempt to load the package at the output dir. If that fails - // fallback to just the base dir name of the output filename. - if c.Package == "" { - c.Package = code.NameForDir(c.Dir()) - } - - return nil -} diff --git a/vendor/github.com/99designs/gqlgen/codegen/config/resolver.go b/vendor/github.com/99designs/gqlgen/codegen/config/resolver.go deleted file mode 100644 index cd03f18872..0000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/config/resolver.go +++ /dev/null @@ -1,100 +0,0 @@ -package config - -import ( - "fmt" - "go/types" - "path/filepath" - "strings" - - "github.com/99designs/gqlgen/internal/code" -) - -type ResolverConfig struct { - Filename string `yaml:"filename,omitempty"` - FilenameTemplate string `yaml:"filename_template,omitempty"` - Package string `yaml:"package,omitempty"` - Type string `yaml:"type,omitempty"` - Layout ResolverLayout `yaml:"layout,omitempty"` - DirName string `yaml:"dir"` -} - -type ResolverLayout string - -var ( - LayoutSingleFile ResolverLayout = "single-file" - LayoutFollowSchema ResolverLayout = "follow-schema" -) - -func (r *ResolverConfig) Check() error { - if r.Layout == "" { - r.Layout = LayoutSingleFile - } - if r.Type == "" { - r.Type = "Resolver" - } - - switch r.Layout { - case LayoutSingleFile: - if r.Filename == "" { - return fmt.Errorf("filename must be specified with layout=%s", r.Layout) - } - if !strings.HasSuffix(r.Filename, ".go") { - return fmt.Errorf("filename should be path to a go source file with layout=%s", r.Layout) - } - r.Filename = abs(r.Filename) - case LayoutFollowSchema: - if r.DirName == "" { - return fmt.Errorf("dirname must be specified with layout=%s", r.Layout) - } - r.DirName = abs(r.DirName) - if r.Filename == "" { - r.Filename = filepath.Join(r.DirName, "resolver.go") - } else { - r.Filename = abs(r.Filename) - } - default: - return fmt.Errorf("invalid layout %s. must be %s or %s", r.Layout, LayoutSingleFile, LayoutFollowSchema) - } - - if strings.ContainsAny(r.Package, "./\\") { - return fmt.Errorf("package should be the output package name only, do not include the output filename") - } - - if r.Package == "" && r.Dir() != "" { - r.Package = code.NameForDir(r.Dir()) - } - - return nil -} - -func (r *ResolverConfig) ImportPath() string { - if r.Dir() == "" { - return "" - } - return code.ImportPathForDir(r.Dir()) -} - -func (r *ResolverConfig) Dir() string { - switch r.Layout { - case LayoutSingleFile: - if r.Filename == "" { - return "" - } - return filepath.Dir(r.Filename) - case LayoutFollowSchema: - return r.DirName - default: - panic("invalid layout " + r.Layout) - } -} - -func (r *ResolverConfig) Pkg() *types.Package { - if r.Dir() == "" { - return nil - } - return types.NewPackage(r.ImportPath(), r.Package) -} - -func (r *ResolverConfig) IsDefined() bool { - return r.Filename != "" || r.DirName != "" -} diff --git a/vendor/github.com/99designs/gqlgen/codegen/data.go b/vendor/github.com/99designs/gqlgen/codegen/data.go deleted file mode 100644 index 592140ae6c..0000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/data.go +++ /dev/null @@ -1,233 +0,0 @@ -package codegen - -import ( - "fmt" - "os" - "path/filepath" - "sort" - "strings" - - "github.com/vektah/gqlparser/v2/ast" - - "github.com/99designs/gqlgen/codegen/config" -) - -// Data is a unified model of the code to be generated. Plugins may modify this structure to do things like implement -// resolvers or directives automatically (eg grpc, validation) -type Data struct { - Config *config.Config - Schema *ast.Schema - // If a schema is broken up into multiple Data instance, each representing part of the schema, - // AllDirectives should contain the directives for the entire schema. Directives() can - // then be used to get the directives that were defined in this Data instance's sources. - // If a single Data instance is used for the entire schema, AllDirectives and Directives() - // will be identical. - // AllDirectives should rarely be used directly. - AllDirectives DirectiveList - Objects Objects - Inputs Objects - Interfaces map[string]*Interface - ReferencedTypes map[string]*config.TypeReference - ComplexityRoots map[string]*Object - - QueryRoot *Object - MutationRoot *Object - SubscriptionRoot *Object - AugmentedSources []AugmentedSource -} - -func (d *Data) HasEmbeddableSources() bool { - hasEmbeddableSources := false - for _, s := range d.AugmentedSources { - if s.Embeddable { - hasEmbeddableSources = true - } - } - return hasEmbeddableSources -} - -// AugmentedSource contains extra information about graphql schema files which is not known directly from the Config.Sources data -type AugmentedSource struct { - // path relative to Config.Exec.Filename - RelativePath string - Embeddable bool - BuiltIn bool - Source string -} - -type builder struct { - Config *config.Config - Schema *ast.Schema - Binder *config.Binder - Directives map[string]*Directive -} - -// Get only the directives which are defined in the config's sources. -func (d *Data) Directives() DirectiveList { - res := DirectiveList{} - for k, directive := range d.AllDirectives { - for _, s := range d.Config.Sources { - if directive.Position.Src.Name == s.Name { - res[k] = directive - break - } - } - } - return res -} - -func BuildData(cfg *config.Config) (*Data, error) { - // We reload all packages to allow packages to be compared correctly. - cfg.ReloadAllPackages() - - b := builder{ - Config: cfg, - Schema: cfg.Schema, - } - - b.Binder = b.Config.NewBinder() - - var err error - b.Directives, err = b.buildDirectives() - if err != nil { - return nil, err - } - - dataDirectives := make(map[string]*Directive) - for name, d := range b.Directives { - if !d.Builtin { - dataDirectives[name] = d - } - } - - s := Data{ - Config: cfg, - AllDirectives: dataDirectives, - Schema: b.Schema, - Interfaces: map[string]*Interface{}, - } - - for _, schemaType := range b.Schema.Types { - switch schemaType.Kind { - case ast.Object: - obj, err := b.buildObject(schemaType) - if err != nil { - return nil, fmt.Errorf("unable to build object definition: %w", err) - } - - s.Objects = append(s.Objects, obj) - case ast.InputObject: - input, err := b.buildObject(schemaType) - if err != nil { - return nil, fmt.Errorf("unable to build input definition: %w", err) - } - - s.Inputs = append(s.Inputs, input) - - case ast.Union, ast.Interface: - s.Interfaces[schemaType.Name], err = b.buildInterface(schemaType) - if err != nil { - return nil, fmt.Errorf("unable to bind to interface: %w", err) - } - } - } - - if s.Schema.Query != nil { - s.QueryRoot = s.Objects.ByName(s.Schema.Query.Name) - } else { - return nil, fmt.Errorf("query entry point missing") - } - - if s.Schema.Mutation != nil { - s.MutationRoot = s.Objects.ByName(s.Schema.Mutation.Name) - } - - if s.Schema.Subscription != nil { - s.SubscriptionRoot = s.Objects.ByName(s.Schema.Subscription.Name) - } - - if err := b.injectIntrospectionRoots(&s); err != nil { - return nil, err - } - - s.ReferencedTypes = b.buildTypes() - - sort.Slice(s.Objects, func(i, j int) bool { - return s.Objects[i].Definition.Name < s.Objects[j].Definition.Name - }) - - sort.Slice(s.Inputs, func(i, j int) bool { - return s.Inputs[i].Definition.Name < s.Inputs[j].Definition.Name - }) - - if b.Binder.SawInvalid { - // if we have a syntax error, show it - err := cfg.Packages.Errors() - if len(err) > 0 { - return nil, err - } - - // otherwise show a generic error message - return nil, fmt.Errorf("invalid types were encountered while traversing the go source code, this probably means the invalid code generated isnt correct. add try adding -v to debug") - } - aSources := []AugmentedSource{} - for _, s := range cfg.Sources { - wd, err := os.Getwd() - if err != nil { - return nil, fmt.Errorf("failed to get working directory: %w", err) - } - outputDir := cfg.Exec.Dir() - sourcePath := filepath.Join(wd, s.Name) - relative, err := filepath.Rel(outputDir, sourcePath) - if err != nil { - return nil, fmt.Errorf("failed to compute path of %s relative to %s: %w", sourcePath, outputDir, err) - } - relative = filepath.ToSlash(relative) - embeddable := true - if strings.HasPrefix(relative, "..") || s.BuiltIn { - embeddable = false - } - aSources = append(aSources, AugmentedSource{ - RelativePath: relative, - Embeddable: embeddable, - BuiltIn: s.BuiltIn, - Source: s.Input, - }) - } - s.AugmentedSources = aSources - - return &s, nil -} - -func (b *builder) injectIntrospectionRoots(s *Data) error { - obj := s.Objects.ByName(b.Schema.Query.Name) - if obj == nil { - return fmt.Errorf("root query type must be defined") - } - - __type, err := b.buildField(obj, &ast.FieldDefinition{ - Name: "__type", - Type: ast.NamedType("__Type", nil), - Arguments: []*ast.ArgumentDefinition{ - { - Name: "name", - Type: ast.NonNullNamedType("String", nil), - }, - }, - }) - if err != nil { - return err - } - - __schema, err := b.buildField(obj, &ast.FieldDefinition{ - Name: "__schema", - Type: ast.NamedType("__Schema", nil), - }) - if err != nil { - return err - } - - obj.Fields = append(obj.Fields, __type, __schema) - - return nil -} diff --git a/vendor/github.com/99designs/gqlgen/codegen/directive.go b/vendor/github.com/99designs/gqlgen/codegen/directive.go deleted file mode 100644 index 973061129a..0000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/directive.go +++ /dev/null @@ -1,174 +0,0 @@ -package codegen - -import ( - "fmt" - "strconv" - "strings" - - "github.com/99designs/gqlgen/codegen/templates" - "github.com/vektah/gqlparser/v2/ast" -) - -type DirectiveList map[string]*Directive - -// LocationDirectives filter directives by location -func (dl DirectiveList) LocationDirectives(location string) DirectiveList { - return locationDirectives(dl, ast.DirectiveLocation(location)) -} - -type Directive struct { - *ast.DirectiveDefinition - Name string - Args []*FieldArgument - Builtin bool -} - -// IsLocation check location directive -func (d *Directive) IsLocation(location ...ast.DirectiveLocation) bool { - for _, l := range d.Locations { - for _, a := range location { - if l == a { - return true - } - } - } - - return false -} - -func locationDirectives(directives DirectiveList, location ...ast.DirectiveLocation) map[string]*Directive { - mDirectives := make(map[string]*Directive) - for name, d := range directives { - if d.IsLocation(location...) { - mDirectives[name] = d - } - } - return mDirectives -} - -func (b *builder) buildDirectives() (map[string]*Directive, error) { - directives := make(map[string]*Directive, len(b.Schema.Directives)) - - for name, dir := range b.Schema.Directives { - if _, ok := directives[name]; ok { - return nil, fmt.Errorf("directive with name %s already exists", name) - } - - var args []*FieldArgument - for _, arg := range dir.Arguments { - tr, err := b.Binder.TypeReference(arg.Type, nil) - if err != nil { - return nil, err - } - - newArg := &FieldArgument{ - ArgumentDefinition: arg, - TypeReference: tr, - VarName: templates.ToGoPrivate(arg.Name), - } - - if arg.DefaultValue != nil { - var err error - newArg.Default, err = arg.DefaultValue.Value(nil) - if err != nil { - return nil, fmt.Errorf("default value for directive argument %s(%s) is not valid: %w", dir.Name, arg.Name, err) - } - } - args = append(args, newArg) - } - - directives[name] = &Directive{ - DirectiveDefinition: dir, - Name: name, - Args: args, - Builtin: b.Config.Directives[name].SkipRuntime, - } - } - - return directives, nil -} - -func (b *builder) getDirectives(list ast.DirectiveList) ([]*Directive, error) { - dirs := make([]*Directive, len(list)) - for i, d := range list { - argValues := make(map[string]interface{}, len(d.Arguments)) - for _, da := range d.Arguments { - val, err := da.Value.Value(nil) - if err != nil { - return nil, err - } - argValues[da.Name] = val - } - def, ok := b.Directives[d.Name] - if !ok { - return nil, fmt.Errorf("directive %s not found", d.Name) - } - - var args []*FieldArgument - for _, a := range def.Args { - value := a.Default - if argValue, ok := argValues[a.Name]; ok { - value = argValue - } - args = append(args, &FieldArgument{ - ArgumentDefinition: a.ArgumentDefinition, - Value: value, - VarName: a.VarName, - TypeReference: a.TypeReference, - }) - } - dirs[i] = &Directive{ - Name: d.Name, - Args: args, - DirectiveDefinition: list[i].Definition, - Builtin: b.Config.Directives[d.Name].SkipRuntime, - } - - } - - return dirs, nil -} - -func (d *Directive) ArgsFunc() string { - if len(d.Args) == 0 { - return "" - } - - return "dir_" + d.Name + "_args" -} - -func (d *Directive) CallArgs() string { - args := []string{"ctx", "obj", "n"} - - for _, arg := range d.Args { - args = append(args, "args["+strconv.Quote(arg.Name)+"].("+templates.CurrentImports.LookupType(arg.TypeReference.GO)+")") - } - - return strings.Join(args, ", ") -} - -func (d *Directive) ResolveArgs(obj string, next int) string { - args := []string{"ctx", obj, fmt.Sprintf("directive%d", next)} - - for _, arg := range d.Args { - dArg := arg.VarName - if arg.Value == nil && arg.Default == nil { - dArg = "nil" - } - - args = append(args, dArg) - } - - return strings.Join(args, ", ") -} - -func (d *Directive) Declaration() string { - res := ucFirst(d.Name) + " func(ctx context.Context, obj interface{}, next graphql.Resolver" - - for _, arg := range d.Args { - res += fmt.Sprintf(", %s %s", templates.ToGoPrivate(arg.Name), templates.CurrentImports.LookupType(arg.TypeReference.GO)) - } - - res += ") (res interface{}, err error)" - return res -} diff --git a/vendor/github.com/99designs/gqlgen/codegen/directives.gotpl b/vendor/github.com/99designs/gqlgen/codegen/directives.gotpl deleted file mode 100644 index 23bcf0f879..0000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/directives.gotpl +++ /dev/null @@ -1,149 +0,0 @@ -{{ define "implDirectives" }}{{ $in := .DirectiveObjName }} - {{- range $i, $directive := .ImplDirectives -}} - directive{{add $i 1}} := func(ctx context.Context) (interface{}, error) { - {{- range $arg := $directive.Args }} - {{- if notNil "Value" $arg }} - {{ $arg.VarName }}, err := ec.{{ $arg.TypeReference.UnmarshalFunc }}(ctx, {{ $arg.Value | dump }}) - if err != nil{ - return nil, err - } - {{- else if notNil "Default" $arg }} - {{ $arg.VarName }}, err := ec.{{ $arg.TypeReference.UnmarshalFunc }}(ctx, {{ $arg.Default | dump }}) - if err != nil{ - return nil, err - } - {{- end }} - {{- end }} - if ec.directives.{{$directive.Name|ucFirst}} == nil { - return nil, errors.New("directive {{$directive.Name}} is not implemented") - } - return ec.directives.{{$directive.Name|ucFirst}}({{$directive.ResolveArgs $in $i }}) - } - {{ end -}} -{{ end }} - -{{define "queryDirectives"}} - for _, d := range obj.Directives { - switch d.Name { - {{- range $directive := . }} - case "{{$directive.Name}}": - {{- if $directive.Args }} - rawArgs := d.ArgumentMap(ec.Variables) - args, err := ec.{{ $directive.ArgsFunc }}(ctx,rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - {{- end }} - n := next - next = func(ctx context.Context) (interface{}, error) { - if ec.directives.{{$directive.Name|ucFirst}} == nil { - return nil, errors.New("directive {{$directive.Name}} is not implemented") - } - return ec.directives.{{$directive.Name|ucFirst}}({{$directive.CallArgs}}) - } - {{- end }} - } - } - tmp, err := next(ctx) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if data, ok := tmp.(graphql.Marshaler); ok { - return data - } - ec.Errorf(ctx, `unexpected type %T from directive, should be graphql.Marshaler`, tmp) - return graphql.Null -{{end}} - -{{ if .Directives.LocationDirectives "QUERY" }} -func (ec *executionContext) _queryMiddleware(ctx context.Context, obj *ast.OperationDefinition, next func(ctx context.Context) (interface{}, error)) graphql.Marshaler { - {{ template "queryDirectives" .Directives.LocationDirectives "QUERY" }} -} -{{ end }} - -{{ if .Directives.LocationDirectives "MUTATION" }} -func (ec *executionContext) _mutationMiddleware(ctx context.Context, obj *ast.OperationDefinition, next func(ctx context.Context) (interface{}, error)) graphql.Marshaler { - {{ template "queryDirectives" .Directives.LocationDirectives "MUTATION" }} -} -{{ end }} - -{{ if .Directives.LocationDirectives "SUBSCRIPTION" }} -func (ec *executionContext) _subscriptionMiddleware(ctx context.Context, obj *ast.OperationDefinition, next func(ctx context.Context) (interface{}, error)) func(ctx context.Context) graphql.Marshaler { - for _, d := range obj.Directives { - switch d.Name { - {{- range $directive := .Directives.LocationDirectives "SUBSCRIPTION" }} - case "{{$directive.Name}}": - {{- if $directive.Args }} - rawArgs := d.ArgumentMap(ec.Variables) - args, err := ec.{{ $directive.ArgsFunc }}(ctx,rawArgs) - if err != nil { - ec.Error(ctx, err) - return func(ctx context.Context) graphql.Marshaler { - return graphql.Null - } - } - {{- end }} - n := next - next = func(ctx context.Context) (interface{}, error) { - if ec.directives.{{$directive.Name|ucFirst}} == nil { - return nil, errors.New("directive {{$directive.Name}} is not implemented") - } - return ec.directives.{{$directive.Name|ucFirst}}({{$directive.CallArgs}}) - } - {{- end }} - } - } - tmp, err := next(ctx) - if err != nil { - ec.Error(ctx, err) - return func(ctx context.Context) graphql.Marshaler { - return graphql.Null - } - } - if data, ok := tmp.(func(ctx context.Context) graphql.Marshaler); ok { - return data - } - ec.Errorf(ctx, `unexpected type %T from directive, should be graphql.Marshaler`, tmp) - return func(ctx context.Context) graphql.Marshaler { - return graphql.Null - } -} -{{ end }} - -{{ if .Directives.LocationDirectives "FIELD" }} - func (ec *executionContext) _fieldMiddleware(ctx context.Context, obj interface{}, next graphql.Resolver) interface{} { - {{- if .Directives.LocationDirectives "FIELD" }} - fc := graphql.GetFieldContext(ctx) - for _, d := range fc.Field.Directives { - switch d.Name { - {{- range $directive := .Directives.LocationDirectives "FIELD" }} - case "{{$directive.Name}}": - {{- if $directive.Args }} - rawArgs := d.ArgumentMap(ec.Variables) - args, err := ec.{{ $directive.ArgsFunc }}(ctx,rawArgs) - if err != nil { - ec.Error(ctx, err) - return nil - } - {{- end }} - n := next - next = func(ctx context.Context) (interface{}, error) { - if ec.directives.{{$directive.Name|ucFirst}} == nil { - return nil, errors.New("directive {{$directive.Name}} is not implemented") - } - return ec.directives.{{$directive.Name|ucFirst}}({{$directive.CallArgs}}) - } - {{- end }} - } - } - {{- end }} - res, err := ec.ResolverMiddleware(ctx, next) - if err != nil { - ec.Error(ctx, err) - return nil - } - return res - } -{{ end }} diff --git a/vendor/github.com/99designs/gqlgen/codegen/field.go b/vendor/github.com/99designs/gqlgen/codegen/field.go deleted file mode 100644 index a33cc18e5a..0000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/field.go +++ /dev/null @@ -1,580 +0,0 @@ -package codegen - -import ( - "errors" - "fmt" - "go/types" - "log" - "reflect" - "strconv" - "strings" - - "github.com/99designs/gqlgen/codegen/config" - "github.com/99designs/gqlgen/codegen/templates" - "github.com/vektah/gqlparser/v2/ast" - "golang.org/x/text/cases" - "golang.org/x/text/language" -) - -type Field struct { - *ast.FieldDefinition - - TypeReference *config.TypeReference - GoFieldType GoFieldType // The field type in go, if any - GoReceiverName string // The name of method & var receiver in go, if any - GoFieldName string // The name of the method or var in go, if any - IsResolver bool // Does this field need a resolver - Args []*FieldArgument // A list of arguments to be passed to this field - MethodHasContext bool // If this is bound to a go method, does the method also take a context - NoErr bool // If this is bound to a go method, does that method have an error as the second argument - VOkFunc bool // If this is bound to a go method, is it of shape (interface{}, bool) - Object *Object // A link back to the parent object - Default interface{} // The default value - Stream bool // does this field return a channel? - Directives []*Directive -} - -func (b *builder) buildField(obj *Object, field *ast.FieldDefinition) (*Field, error) { - dirs, err := b.getDirectives(field.Directives) - if err != nil { - return nil, err - } - - f := Field{ - FieldDefinition: field, - Object: obj, - Directives: dirs, - GoFieldName: templates.ToGo(field.Name), - GoFieldType: GoFieldVariable, - GoReceiverName: "obj", - } - - if field.DefaultValue != nil { - var err error - f.Default, err = field.DefaultValue.Value(nil) - if err != nil { - return nil, fmt.Errorf("default value %s is not valid: %w", field.Name, err) - } - } - - for _, arg := range field.Arguments { - newArg, err := b.buildArg(obj, arg) - if err != nil { - return nil, err - } - f.Args = append(f.Args, newArg) - } - - if err = b.bindField(obj, &f); err != nil { - f.IsResolver = true - if errors.Is(err, config.ErrTypeNotFound) { - return nil, err - } - log.Println(err.Error()) - } - - if f.IsResolver && b.Config.ResolversAlwaysReturnPointers && !f.TypeReference.IsPtr() && f.TypeReference.IsStruct() { - f.TypeReference = b.Binder.PointerTo(f.TypeReference) - } - - return &f, nil -} - -func (b *builder) bindField(obj *Object, f *Field) (errret error) { - defer func() { - if f.TypeReference == nil { - tr, err := b.Binder.TypeReference(f.Type, nil) - if err != nil { - errret = err - } - f.TypeReference = tr - } - if f.TypeReference != nil { - dirs, err := b.getDirectives(f.TypeReference.Definition.Directives) - if err != nil { - errret = err - } - for _, dir := range obj.Directives { - if dir.IsLocation(ast.LocationInputObject) { - dirs = append(dirs, dir) - } - } - f.Directives = append(dirs, f.Directives...) - } - }() - - f.Stream = obj.Stream - - switch { - case f.Name == "__schema": - f.GoFieldType = GoFieldMethod - f.GoReceiverName = "ec" - f.GoFieldName = "introspectSchema" - return nil - case f.Name == "__type": - f.GoFieldType = GoFieldMethod - f.GoReceiverName = "ec" - f.GoFieldName = "introspectType" - return nil - case f.Name == "_entities": - f.GoFieldType = GoFieldMethod - f.GoReceiverName = "ec" - f.GoFieldName = "__resolve_entities" - f.MethodHasContext = true - f.NoErr = true - return nil - case f.Name == "_service": - f.GoFieldType = GoFieldMethod - f.GoReceiverName = "ec" - f.GoFieldName = "__resolve__service" - f.MethodHasContext = true - return nil - case obj.Root: - f.IsResolver = true - return nil - case b.Config.Models[obj.Name].Fields[f.Name].Resolver: - f.IsResolver = true - return nil - case obj.Type == config.MapType: - f.GoFieldType = GoFieldMap - return nil - case b.Config.Models[obj.Name].Fields[f.Name].FieldName != "": - f.GoFieldName = b.Config.Models[obj.Name].Fields[f.Name].FieldName - } - - target, err := b.findBindTarget(obj.Type.(*types.Named), f.GoFieldName) - if err != nil { - return err - } - - pos := b.Binder.ObjectPosition(target) - - switch target := target.(type) { - case nil: - objPos := b.Binder.TypePosition(obj.Type) - return fmt.Errorf( - "%s:%d adding resolver method for %s.%s, nothing matched", - objPos.Filename, - objPos.Line, - obj.Name, - f.Name, - ) - - case *types.Func: - sig := target.Type().(*types.Signature) - if sig.Results().Len() == 1 { - f.NoErr = true - } else if s := sig.Results(); s.Len() == 2 && s.At(1).Type().String() == "bool" { - f.VOkFunc = true - } else if sig.Results().Len() != 2 { - return fmt.Errorf("method has wrong number of args") - } - params := sig.Params() - // If the first argument is the context, remove it from the comparison and set - // the MethodHasContext flag so that the context will be passed to this model's method - if params.Len() > 0 && params.At(0).Type().String() == "context.Context" { - f.MethodHasContext = true - vars := make([]*types.Var, params.Len()-1) - for i := 1; i < params.Len(); i++ { - vars[i-1] = params.At(i) - } - params = types.NewTuple(vars...) - } - - // Try to match target function's arguments with GraphQL field arguments. - newArgs, err := b.bindArgs(f, sig, params) - if err != nil { - return fmt.Errorf("%s:%d: %w", pos.Filename, pos.Line, err) - } - - // Try to match target function's return types with GraphQL field return type - result := sig.Results().At(0) - tr, err := b.Binder.TypeReference(f.Type, result.Type()) - if err != nil { - return err - } - - // success, args and return type match. Bind to method - f.GoFieldType = GoFieldMethod - f.GoReceiverName = "obj" - f.GoFieldName = target.Name() - f.Args = newArgs - f.TypeReference = tr - - return nil - - case *types.Var: - tr, err := b.Binder.TypeReference(f.Type, target.Type()) - if err != nil { - return err - } - - // success, bind to var - f.GoFieldType = GoFieldVariable - f.GoReceiverName = "obj" - f.GoFieldName = target.Name() - f.TypeReference = tr - - return nil - default: - panic(fmt.Errorf("unknown bind target %T for %s", target, f.Name)) - } -} - -// findBindTarget attempts to match the name to a field or method on a Type -// with the following priorites: -// 1. Any Fields with a struct tag (see config.StructTag). Errors if more than one match is found -// 2. Any method or field with a matching name. Errors if more than one match is found -// 3. Same logic again for embedded fields -func (b *builder) findBindTarget(t types.Type, name string) (types.Object, error) { - // NOTE: a struct tag will override both methods and fields - // Bind to struct tag - found, err := b.findBindStructTagTarget(t, name) - if found != nil || err != nil { - return found, err - } - - // Search for a method to bind to - foundMethod, err := b.findBindMethodTarget(t, name) - if err != nil { - return nil, err - } - - // Search for a field to bind to - foundField, err := b.findBindFieldTarget(t, name) - if err != nil { - return nil, err - } - - switch { - case foundField == nil && foundMethod != nil: - // Bind to method - return foundMethod, nil - case foundField != nil && foundMethod == nil: - // Bind to field - return foundField, nil - case foundField != nil && foundMethod != nil: - // Error - return nil, fmt.Errorf("found more than one way to bind for %s", name) - } - - // Search embeds - return b.findBindEmbedsTarget(t, name) -} - -func (b *builder) findBindStructTagTarget(in types.Type, name string) (types.Object, error) { - if b.Config.StructTag == "" { - return nil, nil - } - - switch t := in.(type) { - case *types.Named: - return b.findBindStructTagTarget(t.Underlying(), name) - case *types.Struct: - var found types.Object - for i := 0; i < t.NumFields(); i++ { - field := t.Field(i) - if !field.Exported() || field.Embedded() { - continue - } - tags := reflect.StructTag(t.Tag(i)) - if val, ok := tags.Lookup(b.Config.StructTag); ok && equalFieldName(val, name) { - if found != nil { - return nil, fmt.Errorf("tag %s is ambigious; multiple fields have the same tag value of %s", b.Config.StructTag, val) - } - - found = field - } - } - - return found, nil - } - - return nil, nil -} - -func (b *builder) findBindMethodTarget(in types.Type, name string) (types.Object, error) { - switch t := in.(type) { - case *types.Named: - if _, ok := t.Underlying().(*types.Interface); ok { - return b.findBindMethodTarget(t.Underlying(), name) - } - - return b.findBindMethoderTarget(t.Method, t.NumMethods(), name) - case *types.Interface: - // FIX-ME: Should use ExplicitMethod here? What's the difference? - return b.findBindMethoderTarget(t.Method, t.NumMethods(), name) - } - - return nil, nil -} - -func (b *builder) findBindMethoderTarget(methodFunc func(i int) *types.Func, methodCount int, name string) (types.Object, error) { - var found types.Object - for i := 0; i < methodCount; i++ { - method := methodFunc(i) - if !method.Exported() || !strings.EqualFold(method.Name(), name) { - continue - } - - if found != nil { - return nil, fmt.Errorf("found more than one matching method to bind for %s", name) - } - - found = method - } - - return found, nil -} - -func (b *builder) findBindFieldTarget(in types.Type, name string) (types.Object, error) { - switch t := in.(type) { - case *types.Named: - return b.findBindFieldTarget(t.Underlying(), name) - case *types.Struct: - var found types.Object - for i := 0; i < t.NumFields(); i++ { - field := t.Field(i) - if !field.Exported() || !equalFieldName(field.Name(), name) { - continue - } - - if found != nil { - return nil, fmt.Errorf("found more than one matching field to bind for %s", name) - } - - found = field - } - - return found, nil - } - - return nil, nil -} - -func (b *builder) findBindEmbedsTarget(in types.Type, name string) (types.Object, error) { - switch t := in.(type) { - case *types.Named: - return b.findBindEmbedsTarget(t.Underlying(), name) - case *types.Struct: - return b.findBindStructEmbedsTarget(t, name) - case *types.Interface: - return b.findBindInterfaceEmbedsTarget(t, name) - } - - return nil, nil -} - -func (b *builder) findBindStructEmbedsTarget(strukt *types.Struct, name string) (types.Object, error) { - var found types.Object - for i := 0; i < strukt.NumFields(); i++ { - field := strukt.Field(i) - if !field.Embedded() { - continue - } - - fieldType := field.Type() - if ptr, ok := fieldType.(*types.Pointer); ok { - fieldType = ptr.Elem() - } - - f, err := b.findBindTarget(fieldType, name) - if err != nil { - return nil, err - } - - if f != nil && found != nil { - return nil, fmt.Errorf("found more than one way to bind for %s", name) - } - - if f != nil { - found = f - } - } - - return found, nil -} - -func (b *builder) findBindInterfaceEmbedsTarget(iface *types.Interface, name string) (types.Object, error) { - var found types.Object - for i := 0; i < iface.NumEmbeddeds(); i++ { - embeddedType := iface.EmbeddedType(i) - - f, err := b.findBindTarget(embeddedType, name) - if err != nil { - return nil, err - } - - if f != nil && found != nil { - return nil, fmt.Errorf("found more than one way to bind for %s", name) - } - - if f != nil { - found = f - } - } - - return found, nil -} - -func (f *Field) HasDirectives() bool { - return len(f.ImplDirectives()) > 0 -} - -func (f *Field) DirectiveObjName() string { - if f.Object.Root { - return "nil" - } - return f.GoReceiverName -} - -func (f *Field) ImplDirectives() []*Directive { - var d []*Directive - loc := ast.LocationFieldDefinition - if f.Object.IsInputType() { - loc = ast.LocationInputFieldDefinition - } - for i := range f.Directives { - if !f.Directives[i].Builtin && - (f.Directives[i].IsLocation(loc, ast.LocationObject) || f.Directives[i].IsLocation(loc, ast.LocationInputObject)) { - d = append(d, f.Directives[i]) - } - } - return d -} - -func (f *Field) IsReserved() bool { - return strings.HasPrefix(f.Name, "__") -} - -func (f *Field) IsMethod() bool { - return f.GoFieldType == GoFieldMethod -} - -func (f *Field) IsVariable() bool { - return f.GoFieldType == GoFieldVariable -} - -func (f *Field) IsMap() bool { - return f.GoFieldType == GoFieldMap -} - -func (f *Field) IsConcurrent() bool { - if f.Object.DisableConcurrency { - return false - } - return f.MethodHasContext || f.IsResolver -} - -func (f *Field) GoNameUnexported() string { - return templates.ToGoPrivate(f.Name) -} - -func (f *Field) ShortInvocation() string { - caser := cases.Title(language.English, cases.NoLower) - if f.Object.Kind == ast.InputObject { - return fmt.Sprintf("%s().%s(ctx, &it, data)", caser.String(f.Object.Definition.Name), f.GoFieldName) - } - return fmt.Sprintf("%s().%s(%s)", caser.String(f.Object.Definition.Name), f.GoFieldName, f.CallArgs()) -} - -func (f *Field) ArgsFunc() string { - if len(f.Args) == 0 { - return "" - } - - return "field_" + f.Object.Definition.Name + "_" + f.Name + "_args" -} - -func (f *Field) FieldContextFunc() string { - return "fieldContext_" + f.Object.Definition.Name + "_" + f.Name -} - -func (f *Field) ChildFieldContextFunc(name string) string { - return "fieldContext_" + f.TypeReference.Definition.Name + "_" + name -} - -func (f *Field) ResolverType() string { - if !f.IsResolver { - return "" - } - - return fmt.Sprintf("%s().%s(%s)", f.Object.Definition.Name, f.GoFieldName, f.CallArgs()) -} - -func (f *Field) ShortResolverDeclaration() string { - if f.Object.Kind == ast.InputObject { - return fmt.Sprintf("(ctx context.Context, obj %s, data %s) error", - templates.CurrentImports.LookupType(f.Object.Reference()), - templates.CurrentImports.LookupType(f.TypeReference.GO), - ) - } - - res := "(ctx context.Context" - - if !f.Object.Root { - res += fmt.Sprintf(", obj %s", templates.CurrentImports.LookupType(f.Object.Reference())) - } - for _, arg := range f.Args { - res += fmt.Sprintf(", %s %s", arg.VarName, templates.CurrentImports.LookupType(arg.TypeReference.GO)) - } - - result := templates.CurrentImports.LookupType(f.TypeReference.GO) - if f.Object.Stream { - result = "<-chan " + result - } - - res += fmt.Sprintf(") (%s, error)", result) - return res -} - -func (f *Field) ComplexitySignature() string { - res := "func(childComplexity int" - for _, arg := range f.Args { - res += fmt.Sprintf(", %s %s", arg.VarName, templates.CurrentImports.LookupType(arg.TypeReference.GO)) - } - res += ") int" - return res -} - -func (f *Field) ComplexityArgs() string { - args := make([]string, len(f.Args)) - for i, arg := range f.Args { - args[i] = "args[" + strconv.Quote(arg.Name) + "].(" + templates.CurrentImports.LookupType(arg.TypeReference.GO) + ")" - } - - return strings.Join(args, ", ") -} - -func (f *Field) CallArgs() string { - args := make([]string, 0, len(f.Args)+2) - - if f.IsResolver { - args = append(args, "rctx") - - if !f.Object.Root { - args = append(args, "obj") - } - } else if f.MethodHasContext { - args = append(args, "ctx") - } - - for _, arg := range f.Args { - tmp := "fc.Args[" + strconv.Quote(arg.Name) + "].(" + templates.CurrentImports.LookupType(arg.TypeReference.GO) + ")" - - if iface, ok := arg.TypeReference.GO.(*types.Interface); ok && iface.Empty() { - tmp = fmt.Sprintf(` - func () interface{} { - if fc.Args["%s"] == nil { - return nil - } - return fc.Args["%s"].(interface{}) - }()`, arg.Name, arg.Name, - ) - } - - args = append(args, tmp) - } - - return strings.Join(args, ", ") -} diff --git a/vendor/github.com/99designs/gqlgen/codegen/field.gotpl b/vendor/github.com/99designs/gqlgen/codegen/field.gotpl deleted file mode 100644 index e47b958dda..0000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/field.gotpl +++ /dev/null @@ -1,158 +0,0 @@ -{{- range $object := .Objects }}{{- range $field := $object.Fields }} - -func (ec *executionContext) _{{$object.Name}}_{{$field.Name}}(ctx context.Context, field graphql.CollectedField{{ if not $object.Root }}, obj {{$object.Reference | ref}}{{end}}) (ret {{ if $object.Stream }}func(ctx context.Context){{ end }}graphql.Marshaler) { - {{- $null := "graphql.Null" }} - {{- if $object.Stream }} - {{- $null = "nil" }} - {{- end }} - fc, err := ec.{{ $field.FieldContextFunc }}(ctx, field) - if err != nil { - return {{ $null }} - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func () { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = {{ $null }} - } - }() - {{- if $.AllDirectives.LocationDirectives "FIELD" }} - resTmp := ec._fieldMiddleware(ctx, {{if $object.Root}}nil{{else}}obj{{end}}, func(rctx context.Context) (interface{}, error) { - {{ template "field" $field }} - }) - {{ else }} - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - {{ template "field" $field }} - }) - if err != nil { - ec.Error(ctx, err) - return {{ $null }} - } - {{- end }} - if resTmp == nil { - {{- if $field.TypeReference.GQL.NonNull }} - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - {{- end }} - return {{ $null }} - } - {{- if $object.Stream }} - return func(ctx context.Context) graphql.Marshaler { - select { - case res, ok := <-resTmp.(<-chan {{$field.TypeReference.GO | ref}}): - if !ok { - return nil - } - return graphql.WriterFunc(func(w io.Writer) { - w.Write([]byte{'{'}) - graphql.MarshalString(field.Alias).MarshalGQL(w) - w.Write([]byte{':'}) - ec.{{ $field.TypeReference.MarshalFunc }}(ctx, field.Selections, res).MarshalGQL(w) - w.Write([]byte{'}'}) - }) - case <-ctx.Done(): - return nil - } - } - {{- else }} - res := resTmp.({{$field.TypeReference.GO | ref}}) - fc.Result = res - return ec.{{ $field.TypeReference.MarshalFunc }}(ctx, field.Selections, res) - {{- end }} -} - -func (ec *executionContext) {{ $field.FieldContextFunc }}(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: {{quote $field.Object.Name}}, - Field: field, - IsMethod: {{or $field.IsMethod $field.IsResolver}}, - IsResolver: {{ $field.IsResolver }}, - Child: func (ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - {{- if not $field.TypeReference.Definition.Fields }} - return nil, errors.New("field of type {{ $field.TypeReference.Definition.Name }} does not have child fields") - {{- else if ne $field.TypeReference.Definition.Kind "OBJECT" }} - return nil, errors.New("FieldContext.Child cannot be called on type {{ $field.TypeReference.Definition.Kind }}") - {{- else }} - switch field.Name { - {{- range $f := $field.TypeReference.Definition.Fields }} - case "{{ $f.Name }}": - return ec.{{ $field.ChildFieldContextFunc $f.Name }}(ctx, field) - {{- end }} - } - return nil, fmt.Errorf("no field named %q was found under type {{ $field.TypeReference.Definition.Name }}", field.Name) - {{- end }} - }, - } - {{- if $field.Args }} - defer func () { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.{{ $field.ArgsFunc }}(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return - } - {{- end }} - return fc, nil -} - -{{- end }}{{- end}} - -{{ define "field" }} - {{- if .HasDirectives -}} - directive0 := func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - {{ template "fieldDefinition" . }} - } - {{ template "implDirectives" . }} - tmp, err := directive{{.ImplDirectives|len}}(rctx) - if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) - } - if tmp == nil { - return nil, nil - } - if data, ok := tmp.({{if .Stream}}<-chan {{end}}{{ .TypeReference.GO | ref }}) ; ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be {{if .Stream}}<-chan {{end}}{{ .TypeReference.GO }}`, tmp) - {{- else -}} - ctx = rctx // use context from middleware stack in children - {{ template "fieldDefinition" . }} - {{- end -}} -{{ end }} - -{{ define "fieldDefinition" }} - {{- if .IsResolver -}} - return ec.resolvers.{{ .ShortInvocation }} - {{- else if .IsMap -}} - switch v := {{.GoReceiverName}}[{{.Name|quote}}].(type) { - case {{if .Stream}}<-chan {{end}}{{.TypeReference.GO | ref}}: - return v, nil - case {{if .Stream}}<-chan {{end}}{{.TypeReference.Elem.GO | ref}}: - return &v, nil - case nil: - return ({{.TypeReference.GO | ref}})(nil), nil - default: - return nil, fmt.Errorf("unexpected type %T for field %s", v, {{ .Name | quote}}) - } - {{- else if .IsMethod -}} - {{- if .VOkFunc -}} - v, ok := {{.GoReceiverName}}.{{.GoFieldName}}({{ .CallArgs }}) - if !ok { - return nil, nil - } - return v, nil - {{- else if .NoErr -}} - return {{.GoReceiverName}}.{{.GoFieldName}}({{ .CallArgs }}), nil - {{- else -}} - return {{.GoReceiverName}}.{{.GoFieldName}}({{ .CallArgs }}) - {{- end -}} - {{- else if .IsVariable -}} - return {{.GoReceiverName}}.{{.GoFieldName}}, nil - {{- end }} -{{- end }} diff --git a/vendor/github.com/99designs/gqlgen/codegen/generate.go b/vendor/github.com/99designs/gqlgen/codegen/generate.go deleted file mode 100644 index 1ce8c329dc..0000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/generate.go +++ /dev/null @@ -1,220 +0,0 @@ -package codegen - -import ( - "embed" - "errors" - "fmt" - "os" - "path/filepath" - "runtime" - "strings" - - "github.com/99designs/gqlgen/codegen/config" - "github.com/99designs/gqlgen/codegen/templates" - "github.com/vektah/gqlparser/v2/ast" -) - -//go:embed *.gotpl -var codegenTemplates embed.FS - -func GenerateCode(data *Data) error { - if !data.Config.Exec.IsDefined() { - return fmt.Errorf("missing exec config") - } - - switch data.Config.Exec.Layout { - case config.ExecLayoutSingleFile: - return generateSingleFile(data) - case config.ExecLayoutFollowSchema: - return generatePerSchema(data) - } - - return fmt.Errorf("unrecognized exec layout %s", data.Config.Exec.Layout) -} - -func generateSingleFile(data *Data) error { - return templates.Render(templates.Options{ - PackageName: data.Config.Exec.Package, - Filename: data.Config.Exec.Filename, - Data: data, - RegionTags: true, - GeneratedHeader: true, - Packages: data.Config.Packages, - TemplateFS: codegenTemplates, - }) -} - -func generatePerSchema(data *Data) error { - err := generateRootFile(data) - if err != nil { - return err - } - - builds := map[string]*Data{} - - err = addObjects(data, &builds) - if err != nil { - return err - } - - err = addInputs(data, &builds) - if err != nil { - return err - } - - err = addInterfaces(data, &builds) - if err != nil { - return err - } - - err = addReferencedTypes(data, &builds) - if err != nil { - return err - } - - for filename, build := range builds { - if filename == "" { - continue - } - - dir := data.Config.Exec.DirName - path := filepath.Join(dir, filename) - - err = templates.Render(templates.Options{ - PackageName: data.Config.Exec.Package, - Filename: path, - Data: build, - RegionTags: true, - GeneratedHeader: true, - Packages: data.Config.Packages, - TemplateFS: codegenTemplates, - }) - if err != nil { - return err - } - } - - return nil -} - -func filename(p *ast.Position, config *config.Config) string { - name := "common!" - if p != nil && p.Src != nil { - gqlname := filepath.Base(p.Src.Name) - ext := filepath.Ext(p.Src.Name) - name = strings.TrimSuffix(gqlname, ext) - } - - filenameTempl := config.Exec.FilenameTemplate - if filenameTempl == "" { - filenameTempl = "{name}.generated.go" - } - - return strings.ReplaceAll(filenameTempl, "{name}", name) -} - -func addBuild(filename string, p *ast.Position, data *Data, builds *map[string]*Data) { - buildConfig := *data.Config - if p != nil { - buildConfig.Sources = []*ast.Source{p.Src} - } - - (*builds)[filename] = &Data{ - Config: &buildConfig, - QueryRoot: data.QueryRoot, - MutationRoot: data.MutationRoot, - SubscriptionRoot: data.SubscriptionRoot, - AllDirectives: data.AllDirectives, - } -} - -// Root file contains top-level definitions that should not be duplicated across the generated -// files for each schema file. -func generateRootFile(data *Data) error { - dir := data.Config.Exec.DirName - path := filepath.Join(dir, "root_.generated.go") - - _, thisFile, _, _ := runtime.Caller(0) - rootDir := filepath.Dir(thisFile) - templatePath := filepath.Join(rootDir, "root_.gotpl") - templateBytes, err := os.ReadFile(templatePath) - if err != nil { - return err - } - template := string(templateBytes) - - return templates.Render(templates.Options{ - PackageName: data.Config.Exec.Package, - Template: template, - Filename: path, - Data: data, - RegionTags: false, - GeneratedHeader: true, - Packages: data.Config.Packages, - TemplateFS: codegenTemplates, - }) -} - -func addObjects(data *Data, builds *map[string]*Data) error { - for _, o := range data.Objects { - filename := filename(o.Position, data.Config) - if (*builds)[filename] == nil { - addBuild(filename, o.Position, data, builds) - } - - (*builds)[filename].Objects = append((*builds)[filename].Objects, o) - } - return nil -} - -func addInputs(data *Data, builds *map[string]*Data) error { - for _, in := range data.Inputs { - filename := filename(in.Position, data.Config) - if (*builds)[filename] == nil { - addBuild(filename, in.Position, data, builds) - } - - (*builds)[filename].Inputs = append((*builds)[filename].Inputs, in) - } - return nil -} - -func addInterfaces(data *Data, builds *map[string]*Data) error { - for k, inf := range data.Interfaces { - filename := filename(inf.Position, data.Config) - if (*builds)[filename] == nil { - addBuild(filename, inf.Position, data, builds) - } - build := (*builds)[filename] - - if build.Interfaces == nil { - build.Interfaces = map[string]*Interface{} - } - if build.Interfaces[k] != nil { - return errors.New("conflicting interface keys") - } - - build.Interfaces[k] = inf - } - return nil -} - -func addReferencedTypes(data *Data, builds *map[string]*Data) error { - for k, rt := range data.ReferencedTypes { - filename := filename(rt.Definition.Position, data.Config) - if (*builds)[filename] == nil { - addBuild(filename, rt.Definition.Position, data, builds) - } - build := (*builds)[filename] - - if build.ReferencedTypes == nil { - build.ReferencedTypes = map[string]*config.TypeReference{} - } - if build.ReferencedTypes[k] != nil { - return errors.New("conflicting referenced type keys") - } - - build.ReferencedTypes[k] = rt - } - return nil -} diff --git a/vendor/github.com/99designs/gqlgen/codegen/generated!.gotpl b/vendor/github.com/99designs/gqlgen/codegen/generated!.gotpl deleted file mode 100644 index 0998c77502..0000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/generated!.gotpl +++ /dev/null @@ -1,258 +0,0 @@ -{{ reserveImport "context" }} -{{ reserveImport "fmt" }} -{{ reserveImport "io" }} -{{ reserveImport "strconv" }} -{{ reserveImport "time" }} -{{ reserveImport "sync" }} -{{ reserveImport "sync/atomic" }} -{{ reserveImport "errors" }} -{{ reserveImport "bytes" }} -{{ reserveImport "embed" }} - -{{ reserveImport "github.com/vektah/gqlparser/v2" "gqlparser" }} -{{ reserveImport "github.com/vektah/gqlparser/v2/ast" }} -{{ reserveImport "github.com/99designs/gqlgen/graphql" }} -{{ reserveImport "github.com/99designs/gqlgen/graphql/introspection" }} - - -{{ if eq .Config.Exec.Layout "single-file" }} - // NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface. - func NewExecutableSchema(cfg Config) graphql.ExecutableSchema { - return &executableSchema{ - resolvers: cfg.Resolvers, - directives: cfg.Directives, - complexity: cfg.Complexity, - } - } - - type Config struct { - Resolvers ResolverRoot - Directives DirectiveRoot - Complexity ComplexityRoot - } - - type ResolverRoot interface { - {{- range $object := .Objects -}} - {{ if $object.HasResolvers -}} - {{ucFirst $object.Name}}() {{ucFirst $object.Name}}Resolver - {{ end }} - {{- end }} - {{- range $object := .Inputs -}} - {{ if $object.HasResolvers -}} - {{ucFirst $object.Name}}() {{ucFirst $object.Name}}Resolver - {{ end }} -{{- end }} -} - - type DirectiveRoot struct { - {{ range $directive := .Directives }} - {{- $directive.Declaration }} - {{ end }} - } - - type ComplexityRoot struct { - {{ range $object := .Objects }} - {{ if not $object.IsReserved -}} - {{ ucFirst $object.Name }} struct { - {{ range $_, $fields := $object.UniqueFields }} - {{- $field := index $fields 0 -}} - {{ if not $field.IsReserved -}} - {{ $field.GoFieldName }} {{ $field.ComplexitySignature }} - {{ end }} - {{- end }} - } - {{- end }} - {{ end }} - } -{{ end }} - -{{ range $object := .Objects -}} - {{ if $object.HasResolvers }} - type {{ucFirst $object.Name}}Resolver interface { - {{ range $field := $object.Fields -}} - {{- if $field.IsResolver }} - {{- $field.GoFieldName}}{{ $field.ShortResolverDeclaration }} - {{- end }} - {{ end }} - } - {{- end }} -{{- end }} - -{{ range $object := .Inputs -}} - {{ if $object.HasResolvers }} - type {{$object.Name}}Resolver interface { - {{ range $field := $object.Fields -}} - {{- if $field.IsResolver }} - {{- $field.GoFieldName}}{{ $field.ShortResolverDeclaration }} - {{- end }} - {{ end }} - } - {{- end }} -{{- end }} - -{{ if eq .Config.Exec.Layout "single-file" }} - type executableSchema struct { - resolvers ResolverRoot - directives DirectiveRoot - complexity ComplexityRoot - } - - func (e *executableSchema) Schema() *ast.Schema { - return parsedSchema - } - - func (e *executableSchema) Complexity(typeName, field string, childComplexity int, rawArgs map[string]interface{}) (int, bool) { - ec := executionContext{nil, e} - _ = ec - switch typeName + "." + field { - {{ range $object := .Objects }} - {{ if not $object.IsReserved }} - {{ range $_, $fields := $object.UniqueFields }} - {{- $len := len $fields }} - {{- range $i, $field := $fields }} - {{- $last := eq (add $i 1) $len }} - {{- if not $field.IsReserved }} - {{- if eq $i 0 }}case {{ end }}"{{$object.Name}}.{{$field.Name}}"{{ if not $last }},{{ else }}: - if e.complexity.{{ucFirst $object.Name}}.{{$field.GoFieldName}} == nil { - break - } - {{ if $field.Args }} - args, err := ec.{{ $field.ArgsFunc }}(context.TODO(),rawArgs) - if err != nil { - return 0, false - } - {{ end }} - return e.complexity.{{ucFirst $object.Name}}.{{$field.GoFieldName}}(childComplexity{{if $field.Args}}, {{$field.ComplexityArgs}} {{ end }}), true - {{ end }} - {{- end }} - {{- end }} - {{ end }} - {{ end }} - {{ end }} - } - return 0, false - } - - func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetOperationContext(ctx) - ec := executionContext{rc, e} - inputUnmarshalMap := graphql.BuildUnmarshalerMap( - {{- range $input := .Inputs -}} - {{ if not $input.HasUnmarshal }} - ec.unmarshalInput{{ $input.Name }}, - {{- end }} - {{- end }} - ) - first := true - - switch rc.Operation.Operation { - {{- if .QueryRoot }} case ast.Query: - return func(ctx context.Context) *graphql.Response { - if !first { return nil } - first = false - ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - {{ if .Directives.LocationDirectives "QUERY" -}} - data := ec._queryMiddleware(ctx, rc.Operation, func(ctx context.Context) (interface{}, error){ - return ec._{{.QueryRoot.Name}}(ctx, rc.Operation.SelectionSet), nil - }) - {{- else -}} - data := ec._{{.QueryRoot.Name}}(ctx, rc.Operation.SelectionSet) - {{- end }} - var buf bytes.Buffer - data.MarshalGQL(&buf) - - return &graphql.Response{ - Data: buf.Bytes(), - } - } - {{ end }} - - {{- if .MutationRoot }} case ast.Mutation: - return func(ctx context.Context) *graphql.Response { - if !first { return nil } - first = false - ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - {{ if .Directives.LocationDirectives "MUTATION" -}} - data := ec._mutationMiddleware(ctx, rc.Operation, func(ctx context.Context) (interface{}, error){ - return ec._{{.MutationRoot.Name}}(ctx, rc.Operation.SelectionSet), nil - }) - {{- else -}} - data := ec._{{.MutationRoot.Name}}(ctx, rc.Operation.SelectionSet) - {{- end }} - var buf bytes.Buffer - data.MarshalGQL(&buf) - - return &graphql.Response{ - Data: buf.Bytes(), - } - } - {{ end }} - - {{- if .SubscriptionRoot }} case ast.Subscription: - {{ if .Directives.LocationDirectives "SUBSCRIPTION" -}} - next := ec._subscriptionMiddleware(ctx, rc.Operation, func(ctx context.Context) (interface{}, error){ - return ec._{{.SubscriptionRoot.Name}}(ctx, rc.Operation.SelectionSet),nil - }) - {{- else -}} - next := ec._{{.SubscriptionRoot.Name}}(ctx, rc.Operation.SelectionSet) - {{- end }} - - var buf bytes.Buffer - return func(ctx context.Context) *graphql.Response { - buf.Reset() - data := next(ctx) - - if data == nil { - return nil - } - data.MarshalGQL(&buf) - - return &graphql.Response{ - Data: buf.Bytes(), - } - } - {{ end }} - default: - return graphql.OneShot(graphql.ErrorResponse(ctx, "unsupported GraphQL operation")) - } - } - - type executionContext struct { - *graphql.OperationContext - *executableSchema - } - - func (ec *executionContext) introspectSchema() (*introspection.Schema, error) { - if ec.DisableIntrospection { - return nil, errors.New("introspection disabled") - } - return introspection.WrapSchema(parsedSchema), nil - } - - func (ec *executionContext) introspectType(name string) (*introspection.Type, error) { - if ec.DisableIntrospection { - return nil, errors.New("introspection disabled") - } - return introspection.WrapTypeFromDef(parsedSchema, parsedSchema.Types[name]), nil - } - - {{if .HasEmbeddableSources }} - //go:embed{{- range $source := .AugmentedSources }}{{if $source.Embeddable}} {{$source.RelativePath|quote}}{{end}}{{- end }} - var sourcesFS embed.FS - - func sourceData(filename string) string { - data, err := sourcesFS.ReadFile(filename) - if err != nil { - panic(fmt.Sprintf("codegen problem: %s not available", filename)) - } - return string(data) - } - {{- end }} - - var sources = []*ast.Source{ - {{- range $source := .AugmentedSources }} - {Name: {{$source.RelativePath|quote}}, Input: {{if (not $source.Embeddable)}}{{$source.Source|rawQuote}}{{else}}sourceData({{$source.RelativePath|quote}}){{end}}, BuiltIn: {{$source.BuiltIn}}}, - {{- end }} - } - var parsedSchema = gqlparser.MustLoadSchema(sources...) -{{ end }} diff --git a/vendor/github.com/99designs/gqlgen/codegen/input.gotpl b/vendor/github.com/99designs/gqlgen/codegen/input.gotpl deleted file mode 100644 index 116fe9ce76..0000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/input.gotpl +++ /dev/null @@ -1,77 +0,0 @@ -{{- range $input := .Inputs }} - {{- if not .HasUnmarshal }} - func (ec *executionContext) unmarshalInput{{ .Name }}(ctx context.Context, obj interface{}) ({{.Type | ref}}, error) { - var it {{.Type | ref}} - asMap := map[string]interface{}{} - for k, v := range obj.(map[string]interface{}) { - asMap[k] = v - } - {{ range $field := .Fields}} - {{- if notNil "Default" $field }} - if _, present := asMap[{{$field.Name|quote}}] ; !present { - asMap[{{$field.Name|quote}}] = {{ $field.Default | dump }} - } - {{- end}} - {{- end }} - - fieldsInOrder := [...]string{ {{ range .Fields }}{{ quote .Name }},{{ end }} } - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - {{- range $field := .Fields }} - case {{$field.Name|quote}}: - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField({{$field.Name|quote}})) - {{- if $field.ImplDirectives }} - directive0 := func(ctx context.Context) (interface{}, error) { return ec.{{ $field.TypeReference.UnmarshalFunc }}(ctx, v) } - {{ template "implDirectives" $field }} - tmp, err := directive{{$field.ImplDirectives|len}}(ctx) - if err != nil { - return it, graphql.ErrorOnPath(ctx, err) - } - if data, ok := tmp.({{ $field.TypeReference.GO | ref }}) ; ok { - {{- if $field.IsResolver }} - if err = ec.resolvers.{{ $field.ShortInvocation }}; err != nil { - return it, err - } - {{- else }} - it.{{$field.GoFieldName}} = data - {{- end }} - {{- if $field.TypeReference.IsNilable }} - {{- if not $field.IsResolver }} - } else if tmp == nil { - it.{{$field.GoFieldName}} = nil - {{- end }} - {{- end }} - } else { - err := fmt.Errorf(`unexpected type %T from directive, should be {{ $field.TypeReference.GO }}`, tmp) - return it, graphql.ErrorOnPath(ctx, err) - } - {{- else }} - {{- if $field.IsResolver }} - data, err := ec.{{ $field.TypeReference.UnmarshalFunc }}(ctx, v) - if err != nil { - return it, err - } - if err = ec.resolvers.{{ $field.ShortInvocation }}; err != nil { - return it, err - } - {{- else }} - it.{{$field.GoFieldName}}, err = ec.{{ $field.TypeReference.UnmarshalFunc }}(ctx, v) - if err != nil { - return it, err - } - {{- end }} - {{- end }} - {{- end }} - } - } - - return it, nil - } - {{- end }} -{{ end }} diff --git a/vendor/github.com/99designs/gqlgen/codegen/interface.go b/vendor/github.com/99designs/gqlgen/codegen/interface.go deleted file mode 100644 index cdc4d4d32e..0000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/interface.go +++ /dev/null @@ -1,87 +0,0 @@ -package codegen - -import ( - "fmt" - "go/types" - - "github.com/vektah/gqlparser/v2/ast" - - "github.com/99designs/gqlgen/codegen/config" -) - -type Interface struct { - *ast.Definition - Type types.Type - Implementors []InterfaceImplementor - InTypemap bool -} - -type InterfaceImplementor struct { - *ast.Definition - - Type types.Type - TakeRef bool -} - -func (b *builder) buildInterface(typ *ast.Definition) (*Interface, error) { - obj, err := b.Binder.DefaultUserObject(typ.Name) - if err != nil { - panic(err) - } - - i := &Interface{ - Definition: typ, - Type: obj, - InTypemap: b.Config.Models.UserDefined(typ.Name), - } - - interfaceType, err := findGoInterface(i.Type) - if interfaceType == nil || err != nil { - return nil, fmt.Errorf("%s is not an interface", i.Type) - } - - for _, implementor := range b.Schema.GetPossibleTypes(typ) { - obj, err := b.Binder.DefaultUserObject(implementor.Name) - if err != nil { - return nil, fmt.Errorf("%s has no backing go type", implementor.Name) - } - - implementorType, err := findGoNamedType(obj) - if err != nil { - return nil, fmt.Errorf("can not find backing go type %s: %w", obj.String(), err) - } else if implementorType == nil { - return nil, fmt.Errorf("can not find backing go type %s", obj.String()) - } - - anyValid := false - - // first check if the value receiver can be nil, eg can we type switch on case Thing: - if types.Implements(implementorType, interfaceType) { - i.Implementors = append(i.Implementors, InterfaceImplementor{ - Definition: implementor, - Type: obj, - TakeRef: !types.IsInterface(obj), - }) - anyValid = true - } - - // then check if the pointer receiver can be nil, eg can we type switch on case *Thing: - if types.Implements(types.NewPointer(implementorType), interfaceType) { - i.Implementors = append(i.Implementors, InterfaceImplementor{ - Definition: implementor, - Type: types.NewPointer(obj), - }) - anyValid = true - } - - if !anyValid { - return nil, fmt.Errorf("%s does not satisfy the interface %s", implementorType.String(), i.Type.String()) - } - } - - return i, nil -} - -func (i *InterfaceImplementor) CanBeNil() bool { - return config.IsNilable(i.Type) -} diff --git a/vendor/github.com/99designs/gqlgen/codegen/interface.gotpl b/vendor/github.com/99designs/gqlgen/codegen/interface.gotpl deleted file mode 100644 index e9d560c8f6..0000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/interface.gotpl +++ /dev/null @@ -1,21 +0,0 @@ -{{- range $interface := .Interfaces }} - -func (ec *executionContext) _{{$interface.Name}}(ctx context.Context, sel ast.SelectionSet, obj {{$interface.Type | ref}}) graphql.Marshaler { - switch obj := (obj).(type) { - case nil: - return graphql.Null - {{- range $implementor := $interface.Implementors }} - case {{$implementor.Type | ref}}: - {{- if $implementor.CanBeNil }} - if obj == nil { - return graphql.Null - } - {{- end }} - return ec._{{$implementor.Name}}(ctx, sel, {{ if $implementor.TakeRef }}&{{ end }}obj) - {{- end }} - default: - panic(fmt.Errorf("unexpected type %T", obj)) - } -} - -{{- end }} diff --git a/vendor/github.com/99designs/gqlgen/codegen/object.go b/vendor/github.com/99designs/gqlgen/codegen/object.go deleted file mode 100644 index a9cb34061b..0000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/object.go +++ /dev/null @@ -1,171 +0,0 @@ -package codegen - -import ( - "fmt" - "go/types" - "strconv" - "strings" - "unicode" - - "github.com/99designs/gqlgen/codegen/config" - "github.com/vektah/gqlparser/v2/ast" - "golang.org/x/text/cases" - "golang.org/x/text/language" -) - -type GoFieldType int - -const ( - GoFieldUndefined GoFieldType = iota - GoFieldMethod - GoFieldVariable - GoFieldMap -) - -type Object struct { - *ast.Definition - - Type types.Type - ResolverInterface types.Type - Root bool - Fields []*Field - Implements []*ast.Definition - DisableConcurrency bool - Stream bool - Directives []*Directive -} - -func (b *builder) buildObject(typ *ast.Definition) (*Object, error) { - dirs, err := b.getDirectives(typ.Directives) - if err != nil { - return nil, fmt.Errorf("%s: %w", typ.Name, err) - } - caser := cases.Title(language.English, cases.NoLower) - obj := &Object{ - Definition: typ, - Root: b.Schema.Query == typ || b.Schema.Mutation == typ || b.Schema.Subscription == typ, - DisableConcurrency: typ == b.Schema.Mutation, - Stream: typ == b.Schema.Subscription, - Directives: dirs, - ResolverInterface: types.NewNamed( - types.NewTypeName(0, b.Config.Exec.Pkg(), caser.String(typ.Name)+"Resolver", nil), - nil, - nil, - ), - } - - if !obj.Root { - goObject, err := b.Binder.DefaultUserObject(typ.Name) - if err != nil { - return nil, err - } - obj.Type = goObject - } - - for _, intf := range b.Schema.GetImplements(typ) { - obj.Implements = append(obj.Implements, b.Schema.Types[intf.Name]) - } - - for _, field := range typ.Fields { - if strings.HasPrefix(field.Name, "__") { - continue - } - - var f *Field - f, err = b.buildField(obj, field) - if err != nil { - return nil, err - } - - obj.Fields = append(obj.Fields, f) - } - - return obj, nil -} - -func (o *Object) Reference() types.Type { - if config.IsNilable(o.Type) { - return o.Type - } - return types.NewPointer(o.Type) -} - -type Objects []*Object - -func (o *Object) Implementors() string { - satisfiedBy := strconv.Quote(o.Name) - for _, s := range o.Implements { - satisfiedBy += ", " + strconv.Quote(s.Name) - } - return "[]string{" + satisfiedBy + "}" -} - -func (o *Object) HasResolvers() bool { - for _, f := range o.Fields { - if f.IsResolver { - return true - } - } - return false -} - -func (o *Object) HasUnmarshal() bool { - if o.Type == config.MapType { - return true - } - for i := 0; i < o.Type.(*types.Named).NumMethods(); i++ { - if o.Type.(*types.Named).Method(i).Name() == "UnmarshalGQL" { - return true - } - } - return false -} - -func (o *Object) HasDirectives() bool { - if len(o.Directives) > 0 { - return true - } - for _, f := range o.Fields { - if f.HasDirectives() { - return true - } - } - - return false -} - -func (o *Object) IsConcurrent() bool { - for _, f := range o.Fields { - if f.IsConcurrent() { - return true - } - } - return false -} - -func (o *Object) IsReserved() bool { - return strings.HasPrefix(o.Definition.Name, "__") -} - -func (o *Object) Description() string { - return o.Definition.Description -} - -func (os Objects) ByName(name string) *Object { - for i, o := range os { - if strings.EqualFold(o.Definition.Name, name) { - return os[i] - } - } - return nil -} - -func ucFirst(s string) string { - if s == "" { - return "" - } - - r := []rune(s) - r[0] = unicode.ToUpper(r[0]) - return string(r) -} diff --git a/vendor/github.com/99designs/gqlgen/codegen/object.gotpl b/vendor/github.com/99designs/gqlgen/codegen/object.gotpl deleted file mode 100644 index 1fbdfacec1..0000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/object.gotpl +++ /dev/null @@ -1,112 +0,0 @@ -{{- range $object := .Objects }} - -var {{ $object.Name|lcFirst}}Implementors = {{$object.Implementors}} - -{{- if .Stream }} -func (ec *executionContext) _{{$object.Name}}(ctx context.Context, sel ast.SelectionSet) func(ctx context.Context) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, {{$object.Name|lcFirst}}Implementors) - ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ - Object: {{$object.Name|quote}}, - }) - if len(fields) != 1 { - ec.Errorf(ctx, "must subscribe to exactly one stream") - return nil - } - - switch fields[0].Name { - {{- range $field := $object.Fields }} - case "{{$field.Name}}": - return ec._{{$object.Name}}_{{$field.Name}}(ctx, fields[0]) - {{- end }} - default: - panic("unknown field " + strconv.Quote(fields[0].Name)) - } -} -{{- else }} -func (ec *executionContext) _{{$object.Name}}(ctx context.Context, sel ast.SelectionSet{{ if not $object.Root }},obj {{$object.Reference | ref }}{{ end }}) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, {{$object.Name|lcFirst}}Implementors) - {{- if $object.Root }} - ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ - Object: {{$object.Name|quote}}, - }) - {{end}} - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - {{- if $object.Root }} - innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ - Object: field.Name, - Field: field, - }) - {{end}} - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString({{$object.Name|quote}}) - {{- range $field := $object.Fields }} - case "{{$field.Name}}": - {{- if $field.IsConcurrent }} - field := field - - innerFunc := func(ctx context.Context) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._{{$object.Name}}_{{$field.Name}}(ctx, field{{if not $object.Root}}, obj{{end}}) - {{- if $field.TypeReference.GQL.NonNull }} - if res == graphql.Null { - {{- if $object.IsConcurrent }} - atomic.AddUint32(&invalids, 1) - {{- else }} - invalids++ - {{- end }} - } - {{- end }} - return res - } - - {{if $object.Root}} - rrm := func(ctx context.Context) graphql.Marshaler { - return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc) - } - {{end}} - - out.Concurrently(i, func() graphql.Marshaler { - {{- if $object.Root -}} - return rrm(innerCtx) - {{- else -}} - return innerFunc(ctx) - {{end}} - }) - {{- else }} - {{if $object.Root}} - out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { - return ec._{{$object.Name}}_{{$field.Name}}(ctx, field) - }) - {{else}} - out.Values[i] = ec._{{$object.Name}}_{{$field.Name}}(ctx, field, obj) - {{end}} - - {{- if $field.TypeReference.GQL.NonNull }} - if out.Values[i] == graphql.Null { - {{- if $object.IsConcurrent }} - atomic.AddUint32(&invalids, 1) - {{- else }} - invalids++ - {{- end }} - } - {{- end }} - {{- end }} - {{- end }} - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { return graphql.Null } - return out -} -{{- end }} - -{{- end }} diff --git a/vendor/github.com/99designs/gqlgen/codegen/root_.gotpl b/vendor/github.com/99designs/gqlgen/codegen/root_.gotpl deleted file mode 100644 index 2f2a98262e..0000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/root_.gotpl +++ /dev/null @@ -1,230 +0,0 @@ -{{ reserveImport "context" }} -{{ reserveImport "fmt" }} -{{ reserveImport "io" }} -{{ reserveImport "strconv" }} -{{ reserveImport "time" }} -{{ reserveImport "sync" }} -{{ reserveImport "sync/atomic" }} -{{ reserveImport "errors" }} -{{ reserveImport "bytes" }} -{{ reserveImport "embed" }} - -{{ reserveImport "github.com/vektah/gqlparser/v2" "gqlparser" }} -{{ reserveImport "github.com/vektah/gqlparser/v2/ast" }} -{{ reserveImport "github.com/99designs/gqlgen/graphql" }} -{{ reserveImport "github.com/99designs/gqlgen/graphql/introspection" }} - -// NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface. -func NewExecutableSchema(cfg Config) graphql.ExecutableSchema { - return &executableSchema{ - resolvers: cfg.Resolvers, - directives: cfg.Directives, - complexity: cfg.Complexity, - } -} - -type Config struct { - Resolvers ResolverRoot - Directives DirectiveRoot - Complexity ComplexityRoot -} - -type ResolverRoot interface { -{{- range $object := .Objects -}} - {{ if $object.HasResolvers -}} - {{ucFirst $object.Name}}() {{ucFirst $object.Name}}Resolver - {{ end }} -{{- end }} -{{- range $object := .Inputs -}} - {{ if $object.HasResolvers -}} - {{ucFirst $object.Name}}() {{ucFirst $object.Name}}Resolver - {{ end }} -{{- end }} -} - -type DirectiveRoot struct { -{{ range $directive := .Directives }} - {{- $directive.Declaration }} -{{ end }} -} - -type ComplexityRoot struct { -{{ range $object := .Objects }} - {{ if not $object.IsReserved -}} - {{ ucFirst $object.Name }} struct { - {{ range $_, $fields := $object.UniqueFields }} - {{- $field := index $fields 0 -}} - {{ if not $field.IsReserved -}} - {{ $field.GoFieldName }} {{ $field.ComplexitySignature }} - {{ end }} - {{- end }} - } - {{- end }} -{{ end }} -} - -type executableSchema struct { - resolvers ResolverRoot - directives DirectiveRoot - complexity ComplexityRoot -} - -func (e *executableSchema) Schema() *ast.Schema { - return parsedSchema -} - -func (e *executableSchema) Complexity(typeName, field string, childComplexity int, rawArgs map[string]interface{}) (int, bool) { - ec := executionContext{nil, e} - _ = ec - switch typeName + "." + field { - {{ range $object := .Objects }} - {{ if not $object.IsReserved }} - {{ range $_, $fields := $object.UniqueFields }} - {{- $len := len $fields }} - {{- range $i, $field := $fields }} - {{- $last := eq (add $i 1) $len }} - {{- if not $field.IsReserved }} - {{- if eq $i 0 }}case {{ end }}"{{$object.Name}}.{{$field.Name}}"{{ if not $last }},{{ else }}: - if e.complexity.{{ucFirst $object.Name }}.{{$field.GoFieldName}} == nil { - break - } - {{ if $field.Args }} - args, err := ec.{{ $field.ArgsFunc }}(context.TODO(),rawArgs) - if err != nil { - return 0, false - } - {{ end }} - return e.complexity.{{ucFirst $object.Name}}.{{$field.GoFieldName}}(childComplexity{{if $field.Args}}, {{$field.ComplexityArgs}} {{ end }}), true - {{ end }} - {{- end }} - {{- end }} - {{ end }} - {{ end }} - {{ end }} - } - return 0, false -} - -func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetOperationContext(ctx) - ec := executionContext{rc, e} - inputUnmarshalMap := graphql.BuildUnmarshalerMap( - {{- range $input := .Inputs -}} - {{ if not $input.HasUnmarshal }} - ec.unmarshalInput{{ $input.Name }}, - {{- end }} - {{- end }} - ) - first := true - - switch rc.Operation.Operation { - {{- if .QueryRoot }} case ast.Query: - return func(ctx context.Context) *graphql.Response { - if !first { return nil } - first = false - ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - {{ if .Directives.LocationDirectives "QUERY" -}} - data := ec._queryMiddleware(ctx, rc.Operation, func(ctx context.Context) (interface{}, error){ - return ec._{{.QueryRoot.Name}}(ctx, rc.Operation.SelectionSet), nil - }) - {{- else -}} - data := ec._{{.QueryRoot.Name}}(ctx, rc.Operation.SelectionSet) - {{- end }} - var buf bytes.Buffer - data.MarshalGQL(&buf) - - return &graphql.Response{ - Data: buf.Bytes(), - } - } - {{ end }} - - {{- if .MutationRoot }} case ast.Mutation: - return func(ctx context.Context) *graphql.Response { - if !first { return nil } - first = false - ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - {{ if .Directives.LocationDirectives "MUTATION" -}} - data := ec._mutationMiddleware(ctx, rc.Operation, func(ctx context.Context) (interface{}, error){ - return ec._{{.MutationRoot.Name}}(ctx, rc.Operation.SelectionSet), nil - }) - {{- else -}} - data := ec._{{.MutationRoot.Name}}(ctx, rc.Operation.SelectionSet) - {{- end }} - var buf bytes.Buffer - data.MarshalGQL(&buf) - - return &graphql.Response{ - Data: buf.Bytes(), - } - } - {{ end }} - - {{- if .SubscriptionRoot }} case ast.Subscription: - {{ if .Directives.LocationDirectives "SUBSCRIPTION" -}} - next := ec._subscriptionMiddleware(ctx, rc.Operation, func(ctx context.Context) (interface{}, error){ - return ec._{{.SubscriptionRoot.Name}}(ctx, rc.Operation.SelectionSet),nil - }) - {{- else -}} - next := ec._{{.SubscriptionRoot.Name}}(ctx, rc.Operation.SelectionSet) - {{- end }} - - var buf bytes.Buffer - return func(ctx context.Context) *graphql.Response { - buf.Reset() - data := next(ctx) - - if data == nil { - return nil - } - data.MarshalGQL(&buf) - - return &graphql.Response{ - Data: buf.Bytes(), - } - } - {{ end }} - default: - return graphql.OneShot(graphql.ErrorResponse(ctx, "unsupported GraphQL operation")) - } -} - -type executionContext struct { - *graphql.OperationContext - *executableSchema -} - -func (ec *executionContext) introspectSchema() (*introspection.Schema, error) { - if ec.DisableIntrospection { - return nil, errors.New("introspection disabled") - } - return introspection.WrapSchema(parsedSchema), nil -} - -func (ec *executionContext) introspectType(name string) (*introspection.Type, error) { - if ec.DisableIntrospection { - return nil, errors.New("introspection disabled") - } - return introspection.WrapTypeFromDef(parsedSchema, parsedSchema.Types[name]), nil -} - - -{{if .HasEmbeddableSources }} -//go:embed{{- range $source := .AugmentedSources }}{{if $source.Embeddable}} {{$source.RelativePath|quote}}{{end}}{{- end }} -var sourcesFS embed.FS - -func sourceData(filename string) string { - data, err := sourcesFS.ReadFile(filename) - if err != nil { - panic(fmt.Sprintf("codegen problem: %s not available", filename)) - } - return string(data) -} -{{- end}} - -var sources = []*ast.Source{ -{{- range $source := .AugmentedSources }} - {Name: {{$source.RelativePath|quote}}, Input: {{if (not $source.Embeddable)}}{{$source.Source|rawQuote}}{{else}}sourceData({{$source.RelativePath|quote}}){{end}}, BuiltIn: {{$source.BuiltIn}}}, -{{- end }} -} -var parsedSchema = gqlparser.MustLoadSchema(sources...) diff --git a/vendor/github.com/99designs/gqlgen/codegen/templates/import.go b/vendor/github.com/99designs/gqlgen/codegen/templates/import.go deleted file mode 100644 index 00a82ea5ef..0000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/templates/import.go +++ /dev/null @@ -1,139 +0,0 @@ -package templates - -import ( - "fmt" - "go/types" - "strconv" - "strings" - - "github.com/99designs/gqlgen/internal/code" -) - -type Import struct { - Name string - Path string - Alias string -} - -type Imports struct { - imports []*Import - destDir string - packages *code.Packages -} - -func (i *Import) String() string { - if strings.HasSuffix(i.Path, i.Alias) { - return strconv.Quote(i.Path) - } - - return i.Alias + " " + strconv.Quote(i.Path) -} - -func (s *Imports) String() string { - res := "" - for i, imp := range s.imports { - if i != 0 { - res += "\n" - } - res += imp.String() - } - return res -} - -func (s *Imports) Reserve(path string, aliases ...string) (string, error) { - if path == "" { - panic("empty ambient import") - } - - // if we are referencing our own package we dont need an import - if code.ImportPathForDir(s.destDir) == path { - return "", nil - } - - name := s.packages.NameForPackage(path) - var alias string - if len(aliases) != 1 { - alias = name - } else { - alias = aliases[0] - } - - if existing := s.findByPath(path); existing != nil { - if existing.Alias == alias { - return "", nil - } - return "", fmt.Errorf("ambient import already exists") - } - - if alias := s.findByAlias(alias); alias != nil { - return "", fmt.Errorf("ambient import collides on an alias") - } - - s.imports = append(s.imports, &Import{ - Name: name, - Path: path, - Alias: alias, - }) - - return "", nil -} - -func (s *Imports) Lookup(path string) string { - if path == "" { - return "" - } - - path = code.NormalizeVendor(path) - - // if we are referencing our own package we dont need an import - if code.ImportPathForDir(s.destDir) == path { - return "" - } - - if existing := s.findByPath(path); existing != nil { - return existing.Alias - } - - imp := &Import{ - Name: s.packages.NameForPackage(path), - Path: path, - } - s.imports = append(s.imports, imp) - - alias := imp.Name - i := 1 - for s.findByAlias(alias) != nil { - alias = imp.Name + strconv.Itoa(i) - i++ - if i > 1000 { - panic(fmt.Errorf("too many collisions, last attempt was %s", alias)) - } - } - imp.Alias = alias - - return imp.Alias -} - -func (s *Imports) LookupType(t types.Type) string { - return types.TypeString(t, func(i *types.Package) string { - return s.Lookup(i.Path()) - }) -} - -func (s Imports) findByPath(importPath string) *Import { - for _, imp := range s.imports { - if imp.Path == importPath { - return imp - } - } - return nil -} - -func (s Imports) findByAlias(alias string) *Import { - for _, imp := range s.imports { - if imp.Alias == alias { - return imp - } - } - return nil -} diff --git a/vendor/github.com/99designs/gqlgen/codegen/templates/templates.go b/vendor/github.com/99designs/gqlgen/codegen/templates/templates.go deleted file mode 100644 index 159df77c9c..0000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/templates/templates.go +++ /dev/null @@ -1,740 +0,0 @@ -package templates - -import ( - "bytes" - "fmt" - "go/types" - "io/fs" - "os" - "path/filepath" - "reflect" - "regexp" - "runtime" - "sort" - "strconv" - "strings" - "sync" - "text/template" - "unicode" - - "github.com/99designs/gqlgen/internal/code" - - "github.com/99designs/gqlgen/internal/imports" -) - -// CurrentImports keeps track of all the import declarations that are needed during the execution of a plugin. -// this is done with a global because subtemplates currently get called in functions. Lets aim to remove this eventually. -var CurrentImports *Imports - -// Options specify various parameters to rendering a template. -type Options struct { - // PackageName is a helper that specifies the package header declaration. - // In other words, when you write the template you don't need to specify `package X` - // at the top of the file. By providing PackageName in the Options, the Render - // function will do that for you. - PackageName string - // Template is a string of the entire template that - // will be parsed and rendered. If it's empty, - // the plugin processor will look for .gotpl files - // in the same directory of where you wrote the plugin. - Template string - - // Use the go:embed API to collect all the template files you want to pass into Render - // this is an alternative to passing the Template option - TemplateFS fs.FS - - // Filename is the name of the file that will be - // written to the system disk once the template is rendered. - Filename string - RegionTags bool - GeneratedHeader bool - // PackageDoc is documentation written above the package line - PackageDoc string - // FileNotice is notice written below the package line - FileNotice string - // Data will be passed to the template execution. - Data interface{} - Funcs template.FuncMap - - // Packages cache, you can find me on config.Config - Packages *code.Packages -} - -var ( - modelNamesMu sync.Mutex - modelNames = make(map[string]string, 0) - goNameRe = regexp.MustCompile("[^a-zA-Z0-9_]") -) - -// Render renders a gql plugin template from the given Options. Render is an -// abstraction of the text/template package that makes it easier to write gqlgen -// plugins. If Options.Template is empty, the Render function will look for `.gotpl` -// files inside the directory where you wrote the plugin. -func Render(cfg Options) error { - if CurrentImports != nil { - panic(fmt.Errorf("recursive or concurrent call to RenderToFile detected")) - } - CurrentImports = &Imports{packages: cfg.Packages, destDir: filepath.Dir(cfg.Filename)} - - funcs := Funcs() - for n, f := range cfg.Funcs { - funcs[n] = f - } - - t := template.New("").Funcs(funcs) - t, err := parseTemplates(cfg, t) - if err != nil { - return err - } - - roots := make([]string, 0, len(t.Templates())) - for _, template := range t.Templates() { - // templates that end with _.gotpl are special files we don't want to include - if strings.HasSuffix(template.Name(), "_.gotpl") || - // filter out templates added with {{ template xxx }} syntax inside the template file - !strings.HasSuffix(template.Name(), ".gotpl") { - continue - } - - roots = append(roots, template.Name()) - } - - // then execute all the important looking ones in order, adding them to the same file - sort.Slice(roots, func(i, j int) bool { - // important files go first - if strings.HasSuffix(roots[i], "!.gotpl") { - return true - } - if strings.HasSuffix(roots[j], "!.gotpl") { - return false - } - return roots[i] < roots[j] - }) - - var buf bytes.Buffer - for _, root := range roots { - if cfg.RegionTags { - buf.WriteString("\n// region " + center(70, "*", " "+root+" ") + "\n") - } - err := t.Lookup(root).Execute(&buf, cfg.Data) - if err != nil { - return fmt.Errorf("%s: %w", root, err) - } - if cfg.RegionTags { - buf.WriteString("\n// endregion " + center(70, "*", " "+root+" ") + "\n") - } - } - - var result bytes.Buffer - if cfg.GeneratedHeader { - result.WriteString("// Code generated by github.com/99designs/gqlgen, DO NOT EDIT.\n\n") - } - if cfg.PackageDoc != "" { - result.WriteString(cfg.PackageDoc + "\n") - } - result.WriteString("package ") - result.WriteString(cfg.PackageName) - result.WriteString("\n\n") - if cfg.FileNotice != "" { - result.WriteString(cfg.FileNotice) - result.WriteString("\n\n") - } - result.WriteString("import (\n") - result.WriteString(CurrentImports.String()) - result.WriteString(")\n") - _, err = buf.WriteTo(&result) - if err != nil { - return err - } - CurrentImports = nil - - err = write(cfg.Filename, result.Bytes(), cfg.Packages) - if err != nil { - return err - } - - cfg.Packages.Evict(code.ImportPathForDir(filepath.Dir(cfg.Filename))) - return nil -} - -func parseTemplates(cfg Options, t *template.Template) (*template.Template, error) { - if cfg.Template != "" { - var err error - t, err = t.New("template.gotpl").Parse(cfg.Template) - if err != nil { - return nil, fmt.Errorf("error with provided template: %w", err) - } - return t, nil - } - - var fileSystem fs.FS - if cfg.TemplateFS != nil { - fileSystem = cfg.TemplateFS - } else { - // load path relative to calling source file - _, callerFile, _, _ := runtime.Caller(1) - rootDir := filepath.Dir(callerFile) - fileSystem = os.DirFS(rootDir) - } - - t, err := t.ParseFS(fileSystem, "*.gotpl") - if err != nil { - return nil, fmt.Errorf("locating templates: %w", err) - } - - return t, nil -} - -func center(width int, pad string, s string) string { - if len(s)+2 > width { - return s - } - lpad := (width - len(s)) / 2 - rpad := width - (lpad + len(s)) - return strings.Repeat(pad, lpad) + s + strings.Repeat(pad, rpad) -} - -func Funcs() template.FuncMap { - return template.FuncMap{ - "ucFirst": UcFirst, - "lcFirst": LcFirst, - "quote": strconv.Quote, - "rawQuote": rawQuote, - "dump": Dump, - "ref": ref, - "ts": TypeIdentifier, - "call": Call, - "prefixLines": prefixLines, - "notNil": notNil, - "reserveImport": CurrentImports.Reserve, - "lookupImport": CurrentImports.Lookup, - "go": ToGo, - "goPrivate": ToGoPrivate, - "goModelName": ToGoModelName, - "goPrivateModelName": ToGoPrivateModelName, - "add": func(a, b int) int { - return a + b - }, - "render": func(filename string, tpldata interface{}) (*bytes.Buffer, error) { - return render(resolveName(filename, 0), tpldata) - }, - } -} - -func UcFirst(s string) string { - if s == "" { - return "" - } - r := []rune(s) - r[0] = unicode.ToUpper(r[0]) - return string(r) -} - -func LcFirst(s string) string { - if s == "" { - return "" - } - - r := []rune(s) - r[0] = unicode.ToLower(r[0]) - return string(r) -} - -func isDelimiter(c rune) bool { - return c == '-' || c == '_' || unicode.IsSpace(c) -} - -func ref(p types.Type) string { - return CurrentImports.LookupType(p) -} - -var pkgReplacer = strings.NewReplacer( - "/", "ᚋ", - ".", "ᚗ", - "-", "ᚑ", - "~", "א", -) - -func TypeIdentifier(t types.Type) string { - res := "" - for { - switch it := t.(type) { - case *types.Pointer: - t.Underlying() - res += "ᚖ" - t = it.Elem() - case *types.Slice: - res += "ᚕ" - t = it.Elem() - case *types.Named: - res += pkgReplacer.Replace(it.Obj().Pkg().Path()) - res += "ᚐ" - res += it.Obj().Name() - return res - case *types.Basic: - res += it.Name() - return res - case *types.Map: - res += "map" - return res - case *types.Interface: - res += "interface" - return res - default: - panic(fmt.Errorf("unexpected type %T", it)) - } - } -} - -func Call(p *types.Func) string { - pkg := CurrentImports.Lookup(p.Pkg().Path()) - - if pkg != "" { - pkg += "." - } - - if p.Type() != nil { - // make sure the returned type is listed in our imports. - ref(p.Type().(*types.Signature).Results().At(0).Type()) - } - - return pkg + p.Name() -} - -func resetModelNames() { - modelNamesMu.Lock() - defer modelNamesMu.Unlock() - modelNames = make(map[string]string, 0) -} - -func buildGoModelNameKey(parts []string) string { - const sep = ":" - return strings.Join(parts, sep) -} - -func goModelName(primaryToGoFunc func(string) string, parts []string) string { - modelNamesMu.Lock() - defer modelNamesMu.Unlock() - - var ( - goNameKey string - partLen int - - nameExists = func(n string) bool { - for _, v := range modelNames { - if n == v { - return true - } - } - return false - } - - applyToGoFunc = func(parts []string) string { - var out string - switch len(parts) { - case 0: - return "" - case 1: - return primaryToGoFunc(parts[0]) - default: - out = primaryToGoFunc(parts[0]) - } - for _, p := range parts[1:] { - out = fmt.Sprintf("%s%s", out, ToGo(p)) - } - return out - } - - applyValidGoName = func(parts []string) string { - var out string - for _, p := range parts { - out = fmt.Sprintf("%s%s", out, replaceInvalidCharacters(p)) - } - return out - } - ) - - // build key for this entity - goNameKey = buildGoModelNameKey(parts) - - // determine if we've seen this entity before, and reuse if so - if goName, ok := modelNames[goNameKey]; ok { - return goName - } - - // attempt first pass - if goName := applyToGoFunc(parts); !nameExists(goName) { - modelNames[goNameKey] = goName - return goName - } - - // determine number of parts - partLen = len(parts) - - // if there is only 1 part, append incrementing number until no conflict - if partLen == 1 { - base := applyToGoFunc(parts) - for i := 0; ; i++ { - tmp := fmt.Sprintf("%s%d", base, i) - if !nameExists(tmp) { - modelNames[goNameKey] = tmp - return tmp - } - } - } - - // best effort "pretty" name - for i := partLen - 1; i >= 1; i-- { - tmp := fmt.Sprintf("%s%s", applyToGoFunc(parts[0:i]), applyValidGoName(parts[i:])) - if !nameExists(tmp) { - modelNames[goNameKey] = tmp - return tmp - } - } - - // finally, fallback to just adding an incrementing number - base := applyToGoFunc(parts) - for i := 0; ; i++ { - tmp := fmt.Sprintf("%s%d", base, i) - if !nameExists(tmp) { - modelNames[goNameKey] = tmp - return tmp - } - } -} - -func ToGoModelName(parts ...string) string { - return goModelName(ToGo, parts) -} - -func ToGoPrivateModelName(parts ...string) string { - return goModelName(ToGoPrivate, parts) -} - -func replaceInvalidCharacters(in string) string { - return goNameRe.ReplaceAllLiteralString(in, "_") -} - -func wordWalkerFunc(private bool, nameRunes *[]rune) func(*wordInfo) { - return func(info *wordInfo) { - word := info.Word - - switch { - case private && info.WordOffset == 0: - if strings.ToUpper(word) == word || strings.ToLower(word) == word { - // ID → id, CAMEL → camel - word = strings.ToLower(info.Word) - } else { - // ITicket → iTicket - word = LcFirst(info.Word) - } - - case info.MatchCommonInitial: - word = strings.ToUpper(word) - - case !info.HasCommonInitial && (strings.ToUpper(word) == word || strings.ToLower(word) == word): - // FOO or foo → Foo - // FOo → FOo - word = UcFirst(strings.ToLower(word)) - } - - *nameRunes = append(*nameRunes, []rune(word)...) - } -} - -func ToGo(name string) string { - if name == "_" { - return "_" - } - runes := make([]rune, 0, len(name)) - - wordWalker(name, wordWalkerFunc(false, &runes)) - - return string(runes) -} - -func ToGoPrivate(name string) string { - if name == "_" { - return "_" - } - runes := make([]rune, 0, len(name)) - - wordWalker(name, wordWalkerFunc(true, &runes)) - - return sanitizeKeywords(string(runes)) -} - -type wordInfo struct { - WordOffset int - Word string - MatchCommonInitial bool - HasCommonInitial bool -} - -// This function is based on the following code. -// https://github.com/golang/lint/blob/06c8688daad7faa9da5a0c2f163a3d14aac986ca/lint.go#L679 -func wordWalker(str string, f func(*wordInfo)) { - runes := []rune(strings.TrimFunc(str, isDelimiter)) - w, i, wo := 0, 0, 0 // index of start of word, scan, word offset - hasCommonInitial := false - for i+1 <= len(runes) { - eow := false // whether we hit the end of a word - switch { - case i+1 == len(runes): - eow = true - case isDelimiter(runes[i+1]): - // underscore; shift the remainder forward over any run of underscores - eow = true - n := 1 - for i+n+1 < len(runes) && isDelimiter(runes[i+n+1]) { - n++ - } - - // Leave at most one underscore if the underscore is between two digits - if i+n+1 < len(runes) && unicode.IsDigit(runes[i]) && unicode.IsDigit(runes[i+n+1]) { - n-- - } - - copy(runes[i+1:], runes[i+n+1:]) - runes = runes[:len(runes)-n] - case unicode.IsLower(runes[i]) && !unicode.IsLower(runes[i+1]): - // lower->non-lower - eow = true - } - i++ - - // [w,i) is a word. - word := string(runes[w:i]) - if !eow && commonInitialisms[word] && !unicode.IsLower(runes[i]) { - // through - // split IDFoo → ID, Foo - // but URLs → URLs - } else if !eow { - if commonInitialisms[word] { - hasCommonInitial = true - } - continue - } - - matchCommonInitial := false - if commonInitialisms[strings.ToUpper(word)] { - hasCommonInitial = true - matchCommonInitial = true - } - - f(&wordInfo{ - WordOffset: wo, - Word: word, - MatchCommonInitial: matchCommonInitial, - HasCommonInitial: hasCommonInitial, - }) - hasCommonInitial = false - w = i - wo++ - } -} - -var keywords = []string{ - "break", - "default", - "func", - "interface", - "select", - "case", - "defer", - "go", - "map", - "struct", - "chan", - "else", - "goto", - "package", - "switch", - "const", - "fallthrough", - "if", - "range", - "type", - "continue", - "for", - "import", - "return", - "var", - "_", -} - -// sanitizeKeywords prevents collisions with go keywords for arguments to resolver functions -func sanitizeKeywords(name string) string { - for _, k := range keywords { - if name == k { - return name + "Arg" - } - } - return name -} - -// commonInitialisms is a set of common initialisms. -// Only add entries that are highly unlikely to be non-initialisms. -// For instance, "ID" is fine (Freudian code is rare), but "AND" is not. -var commonInitialisms = map[string]bool{ - "ACL": true, - "API": true, - "ASCII": true, - "CPU": true, - "CSS": true, - "CSV": true, - "DNS": true, - "EOF": true, - "GUID": true, - "HTML": true, - "HTTP": true, - "HTTPS": true, - "ICMP": true, - "ID": true, - "IP": true, - "JSON": true, - "KVK": true, - "LHS": true, - "PDF": true, - "PGP": true, - "QPS": true, - "QR": true, - "RAM": true, - "RHS": true, - "RPC": true, - "SLA": true, - "SMTP": true, - "SQL": true, - "SSH": true, - "SVG": true, - "TCP": true, - "TLS": true, - "TTL": true, - "UDP": true, - "UI": true, - "UID": true, - "URI": true, - "URL": true, - "UTF8": true, - "UUID": true, - "VM": true, - "XML": true, - "XMPP": true, - "XSRF": true, - "XSS": true, -} - -func rawQuote(s string) string { - return "`" + strings.ReplaceAll(s, "`", "`+\"`\"+`") + "`" -} - -func notNil(field string, data interface{}) bool { - v := reflect.ValueOf(data) - - if v.Kind() == reflect.Ptr { - v = v.Elem() - } - if v.Kind() != reflect.Struct { - return false - } - val := v.FieldByName(field) - - return val.IsValid() && !val.IsNil() -} - -func Dump(val interface{}) string { - switch val := val.(type) { - case int: - return strconv.Itoa(val) - case int64: - return fmt.Sprintf("%d", val) - case float64: - return fmt.Sprintf("%f", val) - case string: - return strconv.Quote(val) - case bool: - return strconv.FormatBool(val) - case nil: - return "nil" - case []interface{}: - var parts []string - for _, part := range val { - parts = append(parts, Dump(part)) - } - return "[]interface{}{" + strings.Join(parts, ",") + "}" - case map[string]interface{}: - buf := bytes.Buffer{} - buf.WriteString("map[string]interface{}{") - var keys []string - for key := range val { - keys = append(keys, key) - } - sort.Strings(keys) - - for _, key := range keys { - data := val[key] - - buf.WriteString(strconv.Quote(key)) - buf.WriteString(":") - buf.WriteString(Dump(data)) - buf.WriteString(",") - } - buf.WriteString("}") - return buf.String() - default: - panic(fmt.Errorf("unsupported type %T", val)) - } -} - -func prefixLines(prefix, s string) string { - return prefix + strings.ReplaceAll(s, "\n", "\n"+prefix) -} - -func resolveName(name string, skip int) string { - if name[0] == '.' { - // load path relative to calling source file - _, callerFile, _, _ := runtime.Caller(skip + 1) - return filepath.Join(filepath.Dir(callerFile), name[1:]) - } - - // load path relative to this directory - _, callerFile, _, _ := runtime.Caller(0) - return filepath.Join(filepath.Dir(callerFile), name) -} - -func render(filename string, tpldata interface{}) (*bytes.Buffer, error) { - t := template.New("").Funcs(Funcs()) - - b, err := os.ReadFile(filename) - if err != nil { - return nil, err - } - - t, err = t.New(filepath.Base(filename)).Parse(string(b)) - if err != nil { - panic(err) - } - - buf := &bytes.Buffer{} - return buf, t.Execute(buf, tpldata) -} - -func write(filename string, b []byte, packages *code.Packages) error { - err := os.MkdirAll(filepath.Dir(filename), 0o755) - if err != nil { - return fmt.Errorf("failed to create directory: %w", err) - } - - formatted, err := imports.Prune(filename, b, packages) - if err != nil { - fmt.Fprintf(os.Stderr, "gofmt failed on %s: %s\n", filepath.Base(filename), err.Error()) - formatted = b - } - - err = os.WriteFile(filename, formatted, 0o644) - if err != nil { - return fmt.Errorf("failed to write %s: %w", filename, err) - } - - return nil -} diff --git a/vendor/github.com/99designs/gqlgen/codegen/templates/test.gotpl b/vendor/github.com/99designs/gqlgen/codegen/templates/test.gotpl deleted file mode 100644 index 07b8462a6a..0000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/templates/test.gotpl +++ /dev/null @@ -1 +0,0 @@ -this is my test package diff --git a/vendor/github.com/99designs/gqlgen/codegen/templates/test_.gotpl b/vendor/github.com/99designs/gqlgen/codegen/templates/test_.gotpl deleted file mode 100644 index c74258f3e1..0000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/templates/test_.gotpl +++ /dev/null @@ -1 +0,0 @@ -this will not be included diff --git a/vendor/github.com/99designs/gqlgen/codegen/type.go b/vendor/github.com/99designs/gqlgen/codegen/type.go deleted file mode 100644 index 20b09dc975..0000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/type.go +++ /dev/null @@ -1,32 +0,0 @@ -package codegen - -import ( - "fmt" - - "github.com/99designs/gqlgen/codegen/config" -) - -func (b *builder) buildTypes() map[string]*config.TypeReference { - ret := map[string]*config.TypeReference{} - for _, ref := range b.Binder.References { - processType(ret, ref) - } - return ret -} - -func processType(ret map[string]*config.TypeReference, ref *config.TypeReference) { - key := ref.UniquenessKey() - if existing, found := ret[key]; found { - // Simplistic check of content which is obviously different. - existingGQL := fmt.Sprintf("%v", existing.GQL) - newGQL := fmt.Sprintf("%v", ref.GQL) - if existingGQL != newGQL { - panic(fmt.Sprintf("non-unique key \"%s\", trying to replace %s with %s", key, existingGQL, newGQL)) - } - } - ret[key] = ref - - if ref.IsSlice() || ref.IsPtrToSlice() || ref.IsPtrToPtr() { - processType(ret, ref.Elem()) - } -} diff --git a/vendor/github.com/99designs/gqlgen/codegen/type.gotpl b/vendor/github.com/99designs/gqlgen/codegen/type.gotpl deleted file mode 100644 index d5c3919588..0000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/type.gotpl +++ /dev/null @@ -1,192 +0,0 @@ -{{- range $type := .ReferencedTypes }} - {{ with $type.UnmarshalFunc }} - func (ec *executionContext) {{ . }}(ctx context.Context, v interface{}) ({{ $type.GO | ref }}, error) { - {{- if and $type.IsNilable (not $type.GQL.NonNull) (not $type.IsPtrToPtr) }} - if v == nil { return nil, nil } - {{- end }} - {{- if $type.IsPtrToSlice }} - res, err := ec.{{ $type.Elem.UnmarshalFunc }}(ctx, v) - return &res, graphql.ErrorOnPath(ctx, err) - {{- else if $type.IsSlice }} - var vSlice []interface{} - if v != nil { - vSlice = graphql.CoerceList(v) - } - var err error - res := make([]{{$type.GO.Elem | ref}}, len(vSlice)) - for i := range vSlice { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) - res[i], err = ec.{{ $type.Elem.UnmarshalFunc }}(ctx, vSlice[i]) - if err != nil { - return nil, err - } - } - return res, nil - {{- else if and $type.IsPtrToPtr (not $type.Unmarshaler) (not $type.IsMarshaler) }} - var pres {{ $type.Elem.GO | ref }} - if v != nil { - res, err := ec.{{ $type.Elem.UnmarshalFunc }}(ctx, v) - if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) - } - pres = res - } - return &pres, nil - {{- else }} - {{- if $type.Unmarshaler }} - {{- if $type.CastType }} - {{- if $type.IsContext }} - tmp, err := {{ $type.Unmarshaler | call }}(ctx, v) - {{- else }} - tmp, err := {{ $type.Unmarshaler | call }}(v) - {{- end }} - {{- if and $type.IsNilable $type.Elem }} - res := {{ $type.Elem.GO | ref }}(tmp) - {{- else}} - res := {{ $type.GO | ref }}(tmp) - {{- end }} - {{- else}} - {{- if $type.IsContext }} - res, err := {{ $type.Unmarshaler | call }}(ctx, v) - {{- else }} - res, err := {{ $type.Unmarshaler | call }}(v) - {{- end }} - {{- end }} - {{- if and $type.IsTargetNilable (not $type.IsNilable) }} - return *res, graphql.ErrorOnPath(ctx, err) - {{- else if and (not $type.IsTargetNilable) $type.IsNilable }} - return &res, graphql.ErrorOnPath(ctx, err) - {{- else}} - return res, graphql.ErrorOnPath(ctx, err) - {{- end }} - {{- else if eq ($type.GO | ref) "map[string]interface{}" }} - return v.(map[string]interface{}), nil - {{- else if $type.IsMarshaler }} - {{- if and $type.IsNilable $type.Elem }} - var res = new({{ $type.Elem.GO | ref }}) - {{- else}} - var res {{ $type.GO | ref }} - {{- end }} - {{- if $type.IsContext }} - err := res.UnmarshalGQLContext(ctx, v) - {{- else }} - err := res.UnmarshalGQL(v) - {{- end }} - return res, graphql.ErrorOnPath(ctx, err) - {{- else }} - res, err := ec.unmarshalInput{{ $type.GQL.Name }}(ctx, v) - {{- if $type.IsNilable }} - return &res, graphql.ErrorOnPath(ctx, err) - {{- else}} - return res, graphql.ErrorOnPath(ctx, err) - {{- end }} - {{- end }} - {{- end }} - } - {{- end }} - - {{ with $type.MarshalFunc }} - func (ec *executionContext) {{ . }}(ctx context.Context, sel ast.SelectionSet, v {{ $type.GO | ref }}) graphql.Marshaler { - {{- if $type.IsPtrToSlice }} - return ec.{{ $type.Elem.MarshalFunc }}(ctx, sel, *v) - {{- else if $type.IsSlice }} - {{- if not $type.GQL.NonNull }} - if v == nil { - return graphql.Null - } - {{- end }} - ret := make(graphql.Array, len(v)) - {{- if not $type.IsScalar }} - var wg sync.WaitGroup - isLen1 := len(v) == 1 - if !isLen1 { - wg.Add(len(v)) - } - {{- end }} - for i := range v { - {{- if not $type.IsScalar }} - i := i - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - f := func(i int) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - if !isLen1 { - defer wg.Done() - } - ret[i] = ec.{{ $type.Elem.MarshalFunc }}(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - {{ else }} - ret[i] = ec.{{ $type.Elem.MarshalFunc }}(ctx, sel, v[i]) - {{- end }} - } - {{ if not $type.IsScalar }} wg.Wait() {{ end }} - {{ if $type.Elem.GQL.NonNull }} - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } - {{ end }} - return ret - {{- else if and $type.IsPtrToPtr (not $type.Unmarshaler) (not $type.IsMarshaler) }} - if v == nil { - return graphql.Null - } - return ec.{{ $type.Elem.MarshalFunc }}(ctx, sel, *v) - {{- else }} - {{- if $type.IsNilable }} - if v == nil { - {{- if $type.GQL.NonNull }} - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "the requested element is null which the schema does not allow") - } - {{- end }} - return graphql.Null - } - {{- end }} - {{- if $type.IsMarshaler }} - {{- if $type.IsContext }} - return graphql.WrapContextMarshaler(ctx, v) - {{- else }} - return v - {{- end }} - {{- else if $type.Marshaler }} - {{- $v := "v" }} - {{- if and $type.IsTargetNilable (not $type.IsNilable) }} - {{- $v = "&v" }} - {{- else if and (not $type.IsTargetNilable) $type.IsNilable }} - {{- $v = "*v" }} - {{- end }} - res := {{ $type.Marshaler | call }}({{- if $type.CastType }}{{ $type.CastType | ref }}({{ $v }}){{else}}{{ $v }}{{- end }}) - {{- if $type.GQL.NonNull }} - if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "the requested element is null which the schema does not allow") - } - } - {{- end }} - {{- if $type.IsContext }} - return graphql.WrapContextMarshaler(ctx, res) - {{- else }} - return res - {{- end }} - {{- else }} - return ec._{{$type.Definition.Name}}(ctx, sel, {{ if not $type.IsNilable}}&{{end}} v) - {{- end }} - {{- end }} - } - {{- end }} -{{- end }} diff --git a/vendor/github.com/99designs/gqlgen/codegen/util.go b/vendor/github.com/99designs/gqlgen/codegen/util.go deleted file mode 100644 index fa2ceed3df..0000000000 --- a/vendor/github.com/99designs/gqlgen/codegen/util.go +++ /dev/null @@ -1,46 +0,0 @@ -package codegen - -import ( - "fmt" - "go/types" - "strings" -) - -func findGoNamedType(def types.Type) (*types.Named, error) { - if def == nil { - return nil, nil - } - - namedType, ok := def.(*types.Named) - if !ok { - return nil, fmt.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, fmt.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.ReplaceAll(source, "_", "") - target = strings.ReplaceAll(target, "_", "") - return strings.EqualFold(source, target) -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/any.go b/vendor/github.com/99designs/gqlgen/graphql/any.go deleted file mode 100644 index 6ea8bf2eae..0000000000 --- a/vendor/github.com/99designs/gqlgen/graphql/any.go +++ /dev/null @@ -1,19 +0,0 @@ -package graphql - -import ( - "encoding/json" - "io" -) - -func MarshalAny(v interface{}) Marshaler { - return WriterFunc(func(w io.Writer) { - err := json.NewEncoder(w).Encode(v) - if err != nil { - panic(err) - } - }) -} - -func UnmarshalAny(v interface{}) (interface{}, error) { - return v, nil -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/bool.go b/vendor/github.com/99designs/gqlgen/graphql/bool.go deleted file mode 100644 index f435e0c098..0000000000 --- a/vendor/github.com/99designs/gqlgen/graphql/bool.go +++ /dev/null @@ -1,27 +0,0 @@ -package graphql - -import ( - "fmt" - "io" - "strings" -) - -func MarshalBoolean(b bool) Marshaler { - if b { - return WriterFunc(func(w io.Writer) { w.Write(trueLit) }) - } - return WriterFunc(func(w io.Writer) { w.Write(falseLit) }) -} - -func UnmarshalBoolean(v interface{}) (bool, error) { - switch v := v.(type) { - case string: - return strings.ToLower(v) == "true", nil - case int: - return v != 0, nil - case bool: - return v, nil - default: - return false, fmt.Errorf("%T is not a bool", v) - } -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/cache.go b/vendor/github.com/99designs/gqlgen/graphql/cache.go deleted file mode 100644 index fe86ca3502..0000000000 --- a/vendor/github.com/99designs/gqlgen/graphql/cache.go +++ /dev/null @@ -1,29 +0,0 @@ -package graphql - -import "context" - -// Cache is a shared store for APQ and query AST caching -type Cache interface { - // Get looks up a key's value from the cache. - Get(ctx context.Context, key string) (value interface{}, ok bool) - - // Add adds a value to the cache. - Add(ctx context.Context, key string, value interface{}) -} - -// MapCache is the simplest implementation of a cache, because it can not evict it should only be used in tests -type MapCache map[string]interface{} - -// Get looks up a key's value from the cache. -func (m MapCache) Get(ctx context.Context, key string) (value interface{}, ok bool) { - v, ok := m[key] - return v, ok -} - -// Add adds a value to the cache. -func (m MapCache) Add(ctx context.Context, key string, value interface{}) { m[key] = value } - -type NoCache struct{} - -func (n NoCache) Get(ctx context.Context, key string) (value interface{}, ok bool) { return nil, false } -func (n NoCache) Add(ctx context.Context, key string, value interface{}) {} diff --git a/vendor/github.com/99designs/gqlgen/graphql/coercion.go b/vendor/github.com/99designs/gqlgen/graphql/coercion.go deleted file mode 100644 index d3d3c18b2b..0000000000 --- a/vendor/github.com/99designs/gqlgen/graphql/coercion.go +++ /dev/null @@ -1,56 +0,0 @@ -package graphql - -import ( - "encoding/json" -) - -// CoerceList applies coercion from a single value to a list. -func CoerceList(v interface{}) []interface{} { - var vSlice []interface{} - if v != nil { - switch v := v.(type) { - case []interface{}: - // already a slice no coercion required - vSlice = v - case []string: - if len(v) > 0 { - vSlice = []interface{}{v[0]} - } - case []json.Number: - if len(v) > 0 { - vSlice = []interface{}{v[0]} - } - case []bool: - if len(v) > 0 { - vSlice = []interface{}{v[0]} - } - case []map[string]interface{}: - if len(v) > 0 { - vSlice = []interface{}{v[0]} - } - case []float64: - if len(v) > 0 { - vSlice = []interface{}{v[0]} - } - case []float32: - if len(v) > 0 { - vSlice = []interface{}{v[0]} - } - case []int: - if len(v) > 0 { - vSlice = []interface{}{v[0]} - } - case []int32: - if len(v) > 0 { - vSlice = []interface{}{v[0]} - } - case []int64: - if len(v) > 0 { - vSlice = []interface{}{v[0]} - } - default: - vSlice = []interface{}{v} - } - } - return vSlice -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/context_field.go b/vendor/github.com/99designs/gqlgen/graphql/context_field.go deleted file mode 100644 index 1f9a6e88db..0000000000 --- a/vendor/github.com/99designs/gqlgen/graphql/context_field.go +++ /dev/null @@ -1,113 +0,0 @@ -package graphql - -import ( - "context" - "time" - - "github.com/vektah/gqlparser/v2/ast" -) - -type key string - -const resolverCtx key = "resolver_context" - -// Deprecated: Use FieldContext instead -type ResolverContext = FieldContext - -type FieldContext struct { - Parent *FieldContext - // The name of the type this field belongs to - Object string - // These are the args after processing, they can be mutated in middleware to change what the resolver will get. - Args map[string]interface{} - // The raw field - Field CollectedField - // The index of array in path. - Index *int - // The result object of resolver - Result interface{} - // IsMethod indicates if the resolver is a method - IsMethod bool - // IsResolver indicates if the field has a user-specified resolver - IsResolver bool - // Child allows getting a child FieldContext by its field collection description. - // Note that, the returned child FieldContext represents the context as it was - // before the execution of the field resolver. For example: - // - // srv.AroundFields(func(ctx context.Context, next graphql.Resolver) (interface{}, error) { - // fc := graphql.GetFieldContext(ctx) - // op := graphql.GetOperationContext(ctx) - // collected := graphql.CollectFields(opCtx, fc.Field.Selections, []string{"User"}) - // - // child, err := fc.Child(ctx, collected[0]) - // if err != nil { - // return nil, err - // } - // fmt.Println("child context %q with args: %v", child.Field.Name, child.Args) - // - // return next(ctx) - // }) - // - Child func(context.Context, CollectedField) (*FieldContext, error) -} - -type FieldStats struct { - // When field execution started - Started time.Time - - // When argument marshaling finished - ArgumentsCompleted time.Time - - // When the field completed running all middleware. Not available inside field middleware! - Completed time.Time -} - -func (r *FieldContext) Path() ast.Path { - var path ast.Path - for it := r; it != nil; it = it.Parent { - if it.Index != nil { - path = append(path, ast.PathIndex(*it.Index)) - } else if it.Field.Field != nil { - path = append(path, ast.PathName(it.Field.Alias)) - } - } - - // because we are walking up the chain, all the elements are backwards, do an inplace flip. - for i := len(path)/2 - 1; i >= 0; i-- { - opp := len(path) - 1 - i - path[i], path[opp] = path[opp], path[i] - } - - return path -} - -// Deprecated: Use GetFieldContext instead -func GetResolverContext(ctx context.Context) *ResolverContext { - return GetFieldContext(ctx) -} - -func GetFieldContext(ctx context.Context) *FieldContext { - if val, ok := ctx.Value(resolverCtx).(*FieldContext); ok { - return val - } - return nil -} - -func WithFieldContext(ctx context.Context, rc *FieldContext) context.Context { - rc.Parent = GetFieldContext(ctx) - return context.WithValue(ctx, resolverCtx, rc) -} - -func equalPath(a ast.Path, b ast.Path) bool { - if len(a) != len(b) { - return false - } - - for i := 0; i < len(a); i++ { - if a[i] != b[i] { - return false - } - } - - return true -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/context_operation.go b/vendor/github.com/99designs/gqlgen/graphql/context_operation.go deleted file mode 100644 index 0518ecc6ba..0000000000 --- a/vendor/github.com/99designs/gqlgen/graphql/context_operation.go +++ /dev/null @@ -1,117 +0,0 @@ -package graphql - -import ( - "context" - "errors" - "net/http" - - "github.com/vektah/gqlparser/v2/ast" -) - -// Deprecated: Please update all references to OperationContext instead -type RequestContext = OperationContext - -type OperationContext struct { - RawQuery string - Variables map[string]interface{} - OperationName string - Doc *ast.QueryDocument - Headers http.Header - - Operation *ast.OperationDefinition - DisableIntrospection bool - RecoverFunc RecoverFunc - ResolverMiddleware FieldMiddleware - RootResolverMiddleware RootFieldMiddleware - - Stats Stats -} - -func (c *OperationContext) Validate(ctx context.Context) error { - if c.Doc == nil { - return errors.New("field 'Doc'is required") - } - if c.RawQuery == "" { - return errors.New("field 'RawQuery' is required") - } - if c.Variables == nil { - c.Variables = make(map[string]interface{}) - } - if c.ResolverMiddleware == nil { - return errors.New("field 'ResolverMiddleware' is required") - } - if c.RootResolverMiddleware == nil { - return errors.New("field 'RootResolverMiddleware' is required") - } - if c.RecoverFunc == nil { - c.RecoverFunc = DefaultRecover - } - - return nil -} - -const operationCtx key = "operation_context" - -// Deprecated: Please update all references to GetOperationContext instead -func GetRequestContext(ctx context.Context) *RequestContext { - return GetOperationContext(ctx) -} - -func GetOperationContext(ctx context.Context) *OperationContext { - if val, ok := ctx.Value(operationCtx).(*OperationContext); ok && val != nil { - return val - } - panic("missing operation context") -} - -func WithOperationContext(ctx context.Context, rc *OperationContext) context.Context { - return context.WithValue(ctx, operationCtx, rc) -} - -// HasOperationContext checks if the given context is part of an ongoing operation -// -// Some errors can happen outside of an operation, eg json unmarshal errors. -func HasOperationContext(ctx context.Context) bool { - _, ok := ctx.Value(operationCtx).(*OperationContext) - return ok -} - -// This is just a convenient wrapper method for CollectFields -func CollectFieldsCtx(ctx context.Context, satisfies []string) []CollectedField { - resctx := GetFieldContext(ctx) - return CollectFields(GetOperationContext(ctx), resctx.Field.Selections, satisfies) -} - -// CollectAllFields returns a slice of all GraphQL field names that were selected for the current resolver context. -// The slice will contain the unique set of all field names requested regardless of fragment type conditions. -func CollectAllFields(ctx context.Context) []string { - resctx := GetFieldContext(ctx) - collected := CollectFields(GetOperationContext(ctx), resctx.Field.Selections, nil) - uniq := make([]string, 0, len(collected)) -Next: - for _, f := range collected { - for _, name := range uniq { - if name == f.Name { - continue Next - } - } - uniq = append(uniq, f.Name) - } - return uniq -} - -// Errorf sends an error string to the client, passing it through the formatter. -// Deprecated: use graphql.AddErrorf(ctx, err) instead -func (c *OperationContext) Errorf(ctx context.Context, format string, args ...interface{}) { - AddErrorf(ctx, format, args...) -} - -// Error sends an error to the client, passing it through the formatter. -// Deprecated: use graphql.AddError(ctx, err) instead -func (c *OperationContext) Error(ctx context.Context, err error) { - AddError(ctx, err) -} - -func (c *OperationContext) Recover(ctx context.Context, err interface{}) error { - return ErrorOnPath(ctx, c.RecoverFunc(ctx, err)) -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/context_path.go b/vendor/github.com/99designs/gqlgen/graphql/context_path.go deleted file mode 100644 index a46ed83ddc..0000000000 --- a/vendor/github.com/99designs/gqlgen/graphql/context_path.go +++ /dev/null @@ -1,77 +0,0 @@ -package graphql - -import ( - "context" - - "github.com/vektah/gqlparser/v2/ast" -) - -const fieldInputCtx key = "path_context" - -type PathContext struct { - ParentField *FieldContext - Parent *PathContext - Field *string - Index *int -} - -func (fic *PathContext) Path() ast.Path { - var path ast.Path - for it := fic; it != nil; it = it.Parent { - if it.Index != nil { - path = append(path, ast.PathIndex(*it.Index)) - } else if it.Field != nil { - path = append(path, ast.PathName(*it.Field)) - } - } - - // because we are walking up the chain, all the elements are backwards, do an inplace flip. - for i := len(path)/2 - 1; i >= 0; i-- { - opp := len(path) - 1 - i - path[i], path[opp] = path[opp], path[i] - } - - if fic.ParentField != nil { - fieldPath := fic.ParentField.Path() - return append(fieldPath, path...) - - } - - return path -} - -func NewPathWithField(field string) *PathContext { - return &PathContext{Field: &field} -} - -func NewPathWithIndex(index int) *PathContext { - return &PathContext{Index: &index} -} - -func WithPathContext(ctx context.Context, fic *PathContext) context.Context { - if fieldContext := GetFieldContext(ctx); fieldContext != nil { - fic.ParentField = fieldContext - } - if fieldInputContext := GetPathContext(ctx); fieldInputContext != nil { - fic.Parent = fieldInputContext - } - - return context.WithValue(ctx, fieldInputCtx, fic) -} - -func GetPathContext(ctx context.Context) *PathContext { - if val, ok := ctx.Value(fieldInputCtx).(*PathContext); ok { - return val - } - return nil -} - -func GetPath(ctx context.Context) ast.Path { - if pc := GetPathContext(ctx); pc != nil { - return pc.Path() - } - if fc := GetFieldContext(ctx); fc != nil { - return fc.Path() - } - return nil -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/context_response.go b/vendor/github.com/99designs/gqlgen/graphql/context_response.go deleted file mode 100644 index c128fdb49c..0000000000 --- a/vendor/github.com/99designs/gqlgen/graphql/context_response.go +++ /dev/null @@ -1,153 +0,0 @@ -package graphql - -import ( - "context" - "fmt" - "sync" - - "github.com/vektah/gqlparser/v2/gqlerror" -) - -type responseContext struct { - errorPresenter ErrorPresenterFunc - recover RecoverFunc - - errors gqlerror.List - errorsMu sync.Mutex - - extensions map[string]interface{} - extensionsMu sync.Mutex -} - -const resultCtx key = "result_context" - -func getResponseContext(ctx context.Context) *responseContext { - val, ok := ctx.Value(resultCtx).(*responseContext) - if !ok { - panic("missing response context") - } - return val -} - -func WithResponseContext(ctx context.Context, presenterFunc ErrorPresenterFunc, recoverFunc RecoverFunc) context.Context { - return context.WithValue(ctx, resultCtx, &responseContext{ - errorPresenter: presenterFunc, - recover: recoverFunc, - }) -} - -// AddErrorf writes a formatted error to the client, first passing it through the error presenter. -func AddErrorf(ctx context.Context, format string, args ...interface{}) { - AddError(ctx, fmt.Errorf(format, args...)) -} - -// AddError sends an error to the client, first passing it through the error presenter. -func AddError(ctx context.Context, err error) { - c := getResponseContext(ctx) - - presentedError := c.errorPresenter(ctx, ErrorOnPath(ctx, err)) - - c.errorsMu.Lock() - defer c.errorsMu.Unlock() - c.errors = append(c.errors, presentedError) -} - -func Recover(ctx context.Context, err interface{}) (userMessage error) { - c := getResponseContext(ctx) - return ErrorOnPath(ctx, c.recover(ctx, err)) -} - -// HasFieldError returns true if the given field has already errored -func HasFieldError(ctx context.Context, rctx *FieldContext) bool { - c := getResponseContext(ctx) - - c.errorsMu.Lock() - defer c.errorsMu.Unlock() - - if len(c.errors) == 0 { - return false - } - - path := rctx.Path() - for _, err := range c.errors { - if equalPath(err.Path, path) { - return true - } - } - return false -} - -// GetFieldErrors returns a list of errors that occurred in the given field -func GetFieldErrors(ctx context.Context, rctx *FieldContext) gqlerror.List { - c := getResponseContext(ctx) - - c.errorsMu.Lock() - defer c.errorsMu.Unlock() - - if len(c.errors) == 0 { - return nil - } - - path := rctx.Path() - var errs gqlerror.List - for _, err := range c.errors { - if equalPath(err.Path, path) { - errs = append(errs, err) - } - } - return errs -} - -func GetErrors(ctx context.Context) gqlerror.List { - resCtx := getResponseContext(ctx) - resCtx.errorsMu.Lock() - defer resCtx.errorsMu.Unlock() - - if len(resCtx.errors) == 0 { - return nil - } - - errs := resCtx.errors - cpy := make(gqlerror.List, len(errs)) - for i := range errs { - errCpy := *errs[i] - cpy[i] = &errCpy - } - return cpy -} - -// RegisterExtension allows you to add a new extension into the graphql response -func RegisterExtension(ctx context.Context, key string, value interface{}) { - c := getResponseContext(ctx) - c.extensionsMu.Lock() - defer c.extensionsMu.Unlock() - - if c.extensions == nil { - c.extensions = make(map[string]interface{}) - } - - if _, ok := c.extensions[key]; ok { - panic(fmt.Errorf("extension already registered for key %s", key)) - } - - c.extensions[key] = value -} - -// GetExtensions returns any extensions registered in the current result context -func GetExtensions(ctx context.Context) map[string]interface{} { - ext := getResponseContext(ctx).extensions - if ext == nil { - return map[string]interface{}{} - } - - return ext -} - -func GetExtension(ctx context.Context, name string) interface{} { - ext := getResponseContext(ctx).extensions - if ext == nil { - return nil - } - - return ext[name] -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/context_root_field.go b/vendor/github.com/99designs/gqlgen/graphql/context_root_field.go deleted file mode 100644 index 1bf4d13b84..0000000000 --- a/vendor/github.com/99designs/gqlgen/graphql/context_root_field.go +++ /dev/null @@ -1,25 +0,0 @@ -package graphql - -import ( - "context" -) - -const rootResolverCtx key = "root_resolver_context" - -type RootFieldContext struct { - // The name of the type this field belongs to - Object string - // The raw field - Field CollectedField -} - -func GetRootFieldContext(ctx context.Context) *RootFieldContext { - if val, ok := ctx.Value(rootResolverCtx).(*RootFieldContext); ok { - return val - } - return nil -} - -func WithRootFieldContext(ctx context.Context, rc *RootFieldContext) context.Context { - return context.WithValue(ctx, rootResolverCtx, rc) -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/error.go b/vendor/github.com/99designs/gqlgen/graphql/error.go deleted file mode 100644 index f816bef6b8..0000000000 --- a/vendor/github.com/99designs/gqlgen/graphql/error.go +++ /dev/null @@ -1,33 +0,0 @@ -package graphql - -import ( - "context" - "errors" - - "github.com/vektah/gqlparser/v2/gqlerror" -) - -type ErrorPresenterFunc func(ctx context.Context, err error) *gqlerror.Error - -func DefaultErrorPresenter(ctx context.Context, err error) *gqlerror.Error { - var gqlErr *gqlerror.Error - if errors.As(err, &gqlErr) { - return gqlErr - } - return gqlerror.WrapPath(GetPath(ctx), err) -} - -func ErrorOnPath(ctx context.Context, err error) error { - if err == nil { - return nil - } - var gqlErr *gqlerror.Error - if errors.As(err, &gqlErr) { - if gqlErr.Path == nil { - gqlErr.Path = GetPath(ctx) - } - // Return the original error to avoid losing any attached annotation - return err - } - return gqlerror.WrapPath(GetPath(ctx), err) -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/executable_schema.go b/vendor/github.com/99designs/gqlgen/graphql/executable_schema.go deleted file mode 100644 index 6189162288..0000000000 --- a/vendor/github.com/99designs/gqlgen/graphql/executable_schema.go +++ /dev/null @@ -1,167 +0,0 @@ -//go:generate go run github.com/matryer/moq -out executable_schema_mock.go . ExecutableSchema - -package graphql - -import ( - "context" - "fmt" - - "github.com/vektah/gqlparser/v2/ast" -) - -type ExecutableSchema interface { - Schema() *ast.Schema - - Complexity(typeName, fieldName string, childComplexity int, args map[string]interface{}) (int, bool) - Exec(ctx context.Context) ResponseHandler -} - -// CollectFields returns the set of fields from an ast.SelectionSet where all collected fields satisfy at least one of the GraphQL types -// passed through satisfies. Providing an empty or nil slice for satisfies will return collect all fields regardless of fragment -// type conditions. -func CollectFields(reqCtx *OperationContext, selSet ast.SelectionSet, satisfies []string) []CollectedField { - return collectFields(reqCtx, selSet, satisfies, map[string]bool{}) -} - -func collectFields(reqCtx *OperationContext, selSet ast.SelectionSet, satisfies []string, visited map[string]bool) []CollectedField { - groupedFields := make([]CollectedField, 0, len(selSet)) - - for _, sel := range selSet { - switch sel := sel.(type) { - case *ast.Field: - if !shouldIncludeNode(sel.Directives, reqCtx.Variables) { - continue - } - f := getOrCreateAndAppendField(&groupedFields, sel.Name, sel.Alias, sel.ObjectDefinition, func() CollectedField { - return CollectedField{Field: sel} - }) - - f.Selections = append(f.Selections, sel.SelectionSet...) - - case *ast.InlineFragment: - if !shouldIncludeNode(sel.Directives, reqCtx.Variables) { - continue - } - if len(satisfies) > 0 && !instanceOf(sel.TypeCondition, satisfies) { - continue - } - for _, childField := range collectFields(reqCtx, sel.SelectionSet, satisfies, visited) { - f := getOrCreateAndAppendField(&groupedFields, childField.Name, childField.Alias, childField.ObjectDefinition, func() CollectedField { return childField }) - f.Selections = append(f.Selections, childField.Selections...) - } - - case *ast.FragmentSpread: - if !shouldIncludeNode(sel.Directives, reqCtx.Variables) { - continue - } - fragmentName := sel.Name - if _, seen := visited[fragmentName]; seen { - continue - } - visited[fragmentName] = true - - fragment := reqCtx.Doc.Fragments.ForName(fragmentName) - if fragment == nil { - // should never happen, validator has already run - panic(fmt.Errorf("missing fragment %s", fragmentName)) - } - - if len(satisfies) > 0 && !instanceOf(fragment.TypeCondition, satisfies) { - continue - } - - for _, childField := range collectFields(reqCtx, fragment.SelectionSet, satisfies, visited) { - f := getOrCreateAndAppendField(&groupedFields, childField.Name, childField.Alias, childField.ObjectDefinition, func() CollectedField { return childField }) - f.Selections = append(f.Selections, childField.Selections...) - } - - default: - panic(fmt.Errorf("unsupported %T", sel)) - } - } - - return groupedFields -} - -type CollectedField struct { - *ast.Field - - Selections ast.SelectionSet -} - -func instanceOf(val string, satisfies []string) bool { - for _, s := range satisfies { - if val == s { - return true - } - } - return false -} - -func getOrCreateAndAppendField(c *[]CollectedField, name string, alias string, objectDefinition *ast.Definition, creator func() CollectedField) *CollectedField { - for i, cf := range *c { - if cf.Name == name && cf.Alias == alias { - if cf.ObjectDefinition == objectDefinition { - return &(*c)[i] - } - - if cf.ObjectDefinition == nil || objectDefinition == nil { - continue - } - - if cf.ObjectDefinition.Name == objectDefinition.Name { - return &(*c)[i] - } - - for _, ifc := range objectDefinition.Interfaces { - if ifc == cf.ObjectDefinition.Name { - return &(*c)[i] - } - } - for _, ifc := range cf.ObjectDefinition.Interfaces { - if ifc == objectDefinition.Name { - return &(*c)[i] - } - } - } - } - - f := creator() - - *c = append(*c, f) - return &(*c)[len(*c)-1] -} - -func shouldIncludeNode(directives ast.DirectiveList, variables map[string]interface{}) bool { - if len(directives) == 0 { - return true - } - - skip, include := false, true - - if d := directives.ForName("skip"); d != nil { - skip = resolveIfArgument(d, variables) - } - - if d := directives.ForName("include"); d != nil { - include = resolveIfArgument(d, variables) - } - - return !skip && include -} - -func resolveIfArgument(d *ast.Directive, variables map[string]interface{}) bool { - arg := d.Arguments.ForName("if") - if arg == nil { - panic(fmt.Sprintf("%s: argument 'if' not defined", d.Name)) - } - value, err := arg.Value.Value(variables) - if err != nil { - panic(err) - } - ret, ok := value.(bool) - if !ok { - panic(fmt.Sprintf("%s: argument 'if' is not a boolean", d.Name)) - } - return ret -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/executable_schema_mock.go b/vendor/github.com/99designs/gqlgen/graphql/executable_schema_mock.go deleted file mode 100644 index 5d7433162f..0000000000 --- a/vendor/github.com/99designs/gqlgen/graphql/executable_schema_mock.go +++ /dev/null @@ -1,172 +0,0 @@ -// Code generated by moq; DO NOT EDIT. -// github.com/matryer/moq - -package graphql - -import ( - "context" - "github.com/vektah/gqlparser/v2/ast" - "sync" -) - -// Ensure, that ExecutableSchemaMock does implement ExecutableSchema. -// If this is not the case, regenerate this file with moq. -var _ ExecutableSchema = &ExecutableSchemaMock{} - -// ExecutableSchemaMock is a mock implementation of ExecutableSchema. -// -// func TestSomethingThatUsesExecutableSchema(t *testing.T) { -// -// // make and configure a mocked ExecutableSchema -// mockedExecutableSchema := &ExecutableSchemaMock{ -// ComplexityFunc: func(typeName string, fieldName string, childComplexity int, args map[string]interface{}) (int, bool) { -// panic("mock out the Complexity method") -// }, -// ExecFunc: func(ctx context.Context) ResponseHandler { -// panic("mock out the Exec method") -// }, -// SchemaFunc: func() *ast.Schema { -// panic("mock out the Schema method") -// }, -// } -// -// // use mockedExecutableSchema in code that requires ExecutableSchema -// // and then make assertions. -// -// } -type ExecutableSchemaMock struct { - // ComplexityFunc mocks the Complexity method. - ComplexityFunc func(typeName string, fieldName string, childComplexity int, args map[string]interface{}) (int, bool) - - // ExecFunc mocks the Exec method. - ExecFunc func(ctx context.Context) ResponseHandler - - // SchemaFunc mocks the Schema method. - SchemaFunc func() *ast.Schema - - // calls tracks calls to the methods. - calls struct { - // Complexity holds details about calls to the Complexity method. - Complexity []struct { - // TypeName is the typeName argument value. - TypeName string - // FieldName is the fieldName argument value. - FieldName string - // ChildComplexity is the childComplexity argument value. - ChildComplexity int - // Args is the args argument value. - Args map[string]interface{} - } - // Exec holds details about calls to the Exec method. - Exec []struct { - // Ctx is the ctx argument value. - Ctx context.Context - } - // Schema holds details about calls to the Schema method. - Schema []struct { - } - } - lockComplexity sync.RWMutex - lockExec sync.RWMutex - lockSchema sync.RWMutex -} - -// Complexity calls ComplexityFunc. -func (mock *ExecutableSchemaMock) Complexity(typeName string, fieldName string, childComplexity int, args map[string]interface{}) (int, bool) { - if mock.ComplexityFunc == nil { - panic("ExecutableSchemaMock.ComplexityFunc: method is nil but ExecutableSchema.Complexity was just called") - } - callInfo := struct { - TypeName string - FieldName string - ChildComplexity int - Args map[string]interface{} - }{ - TypeName: typeName, - FieldName: fieldName, - ChildComplexity: childComplexity, - Args: args, - } - mock.lockComplexity.Lock() - mock.calls.Complexity = append(mock.calls.Complexity, callInfo) - mock.lockComplexity.Unlock() - return mock.ComplexityFunc(typeName, fieldName, childComplexity, args) -} - -// ComplexityCalls gets all the calls that were made to Complexity. -// Check the length with: -// len(mockedExecutableSchema.ComplexityCalls()) -func (mock *ExecutableSchemaMock) ComplexityCalls() []struct { - TypeName string - FieldName string - ChildComplexity int - Args map[string]interface{} -} { - var calls []struct { - TypeName string - FieldName string - ChildComplexity int - Args map[string]interface{} - } - mock.lockComplexity.RLock() - calls = mock.calls.Complexity - mock.lockComplexity.RUnlock() - return calls -} - -// Exec calls ExecFunc. -func (mock *ExecutableSchemaMock) Exec(ctx context.Context) ResponseHandler { - if mock.ExecFunc == nil { - panic("ExecutableSchemaMock.ExecFunc: method is nil but ExecutableSchema.Exec was just called") - } - callInfo := struct { - Ctx context.Context - }{ - Ctx: ctx, - } - mock.lockExec.Lock() - mock.calls.Exec = append(mock.calls.Exec, callInfo) - mock.lockExec.Unlock() - return mock.ExecFunc(ctx) -} - -// ExecCalls gets all the calls that were made to Exec. -// Check the length with: -// len(mockedExecutableSchema.ExecCalls()) -func (mock *ExecutableSchemaMock) ExecCalls() []struct { - Ctx context.Context -} { - var calls []struct { - Ctx context.Context - } - mock.lockExec.RLock() - calls = mock.calls.Exec - mock.lockExec.RUnlock() - return calls -} - -// Schema calls SchemaFunc. -func (mock *ExecutableSchemaMock) Schema() *ast.Schema { - if mock.SchemaFunc == nil { - panic("ExecutableSchemaMock.SchemaFunc: method is nil but ExecutableSchema.Schema was just called") - } - callInfo := struct { - }{} - mock.lockSchema.Lock() - mock.calls.Schema = append(mock.calls.Schema, callInfo) - mock.lockSchema.Unlock() - return mock.SchemaFunc() -} - -// SchemaCalls gets all the calls that were made to Schema. -// Check the length with: -// len(mockedExecutableSchema.SchemaCalls()) -func (mock *ExecutableSchemaMock) SchemaCalls() []struct { -} { - var calls []struct { - } - mock.lockSchema.RLock() - calls = mock.calls.Schema - mock.lockSchema.RUnlock() - return calls -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/fieldset.go b/vendor/github.com/99designs/gqlgen/graphql/fieldset.go deleted file mode 100644 index 351e266fdb..0000000000 --- a/vendor/github.com/99designs/gqlgen/graphql/fieldset.go +++ /dev/null @@ -1,63 +0,0 @@ -package graphql - -import ( - "io" - "sync" -) - -type FieldSet struct { - fields []CollectedField - Values []Marshaler - delayed []delayedResult -} - -type delayedResult struct { - i int - f func() Marshaler -} - -func NewFieldSet(fields []CollectedField) *FieldSet { - return &FieldSet{ - fields: fields, - Values: make([]Marshaler, len(fields)), - } -} - -func (m *FieldSet) Concurrently(i int, f func() Marshaler) { - m.delayed = append(m.delayed, delayedResult{i: i, f: f}) -} - -func (m *FieldSet) Dispatch() { - if len(m.delayed) == 1 { - // only one concurrent task, no need to spawn a goroutine or deal create waitgroups - d := m.delayed[0] - m.Values[d.i] = d.f() - } else if len(m.delayed) > 1 { - // more than one concurrent task, use the main goroutine to do one, only spawn goroutines for the others - - var wg sync.WaitGroup - for _, d := range m.delayed[1:] { - wg.Add(1) - go func(d delayedResult) { - m.Values[d.i] = d.f() - wg.Done() - }(d) - } - - m.Values[m.delayed[0].i] = m.delayed[0].f() - wg.Wait() - } -} - -func (m *FieldSet) MarshalGQL(writer io.Writer) { - writer.Write(openBrace) - for i, field := range m.fields { - if i != 0 { - writer.Write(comma) - } - writeQuotedString(writer, field.Alias) - writer.Write(colon) - m.Values[i].MarshalGQL(writer) - } - writer.Write(closeBrace) -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/float.go b/vendor/github.com/99designs/gqlgen/graphql/float.go deleted file mode 100644 index ccb825ddb8..0000000000 --- a/vendor/github.com/99designs/gqlgen/graphql/float.go +++ /dev/null @@ -1,47 +0,0 @@ -package graphql - -import ( - "context" - "encoding/json" - "fmt" - "io" - "math" - "strconv" -) - -func MarshalFloat(f float64) Marshaler { - return WriterFunc(func(w io.Writer) { - io.WriteString(w, fmt.Sprintf("%g", f)) - }) -} - -func UnmarshalFloat(v interface{}) (float64, error) { - switch v := v.(type) { - case string: - return strconv.ParseFloat(v, 64) - case int: - return float64(v), nil - case int64: - return float64(v), nil - case float64: - return v, nil - case json.Number: - return strconv.ParseFloat(string(v), 64) - default: - return 0, fmt.Errorf("%T is not an float", v) - } -} - -func MarshalFloatContext(f float64) ContextMarshaler { - return ContextWriterFunc(func(ctx context.Context, w io.Writer) error { - if math.IsInf(f, 0) || math.IsNaN(f) { - return fmt.Errorf("cannot marshal infinite no NaN float values") - } - io.WriteString(w, fmt.Sprintf("%g", f)) - return nil - }) -} - -func UnmarshalFloatContext(ctx context.Context, v interface{}) (float64, error) { - return UnmarshalFloat(v) -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/handler.go b/vendor/github.com/99designs/gqlgen/graphql/handler.go deleted file mode 100644 index cd358740c8..0000000000 --- a/vendor/github.com/99designs/gqlgen/graphql/handler.go +++ /dev/null @@ -1,131 +0,0 @@ -package graphql - -import ( - "context" - "net/http" - "strconv" - "strings" - - "github.com/vektah/gqlparser/v2/gqlerror" -) - -type ( - OperationMiddleware func(ctx context.Context, next OperationHandler) ResponseHandler - OperationHandler func(ctx context.Context) ResponseHandler - - ResponseHandler func(ctx context.Context) *Response - ResponseMiddleware func(ctx context.Context, next ResponseHandler) *Response - - Resolver func(ctx context.Context) (res interface{}, err error) - FieldMiddleware func(ctx context.Context, next Resolver) (res interface{}, err error) - - RootResolver func(ctx context.Context) Marshaler - RootFieldMiddleware func(ctx context.Context, next RootResolver) Marshaler - - RawParams struct { - Query string `json:"query"` - OperationName string `json:"operationName"` - Variables map[string]interface{} `json:"variables"` - Extensions map[string]interface{} `json:"extensions"` - Headers http.Header `json:"headers"` - - ReadTime TraceTiming `json:"-"` - } - - GraphExecutor interface { - CreateOperationContext(ctx context.Context, params *RawParams) (*OperationContext, gqlerror.List) - DispatchOperation(ctx context.Context, rc *OperationContext) (ResponseHandler, context.Context) - DispatchError(ctx context.Context, list gqlerror.List) *Response - } - - // HandlerExtension adds functionality to the http handler. See the list of possible hook points below - // Its important to understand the lifecycle of a graphql request and the terminology we use in gqlgen - // before working with these - // - // +--- REQUEST POST /graphql --------------------------------------------+ - // | +- OPERATION query OpName { viewer { name } } -----------------------+ | - // | | RESPONSE { "data": { "viewer": { "name": "bob" } } } | | - // | +- OPERATION subscription OpName2 { chat { message } } --------------+ | - // | | RESPONSE { "data": { "chat": { "message": "hello" } } } | | - // | | RESPONSE { "data": { "chat": { "message": "byee" } } } | | - // | +--------------------------------------------------------------------+ | - // +------------------------------------------------------------------------+ - HandlerExtension interface { - // ExtensionName should be a CamelCase string version of the extension which may be shown in stats and logging. - ExtensionName() string - // Validate is called when adding an extension to the server, it allows validation against the servers schema. - Validate(schema ExecutableSchema) error - } - - // OperationParameterMutator is called before creating a request context. allows manipulating the raw query - // on the way in. - OperationParameterMutator interface { - MutateOperationParameters(ctx context.Context, request *RawParams) *gqlerror.Error - } - - // OperationContextMutator is called after creating the request context, but before executing the root resolver. - OperationContextMutator interface { - MutateOperationContext(ctx context.Context, rc *OperationContext) *gqlerror.Error - } - - // OperationInterceptor is called for each incoming query, for basic requests the writer will be invoked once, - // for subscriptions it will be invoked multiple times. - OperationInterceptor interface { - InterceptOperation(ctx context.Context, next OperationHandler) ResponseHandler - } - - // ResponseInterceptor is called around each graphql operation response. This can be called many times for a single - // operation the case of subscriptions. - ResponseInterceptor interface { - InterceptResponse(ctx context.Context, next ResponseHandler) *Response - } - - RootFieldInterceptor interface { - InterceptRootField(ctx context.Context, next RootResolver) Marshaler - } - - // FieldInterceptor called around each field - FieldInterceptor interface { - InterceptField(ctx context.Context, next Resolver) (res interface{}, err error) - } - - // Transport provides support for different wire level encodings of graphql requests, eg Form, Get, Post, Websocket - Transport interface { - Supports(r *http.Request) bool - Do(w http.ResponseWriter, r *http.Request, exec GraphExecutor) - } -) - -type Status int - -func (p *RawParams) AddUpload(upload Upload, key, path string) *gqlerror.Error { - if !strings.HasPrefix(path, "variables.") { - return gqlerror.Errorf("invalid operations paths for key %s", key) - } - - var ptr interface{} = p.Variables - parts := strings.Split(path, ".") - - // skip the first part (variables) because we started there - for i, p := range parts[1:] { - last := i == len(parts)-2 - if ptr == nil { - return gqlerror.Errorf("path is missing \"variables.\" prefix, key: %s, path: %s", key, path) - } - if index, parseNbrErr := strconv.Atoi(p); parseNbrErr == nil { - if last { - ptr.([]interface{})[index] = upload - } else { - ptr = ptr.([]interface{})[index] - } - } else { - if last { - ptr.(map[string]interface{})[p] = upload - } else { - ptr = ptr.(map[string]interface{})[p] - } - } - } - - return nil -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/id.go b/vendor/github.com/99designs/gqlgen/graphql/id.go deleted file mode 100644 index b24605d1d8..0000000000 --- a/vendor/github.com/99designs/gqlgen/graphql/id.go +++ /dev/null @@ -1,58 +0,0 @@ -package graphql - -import ( - "encoding/json" - "fmt" - "io" - "strconv" -) - -func MarshalID(s string) Marshaler { - return MarshalString(s) -} - -func UnmarshalID(v interface{}) (string, error) { - switch v := v.(type) { - case string: - return v, nil - case json.Number: - return string(v), nil - case int: - return strconv.Itoa(v), nil - case int64: - return strconv.FormatInt(v, 10), nil - case float64: - return fmt.Sprintf("%f", v), nil - case bool: - if v { - return "true", nil - } else { - return "false", nil - } - case nil: - return "null", nil - default: - return "", fmt.Errorf("%T is not a string", v) - } -} - -func MarshalIntID(i int) Marshaler { - return WriterFunc(func(w io.Writer) { - writeQuotedString(w, strconv.Itoa(i)) - }) -} - -func UnmarshalIntID(v interface{}) (int, error) { - switch v := v.(type) { - case string: - return strconv.Atoi(v) - case int: - return v, nil - case int64: - return int(v), nil - case json.Number: - return strconv.Atoi(string(v)) - default: - return 0, fmt.Errorf("%T is not an int", v) - } -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/input.go b/vendor/github.com/99designs/gqlgen/graphql/input.go deleted file mode 100644 index 88c3efaa6e..0000000000 --- a/vendor/github.com/99designs/gqlgen/graphql/input.go +++ /dev/null @@ -1,55 +0,0 @@ -package graphql - -import ( - "context" - "errors" - "reflect" -) - -const unmarshalInputCtx key = "unmarshal_input_context" - -// BuildUnmarshalerMap returns a map of unmarshal functions of the ExecutableContext -// to use with the WithUnmarshalerMap function. -func BuildUnmarshalerMap(unmarshaler ...interface{}) map[reflect.Type]reflect.Value { - maps := make(map[reflect.Type]reflect.Value) - for _, v := range unmarshaler { - ft := reflect.TypeOf(v) - if ft.Kind() == reflect.Func { - maps[ft.Out(0)] = reflect.ValueOf(v) - } - } - - return maps -} - -// WithUnmarshalerMap returns a new context with a map from input types to their unmarshaler functions. -func WithUnmarshalerMap(ctx context.Context, maps map[reflect.Type]reflect.Value) context.Context { - return context.WithValue(ctx, unmarshalInputCtx, maps) -} - -// UnmarshalInputFromContext allows unmarshaling input object from a context. -func UnmarshalInputFromContext(ctx context.Context, raw, v interface{}) error { - m, ok := ctx.Value(unmarshalInputCtx).(map[reflect.Type]reflect.Value) - if m == nil || !ok { - return errors.New("graphql: the input context is empty") - } - - rv := reflect.ValueOf(v) - if rv.Kind() != reflect.Ptr || rv.IsNil() { - return errors.New("graphql: input must be a non-nil pointer") - } - if fn, ok := m[rv.Elem().Type()]; ok { - res := fn.Call([]reflect.Value{ - reflect.ValueOf(ctx), - reflect.ValueOf(raw), - }) - if err := res[1].Interface(); err != nil { - return err.(error) - } - - rv.Elem().Set(res[0]) - return nil - } - - return errors.New("graphql: no unmarshal function found") -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/int.go b/vendor/github.com/99designs/gqlgen/graphql/int.go deleted file mode 100644 index 57d0d589ba..0000000000 --- a/vendor/github.com/99designs/gqlgen/graphql/int.go +++ /dev/null @@ -1,79 +0,0 @@ -package graphql - -import ( - "encoding/json" - "fmt" - "io" - "strconv" -) - -func MarshalInt(i int) Marshaler { - return WriterFunc(func(w io.Writer) { - io.WriteString(w, strconv.Itoa(i)) - }) -} - -func UnmarshalInt(v interface{}) (int, error) { - switch v := v.(type) { - case string: - return strconv.Atoi(v) - case int: - return v, nil - case int64: - return int(v), nil - case json.Number: - return strconv.Atoi(string(v)) - default: - return 0, fmt.Errorf("%T is not an int", v) - } -} - -func MarshalInt64(i int64) Marshaler { - return WriterFunc(func(w io.Writer) { - io.WriteString(w, strconv.FormatInt(i, 10)) - }) -} - -func UnmarshalInt64(v interface{}) (int64, error) { - switch v := v.(type) { - case string: - return strconv.ParseInt(v, 10, 64) - case int: - return int64(v), nil - case int64: - return v, nil - case json.Number: - return strconv.ParseInt(string(v), 10, 64) - default: - return 0, fmt.Errorf("%T is not an int", v) - } -} - -func MarshalInt32(i int32) Marshaler { - return WriterFunc(func(w io.Writer) { - io.WriteString(w, strconv.FormatInt(int64(i), 10)) - }) -} - -func UnmarshalInt32(v interface{}) (int32, error) { - switch v := v.(type) { - case string: - iv, err := strconv.ParseInt(v, 10, 32) - if err != nil { - return 0, err - } - return int32(iv), nil - case int: - return int32(v), nil - case int64: - return int32(v), nil - case json.Number: - iv, err := strconv.ParseInt(string(v), 10, 32) - if err != nil { - return 0, err - } - return int32(iv), nil - default: - return 0, fmt.Errorf("%T is not an int", v) - } -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/introspection/introspection.go b/vendor/github.com/99designs/gqlgen/graphql/introspection/introspection.go deleted file mode 100644 index 8482d62a86..0000000000 --- a/vendor/github.com/99designs/gqlgen/graphql/introspection/introspection.go +++ /dev/null @@ -1,101 +0,0 @@ -// introspection implements the spec defined in https://github.com/facebook/graphql/blob/master/spec/Section%204%20--%20Introspection.md#schema-introspection -package introspection - -import "github.com/vektah/gqlparser/v2/ast" - -type ( - Directive struct { - Name string - description string - Locations []string - Args []InputValue - IsRepeatable bool - } - - EnumValue struct { - Name string - description string - deprecation *ast.Directive - } - - Field struct { - Name string - description string - Type *Type - Args []InputValue - deprecation *ast.Directive - } - - InputValue struct { - Name string - description string - DefaultValue *string - Type *Type - } -) - -func WrapSchema(schema *ast.Schema) *Schema { - return &Schema{schema: schema} -} - -func (f *EnumValue) Description() *string { - if f.description == "" { - return nil - } - return &f.description -} - -func (f *EnumValue) IsDeprecated() bool { - return f.deprecation != nil -} - -func (f *EnumValue) DeprecationReason() *string { - if f.deprecation == nil { - return nil - } - - reason := f.deprecation.Arguments.ForName("reason") - if reason == nil { - return nil - } - - return &reason.Value.Raw -} - -func (f *Field) Description() *string { - if f.description == "" { - return nil - } - return &f.description -} - -func (f *Field) IsDeprecated() bool { - return f.deprecation != nil -} - -func (f *Field) DeprecationReason() *string { - if f.deprecation == nil { - return nil - } - - reason := f.deprecation.Arguments.ForName("reason") - if reason == nil { - return nil - } - - return &reason.Value.Raw -} - -func (f *InputValue) Description() *string { - if f.description == "" { - return nil - } - return &f.description -} - -func (f *Directive) Description() *string { - if f.description == "" { - return nil - } - return &f.description -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/introspection/query.go b/vendor/github.com/99designs/gqlgen/graphql/introspection/query.go deleted file mode 100644 index 389a5d85c0..0000000000 --- a/vendor/github.com/99designs/gqlgen/graphql/introspection/query.go +++ /dev/null @@ -1,106 +0,0 @@ -package introspection - -// Query is the query generated by graphiql to determine type information -const Query = ` -query IntrospectionQuery { - __schema { - description - queryType { - name - } - mutationType { - name - } - subscriptionType { - name - } - types { - ...FullType - } - directives { - name - description - locations - args { - ...InputValue - } - } - } -} - -fragment FullType on __Type { - kind - name - description - specifiedByURL - fields(includeDeprecated: true) { - name - description - args { - ...InputValue - } - type { - ...TypeRef - } - isDeprecated - deprecationReason - } - inputFields { - ...InputValue - } - interfaces { - ...TypeRef - } - enumValues(includeDeprecated: true) { - name - description - isDeprecated - deprecationReason - } - possibleTypes { - ...TypeRef - } -} - -fragment InputValue on __InputValue { - name - description - type { - ...TypeRef - } - defaultValue -} - -fragment TypeRef on __Type { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - } - } - } - } - } - } - } -} -` diff --git a/vendor/github.com/99designs/gqlgen/graphql/introspection/schema.go b/vendor/github.com/99designs/gqlgen/graphql/introspection/schema.go deleted file mode 100644 index b7b0ad94e0..0000000000 --- a/vendor/github.com/99designs/gqlgen/graphql/introspection/schema.go +++ /dev/null @@ -1,93 +0,0 @@ -package introspection - -import ( - "sort" - "strings" - - "github.com/vektah/gqlparser/v2/ast" -) - -type Schema struct { - schema *ast.Schema -} - -func (s *Schema) Description() *string { - if s.schema.Description == "" { - return nil - } - return &s.schema.Description -} - -func (s *Schema) Types() []Type { - typeIndex := map[string]Type{} - typeNames := make([]string, 0, len(s.schema.Types)) - for _, typ := range s.schema.Types { - if strings.HasPrefix(typ.Name, "__") { - continue - } - typeNames = append(typeNames, typ.Name) - typeIndex[typ.Name] = *WrapTypeFromDef(s.schema, typ) - } - sort.Strings(typeNames) - - types := make([]Type, len(typeNames)) - for i, t := range typeNames { - types[i] = typeIndex[t] - } - return types -} - -func (s *Schema) QueryType() *Type { - return WrapTypeFromDef(s.schema, s.schema.Query) -} - -func (s *Schema) MutationType() *Type { - return WrapTypeFromDef(s.schema, s.schema.Mutation) -} - -func (s *Schema) SubscriptionType() *Type { - return WrapTypeFromDef(s.schema, s.schema.Subscription) -} - -func (s *Schema) Directives() []Directive { - dIndex := map[string]Directive{} - dNames := make([]string, 0, len(s.schema.Directives)) - - for _, d := range s.schema.Directives { - dNames = append(dNames, d.Name) - dIndex[d.Name] = s.directiveFromDef(d) - } - sort.Strings(dNames) - - res := make([]Directive, len(dNames)) - for i, d := range dNames { - res[i] = dIndex[d] - } - - return res -} - -func (s *Schema) directiveFromDef(d *ast.DirectiveDefinition) Directive { - locs := make([]string, len(d.Locations)) - for i, loc := range d.Locations { - locs[i] = string(loc) - } - - args := make([]InputValue, len(d.Arguments)) - for i, arg := range d.Arguments { - args[i] = InputValue{ - Name: arg.Name, - description: arg.Description, - DefaultValue: defaultValue(arg.DefaultValue), - Type: WrapTypeFromType(s.schema, arg.Type), - } - } - - return Directive{ - Name: d.Name, - description: d.Description, - Locations: locs, - Args: args, - IsRepeatable: d.IsRepeatable, - } -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/introspection/type.go b/vendor/github.com/99designs/gqlgen/graphql/introspection/type.go deleted file mode 100644 index c50733d0df..0000000000 --- a/vendor/github.com/99designs/gqlgen/graphql/introspection/type.go +++ /dev/null @@ -1,191 +0,0 @@ -package introspection - -import ( - "strings" - - "github.com/vektah/gqlparser/v2/ast" -) - -type Type struct { - schema *ast.Schema - def *ast.Definition - typ *ast.Type -} - -func WrapTypeFromDef(s *ast.Schema, def *ast.Definition) *Type { - if def == nil { - return nil - } - return &Type{schema: s, def: def} -} - -func WrapTypeFromType(s *ast.Schema, typ *ast.Type) *Type { - if typ == nil { - return nil - } - - if !typ.NonNull && typ.NamedType != "" { - return &Type{schema: s, def: s.Types[typ.NamedType]} - } - return &Type{schema: s, typ: typ} -} - -func (t *Type) Kind() string { - if t.typ != nil { - if t.typ.NonNull { - return "NON_NULL" - } - - if t.typ.Elem != nil { - return "LIST" - } - } else { - return string(t.def.Kind) - } - - panic("UNKNOWN") -} - -func (t *Type) Name() *string { - if t.def == nil { - return nil - } - return &t.def.Name -} - -func (t *Type) Description() *string { - if t.def == nil || t.def.Description == "" { - return nil - } - return &t.def.Description -} - -func (t *Type) Fields(includeDeprecated bool) []Field { - if t.def == nil || (t.def.Kind != ast.Object && t.def.Kind != ast.Interface) { - return []Field{} - } - fields := []Field{} - for _, f := range t.def.Fields { - if strings.HasPrefix(f.Name, "__") { - continue - } - - if !includeDeprecated && f.Directives.ForName("deprecated") != nil { - continue - } - - var args []InputValue - for _, arg := range f.Arguments { - args = append(args, InputValue{ - Type: WrapTypeFromType(t.schema, arg.Type), - Name: arg.Name, - description: arg.Description, - DefaultValue: defaultValue(arg.DefaultValue), - }) - } - - fields = append(fields, Field{ - Name: f.Name, - description: f.Description, - Args: args, - Type: WrapTypeFromType(t.schema, f.Type), - deprecation: f.Directives.ForName("deprecated"), - }) - } - return fields -} - -func (t *Type) InputFields() []InputValue { - if t.def == nil || t.def.Kind != ast.InputObject { - return []InputValue{} - } - - res := []InputValue{} - for _, f := range t.def.Fields { - res = append(res, InputValue{ - Name: f.Name, - description: f.Description, - Type: WrapTypeFromType(t.schema, f.Type), - DefaultValue: defaultValue(f.DefaultValue), - }) - } - return res -} - -func defaultValue(value *ast.Value) *string { - if value == nil { - return nil - } - val := value.String() - return &val -} - -func (t *Type) Interfaces() []Type { - if t.def == nil || t.def.Kind != ast.Object { - return []Type{} - } - - res := []Type{} - for _, intf := range t.def.Interfaces { - res = append(res, *WrapTypeFromDef(t.schema, t.schema.Types[intf])) - } - - return res -} - -func (t *Type) PossibleTypes() []Type { - if t.def == nil || (t.def.Kind != ast.Interface && t.def.Kind != ast.Union) { - return []Type{} - } - - res := []Type{} - for _, pt := range t.schema.GetPossibleTypes(t.def) { - res = append(res, *WrapTypeFromDef(t.schema, pt)) - } - return res -} - -func (t *Type) EnumValues(includeDeprecated bool) []EnumValue { - if t.def == nil || t.def.Kind != ast.Enum { - return []EnumValue{} - } - - res := []EnumValue{} - for _, val := range t.def.EnumValues { - if !includeDeprecated && val.Directives.ForName("deprecated") != nil { - continue - } - - res = append(res, EnumValue{ - Name: val.Name, - description: val.Description, - deprecation: val.Directives.ForName("deprecated"), - }) - } - return res -} - -func (t *Type) OfType() *Type { - if t.typ == nil { - return nil - } - if t.typ.NonNull { - // fake non null nodes - cpy := *t.typ - cpy.NonNull = false - - return WrapTypeFromType(t.schema, &cpy) - } - return WrapTypeFromType(t.schema, t.typ.Elem) -} - -func (t *Type) SpecifiedByURL() *string { - directive := t.def.Directives.ForName("specifiedBy") - if t.def.Kind != ast.Scalar || directive == nil { - return nil - } - // def: directive @specifiedBy(url: String!) on SCALAR - // the argument "url" is required. - url := directive.Arguments.ForName("url") - return &url.Value.Raw -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/jsonw.go b/vendor/github.com/99designs/gqlgen/graphql/jsonw.go deleted file mode 100644 index 54e293f1ad..0000000000 --- a/vendor/github.com/99designs/gqlgen/graphql/jsonw.go +++ /dev/null @@ -1,93 +0,0 @@ -package graphql - -import ( - "context" - "io" -) - -var ( - nullLit = []byte(`null`) - trueLit = []byte(`true`) - falseLit = []byte(`false`) - openBrace = []byte(`{`) - closeBrace = []byte(`}`) - openBracket = []byte(`[`) - closeBracket = []byte(`]`) - colon = []byte(`:`) - comma = []byte(`,`) -) - -var ( - Null = &lit{nullLit} - True = &lit{trueLit} - False = &lit{falseLit} -) - -type Marshaler interface { - MarshalGQL(w io.Writer) -} - -type Unmarshaler interface { - UnmarshalGQL(v interface{}) error -} - -type ContextMarshaler interface { - MarshalGQLContext(ctx context.Context, w io.Writer) error -} - -type ContextUnmarshaler interface { - UnmarshalGQLContext(ctx context.Context, v interface{}) error -} - -type contextMarshalerAdapter struct { - Context context.Context - ContextMarshaler -} - -func WrapContextMarshaler(ctx context.Context, m ContextMarshaler) Marshaler { - return contextMarshalerAdapter{Context: ctx, ContextMarshaler: m} -} - -func (a contextMarshalerAdapter) MarshalGQL(w io.Writer) { - err := a.MarshalGQLContext(a.Context, w) - if err != nil { - AddError(a.Context, err) - Null.MarshalGQL(w) - } -} - -type WriterFunc func(writer io.Writer) - -func (f WriterFunc) MarshalGQL(w io.Writer) { - f(w) -} - -type ContextWriterFunc func(ctx context.Context, writer io.Writer) error - -func (f ContextWriterFunc) MarshalGQLContext(ctx context.Context, w io.Writer) error { - return f(ctx, w) -} - -type Array []Marshaler - -func (a Array) MarshalGQL(writer io.Writer) { - writer.Write(openBracket) - for i, val := range a { - if i != 0 { - writer.Write(comma) - } - val.MarshalGQL(writer) - } - writer.Write(closeBracket) -} - -type lit struct{ b []byte } - -func (l lit) MarshalGQL(w io.Writer) { - w.Write(l.b) -} - -func (l lit) MarshalGQLContext(ctx context.Context, w io.Writer) error { - w.Write(l.b) - return nil -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/map.go b/vendor/github.com/99designs/gqlgen/graphql/map.go deleted file mode 100644 index 1e91d1d98c..0000000000 --- a/vendor/github.com/99designs/gqlgen/graphql/map.go +++ /dev/null @@ -1,24 +0,0 @@ -package graphql - -import ( - "encoding/json" - "fmt" - "io" -) - -func MarshalMap(val map[string]interface{}) Marshaler { - return WriterFunc(func(w io.Writer) { - err := json.NewEncoder(w).Encode(val) - if err != nil { - panic(err) - } - }) -} - -func UnmarshalMap(v interface{}) (map[string]interface{}, error) { - if m, ok := v.(map[string]interface{}); ok { - return m, nil - } - - return nil, fmt.Errorf("%T is not a map", v) -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/oneshot.go b/vendor/github.com/99designs/gqlgen/graphql/oneshot.go deleted file mode 100644 index 01fa15f896..0000000000 --- a/vendor/github.com/99designs/gqlgen/graphql/oneshot.go +++ /dev/null @@ -1,16 +0,0 @@ -package graphql - -import "context" - -func OneShot(resp *Response) ResponseHandler { - var oneshot bool - - return func(context context.Context) *Response { - if oneshot { - return nil - } - oneshot = true - - return resp - } -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/recovery.go b/vendor/github.com/99designs/gqlgen/graphql/recovery.go deleted file mode 100644 index 9bc0e47e1d..0000000000 --- a/vendor/github.com/99designs/gqlgen/graphql/recovery.go +++ /dev/null @@ -1,20 +0,0 @@ -package graphql - -import ( - "context" - "fmt" - "os" - "runtime/debug" - - "github.com/vektah/gqlparser/v2/gqlerror" -) - -type RecoverFunc func(ctx context.Context, err interface{}) (userMessage error) - -func DefaultRecover(ctx context.Context, err interface{}) error { - fmt.Fprintln(os.Stderr, err) - fmt.Fprintln(os.Stderr) - debug.PrintStack() - - return gqlerror.Errorf("internal system error") -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/response.go b/vendor/github.com/99designs/gqlgen/graphql/response.go deleted file mode 100644 index 0d36049a33..0000000000 --- a/vendor/github.com/99designs/gqlgen/graphql/response.go +++ /dev/null @@ -1,24 +0,0 @@ -package graphql - -import ( - "context" - "encoding/json" - "fmt" - - "github.com/vektah/gqlparser/v2/gqlerror" -) - -// Errors are intentionally serialized first based on the advice in -// https://github.com/facebook/graphql/commit/7b40390d48680b15cb93e02d46ac5eb249689876#diff-757cea6edf0288677a9eea4cfc801d87R107 -// and https://github.com/facebook/graphql/pull/384 -type Response struct { - Errors gqlerror.List `json:"errors,omitempty"` - Data json.RawMessage `json:"data"` - Extensions map[string]interface{} `json:"extensions,omitempty"` -} - -func ErrorResponse(ctx context.Context, messagef string, args ...interface{}) *Response { - return &Response{ - Errors: gqlerror.List{{Message: fmt.Sprintf(messagef, args...)}}, - } -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/root.go b/vendor/github.com/99designs/gqlgen/graphql/root.go deleted file mode 100644 index 3405d18054..0000000000 --- a/vendor/github.com/99designs/gqlgen/graphql/root.go +++ /dev/null @@ -1,7 +0,0 @@ -package graphql - -type Query struct{} - -type Mutation struct{} - -type Subscription struct{} diff --git a/vendor/github.com/99designs/gqlgen/graphql/stats.go b/vendor/github.com/99designs/gqlgen/graphql/stats.go deleted file mode 100644 index a52e143ebe..0000000000 --- a/vendor/github.com/99designs/gqlgen/graphql/stats.go +++ /dev/null @@ -1,60 +0,0 @@ -package graphql - -import ( - "context" - "fmt" - "time" -) - -type Stats struct { - OperationStart time.Time - Read TraceTiming - Parsing TraceTiming - Validation TraceTiming - - // Stats collected by handler extensions. Dont use directly, the extension should provide a type safe way to - // access this. - extension map[string]interface{} -} - -type TraceTiming struct { - Start time.Time - End time.Time -} - -var ctxTraceStart key = "trace_start" - -// StartOperationTrace captures the current time and stores it in context. This will eventually be added to request -// context but we want to grab it as soon as possible. For transports that can only handle a single graphql query -// per http requests you dont need to call this at all, the server will do it for you. For transports that handle -// multiple (eg batching, subscriptions) this should be called before decoding each request. -func StartOperationTrace(ctx context.Context) context.Context { - return context.WithValue(ctx, ctxTraceStart, Now()) -} - -// GetStartTime should only be called by the handler package, it will be set into request context -// as Stats.Start -func GetStartTime(ctx context.Context) time.Time { - t, ok := ctx.Value(ctxTraceStart).(time.Time) - if !ok { - panic(fmt.Sprintf("missing start time: %T", ctx.Value(ctxTraceStart))) - } - return t -} - -func (c *Stats) SetExtension(name string, data interface{}) { - if c.extension == nil { - c.extension = map[string]interface{}{} - } - c.extension[name] = data -} - -func (c *Stats) GetExtension(name string) interface{} { - if c.extension == nil { - return nil - } - return c.extension[name] -} - -// Now is time.Now, except in tests. Then it can be whatever you want it to be. -var Now = time.Now diff --git a/vendor/github.com/99designs/gqlgen/graphql/string.go b/vendor/github.com/99designs/gqlgen/graphql/string.go deleted file mode 100644 index 742e50cc3b..0000000000 --- a/vendor/github.com/99designs/gqlgen/graphql/string.go +++ /dev/null @@ -1,70 +0,0 @@ -package graphql - -import ( - "fmt" - "io" - "strconv" -) - -const encodeHex = "0123456789ABCDEF" - -func MarshalString(s string) Marshaler { - return WriterFunc(func(w io.Writer) { - writeQuotedString(w, s) - }) -} - -func writeQuotedString(w io.Writer, s string) { - start := 0 - io.WriteString(w, `"`) - - for i, c := range s { - if c < 0x20 || c == '\\' || c == '"' { - io.WriteString(w, s[start:i]) - - switch c { - case '\t': - io.WriteString(w, `\t`) - case '\r': - io.WriteString(w, `\r`) - case '\n': - io.WriteString(w, `\n`) - case '\\': - io.WriteString(w, `\\`) - case '"': - io.WriteString(w, `\"`) - default: - io.WriteString(w, `\u00`) - w.Write([]byte{encodeHex[c>>4], encodeHex[c&0xf]}) - } - - start = i + 1 - } - } - - io.WriteString(w, s[start:]) - io.WriteString(w, `"`) -} - -func UnmarshalString(v interface{}) (string, error) { - switch v := v.(type) { - case string: - return v, nil - case int: - return strconv.Itoa(v), nil - case int64: - return strconv.FormatInt(v, 10), nil - case float64: - return fmt.Sprintf("%f", v), nil - case bool: - if v { - return "true", nil - } else { - return "false", nil - } - case nil: - return "null", nil - default: - return "", fmt.Errorf("%T is not a string", v) - } -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/time.go b/vendor/github.com/99designs/gqlgen/graphql/time.go deleted file mode 100644 index ef3d17da32..0000000000 --- a/vendor/github.com/99designs/gqlgen/graphql/time.go +++ /dev/null @@ -1,25 +0,0 @@ -package graphql - -import ( - "errors" - "io" - "strconv" - "time" -) - -func MarshalTime(t time.Time) Marshaler { - if t.IsZero() { - return Null - } - - return WriterFunc(func(w io.Writer) { - io.WriteString(w, strconv.Quote(t.Format(time.RFC3339Nano))) - }) -} - -func UnmarshalTime(v interface{}) (time.Time, error) { - if tmpStr, ok := v.(string); ok { - return time.Parse(time.RFC3339Nano, tmpStr) - } - return time.Time{}, errors.New("time should be RFC3339Nano formatted string") -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/uint.go b/vendor/github.com/99designs/gqlgen/graphql/uint.go deleted file mode 100644 index 9349c2f4d2..0000000000 --- a/vendor/github.com/99designs/gqlgen/graphql/uint.go +++ /dev/null @@ -1,81 +0,0 @@ -package graphql - -import ( - "encoding/json" - "fmt" - "io" - "strconv" -) - -func MarshalUint(i uint) Marshaler { - return WriterFunc(func(w io.Writer) { - _, _ = io.WriteString(w, strconv.FormatUint(uint64(i), 10)) - }) -} - -func UnmarshalUint(v interface{}) (uint, error) { - switch v := v.(type) { - case string: - u64, err := strconv.ParseUint(v, 10, 64) - return uint(u64), err - case int: - return uint(v), nil - case int64: - return uint(v), nil - case json.Number: - u64, err := strconv.ParseUint(string(v), 10, 64) - return uint(u64), err - default: - return 0, fmt.Errorf("%T is not an uint", v) - } -} - -func MarshalUint64(i uint64) Marshaler { - return WriterFunc(func(w io.Writer) { - _, _ = io.WriteString(w, strconv.FormatUint(i, 10)) - }) -} - -func UnmarshalUint64(v interface{}) (uint64, error) { - switch v := v.(type) { - case string: - return strconv.ParseUint(v, 10, 64) - case int: - return uint64(v), nil - case int64: - return uint64(v), nil - case json.Number: - return strconv.ParseUint(string(v), 10, 64) - default: - return 0, fmt.Errorf("%T is not an uint", v) - } -} - -func MarshalUint32(i uint32) Marshaler { - return WriterFunc(func(w io.Writer) { - _, _ = io.WriteString(w, strconv.FormatUint(uint64(i), 10)) - }) -} - -func UnmarshalUint32(v interface{}) (uint32, error) { - switch v := v.(type) { - case string: - iv, err := strconv.ParseInt(v, 10, 32) - if err != nil { - return 0, err - } - return uint32(iv), nil - case int: - return uint32(v), nil - case int64: - return uint32(v), nil - case json.Number: - iv, err := strconv.ParseUint(string(v), 10, 32) - if err != nil { - return 0, err - } - return uint32(iv), nil - default: - return 0, fmt.Errorf("%T is not an uint", v) - } -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/upload.go b/vendor/github.com/99designs/gqlgen/graphql/upload.go deleted file mode 100644 index dafbde6508..0000000000 --- a/vendor/github.com/99designs/gqlgen/graphql/upload.go +++ /dev/null @@ -1,27 +0,0 @@ -package graphql - -import ( - "fmt" - "io" -) - -type Upload struct { - File io.ReadSeeker - Filename string - Size int64 - ContentType string -} - -func MarshalUpload(f Upload) Marshaler { - return WriterFunc(func(w io.Writer) { - io.Copy(w, f.File) - }) -} - -func UnmarshalUpload(v interface{}) (Upload, error) { - upload, ok := v.(Upload) - if !ok { - return Upload{}, fmt.Errorf("%T is not an Upload", v) - } - return upload, nil -} diff --git a/vendor/github.com/99designs/gqlgen/graphql/version.go b/vendor/github.com/99designs/gqlgen/graphql/version.go deleted file mode 100644 index c0c06f6599..0000000000 --- a/vendor/github.com/99designs/gqlgen/graphql/version.go +++ /dev/null @@ -1,3 +0,0 @@ -package graphql - -const Version = "v0.17.20" diff --git a/vendor/github.com/99designs/gqlgen/internal/code/compare.go b/vendor/github.com/99designs/gqlgen/internal/code/compare.go deleted file mode 100644 index 1150a24e48..0000000000 --- a/vendor/github.com/99designs/gqlgen/internal/code/compare.go +++ /dev/null @@ -1,161 +0,0 @@ -package code - -import ( - "fmt" - "go/types" -) - -// CompatibleTypes isnt a strict comparison, it allows for pointer differences -func CompatibleTypes(expected types.Type, actual types.Type) error { - // Special case to deal with pointer mismatches - { - expectedPtr, expectedIsPtr := expected.(*types.Pointer) - actualPtr, actualIsPtr := actual.(*types.Pointer) - - if expectedIsPtr && actualIsPtr { - return CompatibleTypes(expectedPtr.Elem(), actualPtr.Elem()) - } - if expectedIsPtr && !actualIsPtr { - return CompatibleTypes(expectedPtr.Elem(), actual) - } - if !expectedIsPtr && actualIsPtr { - return CompatibleTypes(expected, actualPtr.Elem()) - } - } - - switch expected := expected.(type) { - case *types.Slice: - if actual, ok := actual.(*types.Slice); ok { - return CompatibleTypes(expected.Elem(), actual.Elem()) - } - - case *types.Array: - if actual, ok := actual.(*types.Array); ok { - if expected.Len() != actual.Len() { - return fmt.Errorf("array length differs") - } - - return CompatibleTypes(expected.Elem(), actual.Elem()) - } - - case *types.Basic: - if actual, ok := actual.(*types.Basic); ok { - if actual.Kind() != expected.Kind() { - return fmt.Errorf("basic kind differs, %s != %s", expected.Name(), actual.Name()) - } - - return nil - } - - case *types.Struct: - if actual, ok := actual.(*types.Struct); ok { - if expected.NumFields() != actual.NumFields() { - return fmt.Errorf("number of struct fields differ") - } - - for i := 0; i < expected.NumFields(); i++ { - if expected.Field(i).Name() != actual.Field(i).Name() { - return fmt.Errorf("struct field %d name differs, %s != %s", i, expected.Field(i).Name(), actual.Field(i).Name()) - } - if err := CompatibleTypes(expected.Field(i).Type(), actual.Field(i).Type()); err != nil { - return err - } - } - return nil - } - - case *types.Tuple: - if actual, ok := actual.(*types.Tuple); ok { - if expected.Len() != actual.Len() { - return fmt.Errorf("tuple length differs, %d != %d", expected.Len(), actual.Len()) - } - - for i := 0; i < expected.Len(); i++ { - if err := CompatibleTypes(expected.At(i).Type(), actual.At(i).Type()); err != nil { - return err - } - } - - return nil - } - - case *types.Signature: - if actual, ok := actual.(*types.Signature); ok { - if err := CompatibleTypes(expected.Params(), actual.Params()); err != nil { - return err - } - if err := CompatibleTypes(expected.Results(), actual.Results()); err != nil { - return err - } - - return nil - } - case *types.Interface: - if actual, ok := actual.(*types.Interface); ok { - if expected.NumMethods() != actual.NumMethods() { - return fmt.Errorf("interface method count differs, %d != %d", expected.NumMethods(), actual.NumMethods()) - } - - for i := 0; i < expected.NumMethods(); i++ { - if expected.Method(i).Name() != actual.Method(i).Name() { - return fmt.Errorf("interface method %d name differs, %s != %s", i, expected.Method(i).Name(), actual.Method(i).Name()) - } - if err := CompatibleTypes(expected.Method(i).Type(), actual.Method(i).Type()); err != nil { - return err - } - } - - return nil - } - - case *types.Map: - if actual, ok := actual.(*types.Map); ok { - if err := CompatibleTypes(expected.Key(), actual.Key()); err != nil { - return err - } - - if err := CompatibleTypes(expected.Elem(), actual.Elem()); err != nil { - return err - } - - return nil - } - - case *types.Chan: - if actual, ok := actual.(*types.Chan); ok { - return CompatibleTypes(expected.Elem(), actual.Elem()) - } - - case *types.Named: - if actual, ok := actual.(*types.Named); ok { - if NormalizeVendor(expected.Obj().Pkg().Path()) != NormalizeVendor(actual.Obj().Pkg().Path()) { - return fmt.Errorf( - "package name of named type differs, %s != %s", - NormalizeVendor(expected.Obj().Pkg().Path()), - NormalizeVendor(actual.Obj().Pkg().Path()), - ) - } - - if expected.Obj().Name() != actual.Obj().Name() { - return fmt.Errorf( - "named type name differs, %s != %s", - NormalizeVendor(expected.Obj().Name()), - NormalizeVendor(actual.Obj().Name()), - ) - } - - return nil - } - - // Before models are generated all missing references will be Invalid Basic references. - // lets assume these are valid too. - if actual, ok := actual.(*types.Basic); ok && actual.Kind() == types.Invalid { - return nil - } - - default: - return fmt.Errorf("missing support for %T", expected) - } - - return fmt.Errorf("type mismatch %T != %T", expected, actual) -} diff --git a/vendor/github.com/99designs/gqlgen/internal/code/imports.go b/vendor/github.com/99designs/gqlgen/internal/code/imports.go deleted file mode 100644 index 0e499a171f..0000000000 --- a/vendor/github.com/99designs/gqlgen/internal/code/imports.go +++ /dev/null @@ -1,174 +0,0 @@ -package code - -import ( - "bufio" - "fmt" - "go/build" - "go/parser" - "go/token" - "os" - "path/filepath" - "regexp" - "strings" -) - -var gopaths []string - -func init() { - gopaths = filepath.SplitList(build.Default.GOPATH) - for i, p := range gopaths { - gopaths[i] = filepath.ToSlash(filepath.Join(p, "src")) - } -} - -// NameForDir manually looks for package stanzas in files located in the given directory. This can be -// much faster than having to consult go list, because we already know exactly where to look. -func NameForDir(dir string) string { - dir, err := filepath.Abs(dir) - if err != nil { - return SanitizePackageName(filepath.Base(dir)) - } - files, err := os.ReadDir(dir) - if err != nil { - return SanitizePackageName(filepath.Base(dir)) - } - fset := token.NewFileSet() - for _, file := range files { - if !strings.HasSuffix(strings.ToLower(file.Name()), ".go") { - continue - } - - filename := filepath.Join(dir, file.Name()) - if src, err := parser.ParseFile(fset, filename, nil, parser.PackageClauseOnly); err == nil { - return src.Name.Name - } - } - - return SanitizePackageName(filepath.Base(dir)) -} - -type goModuleSearchResult struct { - path string - goModPath string - moduleName string -} - -var goModuleRootCache = map[string]goModuleSearchResult{} - -// goModuleRoot returns the root of the current go module if there is a go.mod file in the directory tree -// If not, it returns false -func goModuleRoot(dir string) (string, bool) { - dir, err := filepath.Abs(dir) - if err != nil { - panic(err) - } - dir = filepath.ToSlash(dir) - - dirs := []string{dir} - result := goModuleSearchResult{} - - for { - modDir := dirs[len(dirs)-1] - - if val, ok := goModuleRootCache[dir]; ok { - result = val - break - } - - if content, err := os.ReadFile(filepath.Join(modDir, "go.mod")); err == nil { - moduleName := extractModuleName(content) - result = goModuleSearchResult{ - path: moduleName, - goModPath: modDir, - moduleName: moduleName, - } - goModuleRootCache[modDir] = result - break - } - - if modDir == "" || modDir == "." || modDir == "/" || strings.HasSuffix(modDir, "\\") { - // Reached the top of the file tree which means go.mod file is not found - // Set root folder with a sentinel cache value - goModuleRootCache[modDir] = result - break - } - - dirs = append(dirs, filepath.Dir(modDir)) - } - - // create a cache for each path in a tree traversed, except the top one as it is already cached - for _, d := range dirs[:len(dirs)-1] { - if result.moduleName == "" { - // go.mod is not found in the tree, so the same sentinel value fits all the directories in a tree - goModuleRootCache[d] = result - } else { - if relPath, err := filepath.Rel(result.goModPath, d); err != nil { - panic(err) - } else { - path := result.moduleName - relPath := filepath.ToSlash(relPath) - if !strings.HasSuffix(relPath, "/") { - path += "/" - } - path += relPath - - goModuleRootCache[d] = goModuleSearchResult{ - path: path, - goModPath: result.goModPath, - moduleName: result.moduleName, - } - } - } - } - - res := goModuleRootCache[dir] - if res.moduleName == "" { - return "", false - } - return res.path, true -} - -func extractModuleName(content []byte) string { - for { - advance, tkn, err := bufio.ScanLines(content, false) - if err != nil { - panic(fmt.Errorf("error parsing mod file: %w", err)) - } - if advance == 0 { - break - } - s := strings.Trim(string(tkn), " \t") - if len(s) != 0 && !strings.HasPrefix(s, "//") { - break - } - if advance <= len(content) { - content = content[advance:] - } - } - moduleName := string(modregex.FindSubmatch(content)[1]) - return moduleName -} - -// ImportPathForDir takes a path and returns a golang import path for the package -func ImportPathForDir(dir string) (res string) { - dir, err := filepath.Abs(dir) - if err != nil { - panic(err) - } - dir = filepath.ToSlash(dir) - - modDir, ok := goModuleRoot(dir) - if ok { - return modDir - } - - for _, gopath := range gopaths { - if len(gopath) < len(dir) && strings.EqualFold(gopath, dir[0:len(gopath)]) { - return dir[len(gopath)+1:] - } - } - - return "" -} - -var modregex = regexp.MustCompile(`module ([^\s]*)`) diff --git a/vendor/github.com/99designs/gqlgen/internal/code/packages.go b/vendor/github.com/99designs/gqlgen/internal/code/packages.go deleted file mode 100644 index c800d3d84f..0000000000 --- a/vendor/github.com/99designs/gqlgen/internal/code/packages.go +++ /dev/null @@ -1,223 +0,0 @@ -package code - -import ( - "bytes" - "errors" - "fmt" - "os" - "os/exec" - "path/filepath" - - "golang.org/x/tools/go/packages" -) - -var mode = packages.NeedName | - packages.NeedFiles | - packages.NeedImports | - packages.NeedTypes | - packages.NeedSyntax | - packages.NeedTypesInfo | - packages.NeedModule | - packages.NeedDeps - -// Packages is a wrapper around x/tools/go/packages that maintains a (hopefully prewarmed) cache of packages -// that can be invalidated as writes are made and packages are known to change. -type Packages struct { - packages map[string]*packages.Package - importToName map[string]string - loadErrors []error - - numLoadCalls int // stupid test steam. ignore. - numNameCalls int // stupid test steam. ignore. -} - -// ReloadAll will call LoadAll after clearing the package cache, so we can reload -// packages in the case that the packages have changed -func (p *Packages) ReloadAll(importPaths ...string) []*packages.Package { - p.packages = nil - return p.LoadAll(importPaths...) -} - -func (p *Packages) checkModuleLoaded(pkgs []*packages.Package) bool { - for i := range pkgs { - if pkgs[i] == nil || pkgs[i].Module == nil { - return false - } - } - return true -} - -// LoadAll will call packages.Load and return the package data for the given packages, -// but if the package already have been loaded it will return cached values instead. -func (p *Packages) LoadAll(importPaths ...string) []*packages.Package { - if p.packages == nil { - p.packages = map[string]*packages.Package{} - } - - missing := make([]string, 0, len(importPaths)) - for _, path := range importPaths { - if _, ok := p.packages[path]; ok { - continue - } - missing = append(missing, path) - } - - if len(missing) > 0 { - p.numLoadCalls++ - pkgs, err := packages.Load(&packages.Config{Mode: mode}, missing...) - - // Sometimes packages.Load not loaded the module info. Call it again to reload it. - if !p.checkModuleLoaded(pkgs) { - fmt.Println("reloading module info") - pkgs, err = packages.Load(&packages.Config{Mode: mode}, missing...) - } - - if err != nil { - p.loadErrors = append(p.loadErrors, err) - } - - for _, pkg := range pkgs { - p.addToCache(pkg) - } - } - - res := make([]*packages.Package, 0, len(importPaths)) - for _, path := range importPaths { - res = append(res, p.packages[NormalizeVendor(path)]) - } - return res -} - -func (p *Packages) addToCache(pkg *packages.Package) { - imp := NormalizeVendor(pkg.PkgPath) - p.packages[imp] = pkg - for _, imp := range pkg.Imports { - if _, found := p.packages[NormalizeVendor(imp.PkgPath)]; !found { - p.addToCache(imp) - } - } -} - -// Load works the same as LoadAll, except a single package at a time. -func (p *Packages) Load(importPath string) *packages.Package { - // Quick cache check first to avoid expensive allocations of LoadAll() - if p.packages != nil { - if pkg, ok := p.packages[importPath]; ok { - return pkg - } - } - - pkgs := p.LoadAll(importPath) - if len(pkgs) == 0 { - return nil - } - return pkgs[0] -} - -// LoadWithTypes tries a standard load, which may not have enough type info (TypesInfo== nil) available if the imported package is a -// second order dependency. Fortunately this doesnt happen very often, so we can just issue a load when we detect it. -func (p *Packages) LoadWithTypes(importPath string) *packages.Package { - pkg := p.Load(importPath) - if pkg == nil || pkg.TypesInfo == nil { - p.numLoadCalls++ - pkgs, err := packages.Load(&packages.Config{Mode: mode}, importPath) - if err != nil { - p.loadErrors = append(p.loadErrors, err) - return nil - } - p.addToCache(pkgs[0]) - pkg = pkgs[0] - } - return pkg -} - -// NameForPackage looks up the package name from the package stanza in the go files at the given import path. -func (p *Packages) NameForPackage(importPath string) string { - if importPath == "" { - panic(errors.New("import path can not be empty")) - } - if p.importToName == nil { - p.importToName = map[string]string{} - } - - importPath = NormalizeVendor(importPath) - - // if its in the name cache use it - if name := p.importToName[importPath]; name != "" { - return name - } - - // otherwise we might have already loaded the full package data for it cached - pkg := p.packages[importPath] - - if pkg == nil { - // otherwise do a name only lookup for it but dont put it in the package cache. - p.numNameCalls++ - pkgs, err := packages.Load(&packages.Config{Mode: packages.NeedName}, importPath) - if err != nil { - p.loadErrors = append(p.loadErrors, err) - } else { - pkg = pkgs[0] - } - } - - if pkg == nil || pkg.Name == "" { - return SanitizePackageName(filepath.Base(importPath)) - } - - p.importToName[importPath] = pkg.Name - - return pkg.Name -} - -// Evict removes a given package import path from the cache, along with any packages that depend on it. Further calls -// to Load will fetch it from disk. -func (p *Packages) Evict(importPath string) { - delete(p.packages, importPath) - - for _, pkg := range p.packages { - for _, imported := range pkg.Imports { - if imported.PkgPath == importPath { - p.Evict(pkg.PkgPath) - } - } - } -} - -func (p *Packages) ModTidy() error { - p.packages = nil - tidyCmd := exec.Command("go", "mod", "tidy") - tidyCmd.Stdout = os.Stdout - tidyCmd.Stderr = os.Stdout - if err := tidyCmd.Run(); err != nil { - return fmt.Errorf("go mod tidy failed: %w", err) - } - return nil -} - -// Errors returns any errors that were returned by Load, either from the call itself or any of the loaded packages. -func (p *Packages) Errors() PkgErrors { - var res []error //nolint:prealloc - res = append(res, p.loadErrors...) - for _, pkg := range p.packages { - for _, err := range pkg.Errors { - res = append(res, err) - } - } - return res -} - -func (p *Packages) Count() int { - return len(p.packages) -} - -type PkgErrors []error - -func (p PkgErrors) Error() string { - var b bytes.Buffer - b.WriteString("packages.Load: ") - for _, e := range p { - b.WriteString(e.Error() + "\n") - } - return b.String() -} diff --git a/vendor/github.com/99designs/gqlgen/internal/code/util.go b/vendor/github.com/99designs/gqlgen/internal/code/util.go deleted file mode 100644 index cbe40858e2..0000000000 --- a/vendor/github.com/99designs/gqlgen/internal/code/util.go +++ /dev/null @@ -1,61 +0,0 @@ -package code - -import ( - "go/build" - "os" - "path/filepath" - "regexp" - "strings" -) - -// take a string in the form github.com/package/blah.Type and split it into package and type -func PkgAndType(name string) (string, string) { - parts := strings.Split(name, ".") - if len(parts) == 1 { - return "", name - } - - return strings.Join(parts[:len(parts)-1], "."), parts[len(parts)-1] -} - -var modsRegex = regexp.MustCompile(`^(\*|\[\])*`) - -// NormalizeVendor takes a qualified package path and turns it into normal one. -// eg . -// github.com/foo/vendor/github.com/99designs/gqlgen/graphql becomes -// github.com/99designs/gqlgen/graphql -func NormalizeVendor(pkg string) string { - modifiers := modsRegex.FindAllString(pkg, 1)[0] - pkg = strings.TrimPrefix(pkg, modifiers) - parts := strings.Split(pkg, "/vendor/") - return modifiers + parts[len(parts)-1] -} - -// QualifyPackagePath takes an import and fully qualifies it with a vendor dir, if one is required. -// eg . -// github.com/99designs/gqlgen/graphql becomes -// github.com/foo/vendor/github.com/99designs/gqlgen/graphql -// -// x/tools/packages only supports 'qualified package paths' so this will need to be done prior to calling it -// See https://github.com/golang/go/issues/30289 -func QualifyPackagePath(importPath string) string { - wd, _ := os.Getwd() - - // in go module mode, the import path doesn't need fixing - if _, ok := goModuleRoot(wd); ok { - return importPath - } - - pkg, err := build.Import(importPath, wd, 0) - if err != nil { - return importPath - } - - return pkg.ImportPath -} - -var invalidPackageNameChar = regexp.MustCompile(`[^\w]`) - -func SanitizePackageName(pkg string) string { - return invalidPackageNameChar.ReplaceAllLiteralString(filepath.Base(pkg), "_") -} diff --git a/vendor/github.com/99designs/gqlgen/internal/imports/prune.go b/vendor/github.com/99designs/gqlgen/internal/imports/prune.go deleted file mode 100644 index d42a415791..0000000000 --- a/vendor/github.com/99designs/gqlgen/internal/imports/prune.go +++ /dev/null @@ -1,100 +0,0 @@ -// Wrapper around x/tools/imports that only removes imports, never adds new ones. - -package imports - -import ( - "bytes" - "go/ast" - "go/parser" - "go/printer" - "go/token" - "strings" - - "github.com/99designs/gqlgen/internal/code" - - "golang.org/x/tools/go/ast/astutil" - "golang.org/x/tools/imports" -) - -type visitFn func(node ast.Node) - -func (fn visitFn) Visit(node ast.Node) ast.Visitor { - fn(node) - return fn -} - -// Prune removes any unused imports -func Prune(filename string, src []byte, packages *code.Packages) ([]byte, error) { - fset := token.NewFileSet() - - file, err := parser.ParseFile(fset, filename, src, parser.ParseComments|parser.AllErrors) - if err != nil { - return nil, err - } - - unused := getUnusedImports(file, packages) - for ipath, name := range unused { - astutil.DeleteNamedImport(fset, file, name, ipath) - } - printConfig := &printer.Config{Mode: printer.TabIndent, Tabwidth: 8} - - var buf bytes.Buffer - if err := printConfig.Fprint(&buf, fset, file); err != nil { - return nil, err - } - - return imports.Process(filename, buf.Bytes(), &imports.Options{FormatOnly: true, Comments: true, TabIndent: true, TabWidth: 8}) -} - -func getUnusedImports(file ast.Node, packages *code.Packages) map[string]string { - imported := map[string]*ast.ImportSpec{} - used := map[string]bool{} - - ast.Walk(visitFn(func(node ast.Node) { - if node == nil { - return - } - switch v := node.(type) { - case *ast.ImportSpec: - if v.Name != nil { - imported[v.Name.Name] = v - break - } - ipath := strings.Trim(v.Path.Value, `"`) - if ipath == "C" { - break - } - - local := packages.NameForPackage(ipath) - - imported[local] = v - case *ast.SelectorExpr: - xident, ok := v.X.(*ast.Ident) - if !ok { - break - } - if xident.Obj != nil { - // if the parser can resolve it, it's not a package ref - break - } - used[xident.Name] = true - } - }), file) - - for pkg := range used { - delete(imported, pkg) - } - - unusedImport := map[string]string{} - for pkg, is := range imported { - if !used[pkg] && pkg != "_" && pkg != "." { - name := "" - if is.Name != nil { - name = is.Name.Name - } - unusedImport[strings.Trim(is.Path.Value, `"`)] = name - } - } - - return unusedImport -} diff --git a/vendor/github.com/99designs/gqlgen/internal/rewrite/rewriter.go b/vendor/github.com/99designs/gqlgen/internal/rewrite/rewriter.go deleted file mode 100644 index a8a6485cff..0000000000 --- a/vendor/github.com/99designs/gqlgen/internal/rewrite/rewriter.go +++ /dev/null @@ -1,226 +0,0 @@ -package rewrite - -import ( - "bytes" - "fmt" - "go/ast" - "go/token" - "os" - "path/filepath" - "strconv" - "strings" - - "github.com/99designs/gqlgen/internal/code" - "golang.org/x/tools/go/packages" -) - -type Rewriter struct { - pkg *packages.Package - files map[string]string - copied map[ast.Decl]bool -} - -func New(dir string) (*Rewriter, error) { - importPath := code.ImportPathForDir(dir) - if importPath == "" { - return nil, fmt.Errorf("import path not found for directory: %q", dir) - } - pkgs, err := packages.Load(&packages.Config{ - Mode: packages.NeedSyntax | packages.NeedTypes, - }, importPath) - if err != nil { - return nil, err - } - if len(pkgs) == 0 { - return nil, fmt.Errorf("package not found for importPath: %s", importPath) - } - - return &Rewriter{ - pkg: pkgs[0], - files: map[string]string{}, - copied: map[ast.Decl]bool{}, - }, nil -} - -func (r *Rewriter) getSource(start, end token.Pos) string { - startPos := r.pkg.Fset.Position(start) - endPos := r.pkg.Fset.Position(end) - - if startPos.Filename != endPos.Filename { - panic("cant get source spanning multiple files") - } - - file := r.getFile(startPos.Filename) - return file[startPos.Offset:endPos.Offset] -} - -func (r *Rewriter) getFile(filename string) string { - if _, ok := r.files[filename]; !ok { - b, err := os.ReadFile(filename) - if err != nil { - panic(fmt.Errorf("unable to load file, already exists: %w", err)) - } - - r.files[filename] = string(b) - - } - - return r.files[filename] -} - -func (r *Rewriter) GetMethodComment(structname string, methodname string) string { - for _, f := range r.pkg.Syntax { - for _, d := range f.Decls { - d, isFunc := d.(*ast.FuncDecl) - if !isFunc { - continue - } - if d.Name.Name != methodname { - continue - } - if d.Recv == nil || len(d.Recv.List) == 0 { - continue - } - recv := d.Recv.List[0].Type - if star, isStar := recv.(*ast.StarExpr); isStar { - recv = star.X - } - ident, ok := recv.(*ast.Ident) - if !ok { - continue - } - - if ident.Name != structname { - continue - } - return d.Doc.Text() - } - } - - return "" -} -func (r *Rewriter) GetMethodBody(structname string, methodname string) string { - for _, f := range r.pkg.Syntax { - for _, d := range f.Decls { - d, isFunc := d.(*ast.FuncDecl) - if !isFunc { - continue - } - if d.Name.Name != methodname { - continue - } - if d.Recv == nil || len(d.Recv.List) == 0 { - continue - } - recv := d.Recv.List[0].Type - if star, isStar := recv.(*ast.StarExpr); isStar { - recv = star.X - } - ident, ok := recv.(*ast.Ident) - if !ok { - continue - } - - if ident.Name != structname { - continue - } - - r.copied[d] = true - - return r.getSource(d.Body.Pos()+1, d.Body.End()-1) - } - } - - return "" -} - -func (r *Rewriter) MarkStructCopied(name string) { - for _, f := range r.pkg.Syntax { - for _, d := range f.Decls { - d, isGen := d.(*ast.GenDecl) - if !isGen { - continue - } - if d.Tok != token.TYPE || len(d.Specs) == 0 { - continue - } - - spec, isTypeSpec := d.Specs[0].(*ast.TypeSpec) - if !isTypeSpec { - continue - } - - if spec.Name.Name != name { - continue - } - - r.copied[d] = true - } - } -} - -func (r *Rewriter) ExistingImports(filename string) []Import { - filename, err := filepath.Abs(filename) - if err != nil { - panic(err) - } - for _, f := range r.pkg.Syntax { - pos := r.pkg.Fset.Position(f.Pos()) - - if filename != pos.Filename { - continue - } - - var imps []Import - for _, i := range f.Imports { - name := "" - if i.Name != nil { - name = i.Name.Name - } - path, err := strconv.Unquote(i.Path.Value) - if err != nil { - panic(err) - } - imps = append(imps, Import{name, path}) - } - return imps - } - return nil -} - -func (r *Rewriter) RemainingSource(filename string) string { - filename, err := filepath.Abs(filename) - if err != nil { - panic(err) - } - for _, f := range r.pkg.Syntax { - pos := r.pkg.Fset.Position(f.Pos()) - - if filename != pos.Filename { - continue - } - - var buf bytes.Buffer - - for _, d := range f.Decls { - if r.copied[d] { - continue - } - - if d, isGen := d.(*ast.GenDecl); isGen && d.Tok == token.IMPORT { - continue - } - - buf.WriteString(r.getSource(d.Pos(), d.End())) - buf.WriteString("\n") - } - - return strings.TrimSpace(buf.String()) - } - return "" -} - -type Import struct { - Alias string - ImportPath string -} diff --git a/vendor/github.com/99designs/gqlgen/plugin/federation/federation.go b/vendor/github.com/99designs/gqlgen/plugin/federation/federation.go deleted file mode 100644 index cd60acee25..0000000000 --- a/vendor/github.com/99designs/gqlgen/plugin/federation/federation.go +++ /dev/null @@ -1,424 +0,0 @@ -package federation - -import ( - _ "embed" - "fmt" - "sort" - "strings" - - "github.com/vektah/gqlparser/v2/ast" - - "github.com/99designs/gqlgen/codegen" - "github.com/99designs/gqlgen/codegen/config" - "github.com/99designs/gqlgen/codegen/templates" - "github.com/99designs/gqlgen/plugin" - "github.com/99designs/gqlgen/plugin/federation/fieldset" -) - -//go:embed federation.gotpl -var federationTemplate string - -type federation struct { - Entities []*Entity - Version int -} - -// New returns a federation plugin that injects -// federated directives and types into the schema -func New(version int) plugin.Plugin { - if version == 0 { - version = 1 - } - - return &federation{Version: version} -} - -// Name returns the plugin name -func (f *federation) Name() string { - return "federation" -} - -// MutateConfig mutates the configuration -func (f *federation) MutateConfig(cfg *config.Config) error { - builtins := config.TypeMap{ - "_Service": { - Model: config.StringList{ - "github.com/99designs/gqlgen/plugin/federation/fedruntime.Service", - }, - }, - "_Entity": { - Model: config.StringList{ - "github.com/99designs/gqlgen/plugin/federation/fedruntime.Entity", - }, - }, - "Entity": { - Model: config.StringList{ - "github.com/99designs/gqlgen/plugin/federation/fedruntime.Entity", - }, - }, - "_Any": { - Model: config.StringList{"github.com/99designs/gqlgen/graphql.Map"}, - }, - } - - for typeName, entry := range builtins { - if cfg.Models.Exists(typeName) { - return fmt.Errorf("%v already exists which must be reserved when Federation is enabled", typeName) - } - cfg.Models[typeName] = entry - } - cfg.Directives["external"] = config.DirectiveConfig{SkipRuntime: true} - cfg.Directives["requires"] = config.DirectiveConfig{SkipRuntime: true} - cfg.Directives["provides"] = config.DirectiveConfig{SkipRuntime: true} - cfg.Directives["key"] = config.DirectiveConfig{SkipRuntime: true} - cfg.Directives["extends"] = config.DirectiveConfig{SkipRuntime: true} - - // Federation 2 specific directives - if f.Version == 2 { - cfg.Directives["shareable"] = config.DirectiveConfig{SkipRuntime: true} - cfg.Directives["link"] = config.DirectiveConfig{SkipRuntime: true} - cfg.Directives["tag"] = config.DirectiveConfig{SkipRuntime: true} - cfg.Directives["override"] = config.DirectiveConfig{SkipRuntime: true} - cfg.Directives["inaccessible"] = config.DirectiveConfig{SkipRuntime: true} - } - - return nil -} - -func (f *federation) InjectSourceEarly() *ast.Source { - input := ` - scalar _Any - scalar _FieldSet - - directive @external on FIELD_DEFINITION - directive @requires(fields: _FieldSet!) on FIELD_DEFINITION - directive @provides(fields: _FieldSet!) on FIELD_DEFINITION - directive @extends on OBJECT | INTERFACE -` - // add version-specific changes on key directive, as well as adding the new directives for federation 2 - if f.Version == 1 { - input += ` - directive @key(fields: _FieldSet!) repeatable on OBJECT | INTERFACE -` - } else if f.Version == 2 { - input += ` - directive @key(fields: _FieldSet!, resolvable: Boolean = true) repeatable on OBJECT | INTERFACE - directive @link(import: [String!], url: String!) repeatable on SCHEMA - directive @shareable on OBJECT | FIELD_DEFINITION - directive @tag(name: String!) repeatable on FIELD_DEFINITION | INTERFACE | OBJECT | UNION | ARGUMENT_DEFINITION | SCALAR | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION - directive @override(from: String!) on FIELD_DEFINITION - directive @inaccessible on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION -` - } - return &ast.Source{ - Name: "federation/directives.graphql", - Input: input, - BuiltIn: true, - } -} - -// InjectSources creates a GraphQL Entity type with all -// the fields that had the @key directive -func (f *federation) InjectSourceLate(schema *ast.Schema) *ast.Source { - f.setEntities(schema) - - var entities, resolvers, entityResolverInputDefinitions string - for i, e := range f.Entities { - if i != 0 { - entities += " | " - } - entities += e.Name - - for _, r := range e.Resolvers { - if e.Multi { - if entityResolverInputDefinitions != "" { - entityResolverInputDefinitions += "\n\n" - } - entityResolverInputDefinitions += "input " + r.InputType + " {\n" - for _, keyField := range r.KeyFields { - entityResolverInputDefinitions += fmt.Sprintf("\t%s: %s\n", keyField.Field.ToGo(), keyField.Definition.Type.String()) - } - entityResolverInputDefinitions += "}" - resolvers += fmt.Sprintf("\t%s(reps: [%s!]!): [%s]\n", r.ResolverName, r.InputType, e.Name) - } else { - resolverArgs := "" - for _, keyField := range r.KeyFields { - resolverArgs += fmt.Sprintf("%s: %s,", keyField.Field.ToGoPrivate(), keyField.Definition.Type.String()) - } - resolvers += fmt.Sprintf("\t%s(%s): %s!\n", r.ResolverName, resolverArgs, e.Name) - } - } - } - - var blocks []string - if entities != "" { - entities = `# a union of all types that use the @key directive -union _Entity = ` + entities - blocks = append(blocks, entities) - } - - // resolvers can be empty if a service defines only "empty - // extend" types. This should be rare. - if resolvers != "" { - if entityResolverInputDefinitions != "" { - blocks = append(blocks, entityResolverInputDefinitions) - } - resolvers = `# fake type to build resolver interfaces for users to implement -type Entity { - ` + resolvers + ` -}` - blocks = append(blocks, resolvers) - } - - _serviceTypeDef := `type _Service { - sdl: String -}` - blocks = append(blocks, _serviceTypeDef) - - var additionalQueryFields string - // Quote from the Apollo Federation subgraph specification: - // If no types are annotated with the key directive, then the - // _Entity union and _entities field should be removed from the schema - if len(f.Entities) > 0 { - additionalQueryFields += ` _entities(representations: [_Any!]!): [_Entity]! -` - } - // _service field is required in any case - additionalQueryFields += ` _service: _Service!` - - extendTypeQueryDef := `extend type ` + schema.Query.Name + ` { -` + additionalQueryFields + ` -}` - blocks = append(blocks, extendTypeQueryDef) - - return &ast.Source{ - Name: "federation/entity.graphql", - BuiltIn: true, - Input: "\n" + strings.Join(blocks, "\n\n") + "\n", - } -} - -// Entity represents a federated type -// that was declared in the GQL schema. -type Entity struct { - Name string // The same name as the type declaration - Def *ast.Definition - Resolvers []*EntityResolver - Requires []*Requires - Multi bool -} - -type EntityResolver struct { - ResolverName string // The resolver name, such as FindUserByID - KeyFields []*KeyField // The fields declared in @key. - InputType string // The Go generated input type for multi entity resolvers -} - -type KeyField struct { - Definition *ast.FieldDefinition - Field fieldset.Field // len > 1 for nested fields - Type *config.TypeReference // The Go representation of that field type -} - -// Requires represents an @requires clause -type Requires struct { - Name string // the name of the field - Field fieldset.Field // source Field, len > 1 for nested fields - Type *config.TypeReference // The Go representation of that field type -} - -func (e *Entity) allFieldsAreExternal() bool { - for _, field := range e.Def.Fields { - if field.Directives.ForName("external") == nil { - return false - } - } - return true -} - -func (f *federation) GenerateCode(data *codegen.Data) error { - if len(f.Entities) > 0 { - if data.Objects.ByName("Entity") != nil { - data.Objects.ByName("Entity").Root = true - } - for _, e := range f.Entities { - obj := data.Objects.ByName(e.Def.Name) - - for _, r := range e.Resolvers { - // fill in types for key fields - // - for _, keyField := range r.KeyFields { - if len(keyField.Field) == 0 { - fmt.Println( - "skipping @key field " + keyField.Definition.Name + " in " + r.ResolverName + " in " + e.Def.Name, - ) - continue - } - cgField := keyField.Field.TypeReference(obj, data.Objects) - keyField.Type = cgField.TypeReference - } - } - - // fill in types for requires fields - // - for _, reqField := range e.Requires { - if len(reqField.Field) == 0 { - fmt.Println("skipping @requires field " + reqField.Name + " in " + e.Def.Name) - continue - } - cgField := reqField.Field.TypeReference(obj, data.Objects) - reqField.Type = cgField.TypeReference - } - } - } - - return templates.Render(templates.Options{ - PackageName: data.Config.Federation.Package, - Filename: data.Config.Federation.Filename, - Data: f, - GeneratedHeader: true, - Packages: data.Config.Packages, - Template: federationTemplate, - }) -} - -func (f *federation) setEntities(schema *ast.Schema) { - for _, schemaType := range schema.Types { - keys, ok := isFederatedEntity(schemaType) - if !ok { - continue - } - e := &Entity{ - Name: schemaType.Name, - Def: schemaType, - Resolvers: nil, - Requires: nil, - } - - // Let's process custom entity resolver settings. - dir := schemaType.Directives.ForName("entityResolver") - if dir != nil { - if dirArg := dir.Arguments.ForName("multi"); dirArg != nil { - if dirVal, err := dirArg.Value.Value(nil); err == nil { - e.Multi = dirVal.(bool) - } - } - } - - // If our schema has a field with a type defined in - // another service, then we need to define an "empty - // extend" of that type in this service, so this service - // knows what the type is like. But the graphql-server - // will never ask us to actually resolve this "empty - // extend", so we don't require a resolver function for - // it. (Well, it will never ask in practice; it's - // unclear whether the spec guarantees this. See - // https://github.com/apollographql/apollo-server/issues/3852 - // ). Example: - // type MyType { - // myvar: TypeDefinedInOtherService - // } - // // Federation needs this type, but - // // it doesn't need a resolver for it! - // extend TypeDefinedInOtherService @key(fields: "id") { - // id: ID @external - // } - if !e.allFieldsAreExternal() { - for _, dir := range keys { - if len(dir.Arguments) > 2 { - panic("More than two arguments provided for @key declaration.") - } - var arg *ast.Argument - - // since keys are able to now have multiple arguments, we need to check both possible for a possible @key(fields="" fields="") - for _, a := range dir.Arguments { - if a.Name == "fields" { - if arg != nil { - panic("More than one `fields` provided for @key declaration.") - } - arg = a - } - } - - keyFieldSet := fieldset.New(arg.Value.Raw, nil) - - keyFields := make([]*KeyField, len(keyFieldSet)) - resolverFields := []string{} - for i, field := range keyFieldSet { - def := field.FieldDefinition(schemaType, schema) - - if def == nil { - panic(fmt.Sprintf("no field for %v", field)) - } - - keyFields[i] = &KeyField{Definition: def, Field: field} - resolverFields = append(resolverFields, keyFields[i].Field.ToGo()) - } - - resolverFieldsToGo := schemaType.Name + "By" + strings.Join(resolverFields, "And") - var resolverName string - if e.Multi { - resolverFieldsToGo += "s" // Pluralize for better API readability - resolverName = fmt.Sprintf("findMany%s", resolverFieldsToGo) - } else { - resolverName = fmt.Sprintf("find%s", resolverFieldsToGo) - } - - e.Resolvers = append(e.Resolvers, &EntityResolver{ - ResolverName: resolverName, - KeyFields: keyFields, - InputType: resolverFieldsToGo + "Input", - }) - } - - e.Requires = []*Requires{} - for _, f := range schemaType.Fields { - dir := f.Directives.ForName("requires") - if dir == nil { - continue - } - if len(dir.Arguments) != 1 || dir.Arguments[0].Name != "fields" { - panic("Exactly one `fields` argument needed for @requires declaration.") - } - requiresFieldSet := fieldset.New(dir.Arguments[0].Value.Raw, nil) - for _, field := range requiresFieldSet { - e.Requires = append(e.Requires, &Requires{ - Name: field.ToGoPrivate(), - Field: field, - }) - } - } - } - f.Entities = append(f.Entities, e) - } - - // make sure order remains stable across multiple builds - sort.Slice(f.Entities, func(i, j int) bool { - return f.Entities[i].Name < f.Entities[j].Name - }) -} - -func isFederatedEntity(schemaType *ast.Definition) ([]*ast.Directive, bool) { - switch schemaType.Kind { - case ast.Object: - keys := schemaType.Directives.ForNames("key") - if len(keys) > 0 { - return keys, true - } - case ast.Interface: - // TODO: support @key and @extends for interfaces - if dir := schemaType.Directives.ForName("key"); dir != nil { - fmt.Printf("@key directive found on \"interface %s\". Will be ignored.\n", schemaType.Name) - } - if dir := schemaType.Directives.ForName("extends"); dir != nil { - panic( - fmt.Sprintf( - "@extends directive is not currently supported for interfaces, use \"extend interface %s\" instead.", - schemaType.Name, - )) - } - default: - // ignore - } - return nil, false -} diff --git a/vendor/github.com/99designs/gqlgen/plugin/federation/federation.gotpl b/vendor/github.com/99designs/gqlgen/plugin/federation/federation.gotpl deleted file mode 100644 index 4a30b6c978..0000000000 --- a/vendor/github.com/99designs/gqlgen/plugin/federation/federation.gotpl +++ /dev/null @@ -1,259 +0,0 @@ -{{ reserveImport "context" }} -{{ reserveImport "errors" }} -{{ reserveImport "fmt" }} -{{ reserveImport "strings" }} -{{ reserveImport "sync" }} - -{{ reserveImport "github.com/99designs/gqlgen/plugin/federation/fedruntime" }} - -var ( - ErrUnknownType = errors.New("unknown type") - ErrTypeNotFound = errors.New("type not found") -) - -func (ec *executionContext) __resolve__service(ctx context.Context) (fedruntime.Service, error) { - if ec.DisableIntrospection { - return fedruntime.Service{}, errors.New("federated introspection disabled") - } - - var sdl []string - - for _, src := range sources { - if src.BuiltIn { - continue - } - sdl = append(sdl, src.Input) - } - - return fedruntime.Service{ - SDL: strings.Join(sdl, "\n"), - }, nil -} - -{{if .Entities}} -func (ec *executionContext) __resolve_entities(ctx context.Context, representations []map[string]interface{}) []fedruntime.Entity { - list := make([]fedruntime.Entity, len(representations)) - - repsMap := map[string]struct { - i []int - r []map[string]interface{} - }{} - - // We group entities by typename so that we can parallelize their resolution. - // This is particularly helpful when there are entity groups in multi mode. - buildRepresentationGroups := func(reps []map[string]interface{}) { - for i, rep := range reps { - typeName, ok := rep["__typename"].(string) - if !ok { - // If there is no __typename, we just skip the representation; - // we just won't be resolving these unknown types. - ec.Error(ctx, errors.New("__typename must be an existing string")) - continue - } - - _r := repsMap[typeName] - _r.i = append(_r.i, i) - _r.r = append(_r.r, rep) - repsMap[typeName] = _r - } - } - - isMulti := func(typeName string) bool { - switch typeName { - {{- range .Entities -}} - {{- if .Resolvers -}} - {{- if .Multi -}} - case "{{.Def.Name}}": - return true - {{ end }} - {{- end -}} - {{- end -}} - default: - return false - } - } - - resolveEntity := func(ctx context.Context, typeName string, rep map[string]interface{}, idx []int, i int) (err error) { - // we need to do our own panic handling, because we may be called in a - // goroutine, where the usual panic handling can't catch us - defer func () { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - } - }() - - switch typeName { - {{ range $_, $entity := .Entities }} - {{- if and .Resolvers (not .Multi) -}} - case "{{.Def.Name}}": - resolverName, err := entityResolverNameFor{{.Def.Name}}(ctx, rep) - if err != nil { - return fmt.Errorf(`finding resolver for Entity "{{.Def.Name}}": %w`, err) - } - switch resolverName { - {{ range $i, $resolver := .Resolvers }} - case "{{.ResolverName}}": - {{- range $j, $keyField := .KeyFields }} - id{{$j}}, err := ec.{{.Type.UnmarshalFunc}}(ctx, rep["{{.Field.Join `"].(map[string]interface{})["`}}"]) - if err != nil { - return fmt.Errorf(`unmarshalling param {{$j}} for {{$resolver.ResolverName}}(): %w`, err) - } - {{- end}} - entity, err := ec.resolvers.Entity().{{.ResolverName | go}}(ctx, {{- range $j, $_ := .KeyFields -}} id{{$j}}, {{end}}) - if err != nil { - return fmt.Errorf(`resolving Entity "{{$entity.Def.Name}}": %w`, err) - } - {{ range $entity.Requires }} - entity.{{.Field.JoinGo `.`}}, err = ec.{{.Type.UnmarshalFunc}}(ctx, rep["{{.Field.Join `"].(map[string]interface{})["`}}"]) - if err != nil { - return err - } - {{- end }} - list[idx[i]] = entity - return nil - {{- end }} - } - {{ end }} - {{- end }} - } - return fmt.Errorf("%w: %s", ErrUnknownType, typeName) - } - - resolveManyEntities := func(ctx context.Context, typeName string, reps []map[string]interface{}, idx []int) (err error) { - // we need to do our own panic handling, because we may be called in a - // goroutine, where the usual panic handling can't catch us - defer func () { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - } - }() - - switch typeName { - {{ range $_, $entity := .Entities }} - {{ if and .Resolvers .Multi -}} - case "{{.Def.Name}}": - {{range $i, $_ := .Resolvers -}} - _reps := make([]*{{.InputType}}, len(reps)) - - for i, rep := range reps { - {{ range $i, $keyField := .KeyFields -}} - id{{$i}}, err := ec.{{.Type.UnmarshalFunc}}(ctx, rep["{{.Field.Join `"].(map[string]interface{})["`}}"]) - if err != nil { - return errors.New(fmt.Sprintf("Field %s undefined in schema.", "{{.Definition.Name}}")) - } - {{end}} - - _reps[i] = &{{.InputType}} { - {{ range $i, $keyField := .KeyFields -}} - {{$keyField.Field.ToGo}}: id{{$i}}, - {{end}} - } - } - - entities, err := ec.resolvers.Entity().{{.ResolverName | go}}(ctx, _reps) - if err != nil { - return err - } - - for i, entity := range entities { - {{- range $entity.Requires }} - entity.{{.Field.JoinGo `.`}}, err = ec.{{.Type.UnmarshalFunc}}(ctx, reps[i]["{{.Field.Join `"].(map[string]interface{})["`}}"]) - if err != nil { - return err - } - {{- end}} - list[idx[i]] = entity - } - return nil - {{ end }} - {{ end }} - {{- end }} - default: - return errors.New("unknown type: "+typeName) - } - } - - resolveEntityGroup := func(typeName string, reps []map[string]interface{}, idx []int) { - if isMulti(typeName) { - err := resolveManyEntities(ctx, typeName, reps, idx) - if err != nil { - ec.Error(ctx, err) - } - } else { - // if there are multiple entities to resolve, parallelize (similar to - // graphql.FieldSet.Dispatch) - var e sync.WaitGroup - e.Add(len(reps)) - for i, rep := range reps { - i, rep := i, rep - go func(i int, rep map[string]interface{}) { - err := resolveEntity(ctx, typeName, rep, idx, i) - if err != nil { - ec.Error(ctx, err) - } - e.Done() - }(i, rep) - } - e.Wait() - } - } - buildRepresentationGroups(representations) - - switch len(repsMap) { - case 0: - return list - case 1: - for typeName, reps := range repsMap { - resolveEntityGroup(typeName, reps.r, reps.i) - } - return list - default: - var g sync.WaitGroup - g.Add(len(repsMap)) - for typeName, reps := range repsMap { - go func(typeName string, reps []map[string]interface{}, idx []int) { - resolveEntityGroup(typeName, reps, idx) - g.Done() - }(typeName, reps.r, reps.i) - } - g.Wait() - return list - } -} - -{{- /* Make sure the required fields are in the given entity representation and return the name of the proper resolver. */ -}} - -{{ range $_, $entity := .Entities }} - {{- if .Resolvers }} - - func entityResolverNameFor{{$entity.Name}}(ctx context.Context, rep map[string]interface{}) (string, error) { - {{- range .Resolvers }} - for { - var ( - m map[string]interface{} - val interface{} - ok bool - ) - _ = val - {{- range $_, $keyField := .KeyFields }} - m = rep - {{- range $i, $field := .Field }} - if {{ if (ne $i $keyField.Field.LastIndex ) -}}val{{- else -}}_{{- end -}}, ok = m["{{.}}"]; !ok { - break - } - {{- if (ne $i $keyField.Field.LastIndex ) }} - if m, ok = val.(map[string]interface{}); !ok { - break - } - {{- end}} - {{- end}} - {{- end }} - return "{{.ResolverName}}", nil - } - {{- end }} - return "", fmt.Errorf("%w for {{$entity.Name}}", ErrTypeNotFound) - } - {{- end }} -{{- end }} - -{{end}} diff --git a/vendor/github.com/99designs/gqlgen/plugin/federation/fieldset/fieldset.go b/vendor/github.com/99designs/gqlgen/plugin/federation/fieldset/fieldset.go deleted file mode 100644 index 059a3c8325..0000000000 --- a/vendor/github.com/99designs/gqlgen/plugin/federation/fieldset/fieldset.go +++ /dev/null @@ -1,181 +0,0 @@ -package fieldset - -import ( - "fmt" - "strings" - - "github.com/99designs/gqlgen/codegen" - "github.com/99designs/gqlgen/codegen/templates" - "github.com/vektah/gqlparser/v2/ast" -) - -// Set represents a FieldSet that is used in federation directives @key and @requires. -// Would be happier to reuse FieldSet parsing from gqlparser, but this suits for now. -type Set []Field - -// Field represents a single field in a FieldSet -type Field []string - -// New parses a FieldSet string into a TinyFieldSet. -func New(raw string, prefix []string) Set { - if !strings.Contains(raw, "{") { - return parseUnnestedKeyFieldSet(raw, prefix) - } - - var ( - ret = Set{} - subPrefix = prefix - ) - before, during, after := extractSubs(raw) - - if before != "" { - befores := New(before, prefix) - if len(befores) > 0 { - subPrefix = befores[len(befores)-1] - ret = append(ret, befores[:len(befores)-1]...) - } - } - if during != "" { - ret = append(ret, New(during, subPrefix)...) - } - if after != "" { - ret = append(ret, New(after, prefix)...) - } - return ret -} - -// FieldDefinition looks up a field in the type. -func (f Field) FieldDefinition(schemaType *ast.Definition, schema *ast.Schema) *ast.FieldDefinition { - objType := schemaType - def := objType.Fields.ForName(f[0]) - - for _, part := range f[1:] { - if objType.Kind != ast.Object { - panic(fmt.Sprintf(`invalid sub-field reference "%s" in %v: `, objType.Name, f)) - } - x := def.Type.Name() - objType = schema.Types[x] - if objType == nil { - panic("invalid schema type: " + x) - } - def = objType.Fields.ForName(part) - } - if def == nil { - return nil - } - ret := *def // shallow copy - ret.Name = f.ToGoPrivate() - - return &ret -} - -// TypeReference looks up the type of a field. -func (f Field) TypeReference(obj *codegen.Object, objects codegen.Objects) *codegen.Field { - var def *codegen.Field - - for _, part := range f { - def = fieldByName(obj, part) - if def == nil { - panic("unable to find field " + f[0]) - } - obj = objects.ByName(def.TypeReference.Definition.Name) - } - return def -} - -// ToGo converts a (possibly nested) field into a proper public Go name. -func (f Field) ToGo() string { - var ret string - - for _, field := range f { - ret += templates.ToGo(field) - } - return ret -} - -// ToGoPrivate converts a (possibly nested) field into a proper private Go name. -func (f Field) ToGoPrivate() string { - var ret string - - for i, field := range f { - if i == 0 { - ret += templates.ToGoPrivate(field) - continue - } - ret += templates.ToGo(field) - } - return ret -} - -// Join concatenates the field parts with a string separator between. Useful in templates. -func (f Field) Join(str string) string { - return strings.Join(f, str) -} - -// JoinGo concatenates the Go name of field parts with a string separator between. Useful in templates. -func (f Field) JoinGo(str string) string { - strs := []string{} - - for _, s := range f { - strs = append(strs, templates.ToGo(s)) - } - return strings.Join(strs, str) -} - -func (f Field) LastIndex() int { - return len(f) - 1 -} - -// local functions - -// parseUnnestedKeyFieldSet // handles simple case where none of the fields are nested. -func parseUnnestedKeyFieldSet(raw string, prefix []string) Set { - ret := Set{} - - for _, s := range strings.Fields(raw) { - next := append(prefix[:], s) //nolint:gocritic // slicing out on purpose - ret = append(ret, next) - } - return ret -} - -// extractSubs splits out and trims sub-expressions from before, inside, and after "{}". -func extractSubs(str string) (string, string, string) { - start := strings.Index(str, "{") - end := matchingBracketIndex(str, start) - - if start < 0 || end < 0 { - panic("invalid key fieldSet: " + str) - } - return strings.TrimSpace(str[:start]), strings.TrimSpace(str[start+1 : end]), strings.TrimSpace(str[end+1:]) -} - -// matchingBracketIndex returns the index of the closing bracket, assuming an open bracket at start. -func matchingBracketIndex(str string, start int) int { - if start < 0 || len(str) <= start+1 { - return -1 - } - var depth int - - for i, c := range str[start+1:] { - switch c { - case '{': - depth++ - case '}': - if depth == 0 { - return start + 1 + i - } - depth-- - } - } - return -1 -} - -func fieldByName(obj *codegen.Object, name string) *codegen.Field { - for _, field := range obj.Fields { - if field.Name == name { - return field - } - } - return nil -} diff --git a/vendor/github.com/99designs/gqlgen/plugin/federation/readme.md b/vendor/github.com/99designs/gqlgen/plugin/federation/readme.md deleted file mode 100644 index 4333ed4797..0000000000 --- a/vendor/github.com/99designs/gqlgen/plugin/federation/readme.md +++ /dev/null @@ -1,39 +0,0 @@ -# Federation plugin - -Add support for graphql federation in your graphql Go server! - -TODO(miguel): add details. - -# Tests -There are several different tests. Some will process the configuration file directly. You can see those in the `federation_test.go`. There are also tests for entity resolvers, which will simulate requests from a federation server like Apollo Federation. - -Running entity resolver tests. -1. Go to `plugin/federation` -2. Run the command `go generate` -3. Run the tests with `go test ./...`. - -# Architecture - -TODO(miguel): add details. - -# Entity resolvers - GetMany entities - -The federation plugin implements `GetMany` semantics in which entity resolvers get the entire list of representations that need to be resolved. This functionality is currently optin tho, and to enable it you need to specify the directive `@entityResolver` in the federated entity you want this feature for. E.g. - -``` -directive @entityResolver(multi: Boolean) on OBJECT - -type MultiHello @key(fields: "name") @entityResolver(multi: true) { - name: String! -} -``` - -That allows the federation plugin to generate `GetMany` resolver function that can take a list of representations to be resolved. - -From that entity type, the resolver function would be - -``` -func (r *entityResolver) FindManyMultiHellosByName(ctx context.Context, reps []*generated.ManyMultiHellosByNameInput) ([]*generated.MultiHello, error) { - /// -} -``` diff --git a/vendor/github.com/99designs/gqlgen/plugin/modelgen/models.go b/vendor/github.com/99designs/gqlgen/plugin/modelgen/models.go deleted file mode 100644 index 45c32715c6..0000000000 --- a/vendor/github.com/99designs/gqlgen/plugin/modelgen/models.go +++ /dev/null @@ -1,470 +0,0 @@ -package modelgen - -import ( - _ "embed" - "fmt" - "go/types" - "sort" - "strings" - "text/template" - - "github.com/99designs/gqlgen/codegen/config" - "github.com/99designs/gqlgen/codegen/templates" - "github.com/99designs/gqlgen/plugin" - "github.com/vektah/gqlparser/v2/ast" -) - -//go:embed models.gotpl -var modelTemplate string - -type BuildMutateHook = func(b *ModelBuild) *ModelBuild - -type FieldMutateHook = func(td *ast.Definition, fd *ast.FieldDefinition, f *Field) (*Field, error) - -// defaultFieldMutateHook is the default hook for the Plugin which applies the GoTagFieldHook. -func defaultFieldMutateHook(td *ast.Definition, fd *ast.FieldDefinition, f *Field) (*Field, error) { - return GoTagFieldHook(td, fd, f) -} - -func defaultBuildMutateHook(b *ModelBuild) *ModelBuild { - return b -} - -type ModelBuild struct { - PackageName string - Interfaces []*Interface - Models []*Object - Enums []*Enum - Scalars []string -} - -type Interface struct { - Description string - Name string - Fields []*Field - Implements []string -} - -type Object struct { - Description string - Name string - Fields []*Field - Implements []string -} - -type Field struct { - Description string - // Name is the field's name as it appears in the schema - Name string - // GoName is the field's name as it appears in the generated Go code - GoName string - Type types.Type - Tag string -} - -type Enum struct { - Description string - Name string - Values []*EnumValue -} - -type EnumValue struct { - Description string - Name string -} - -func New() plugin.Plugin { - return &Plugin{ - MutateHook: defaultBuildMutateHook, - FieldHook: defaultFieldMutateHook, - } -} - -type Plugin struct { - MutateHook BuildMutateHook - FieldHook FieldMutateHook -} - -var _ plugin.ConfigMutator = &Plugin{} - -func (m *Plugin) Name() string { - return "modelgen" -} - -func (m *Plugin) MutateConfig(cfg *config.Config) error { - - b := &ModelBuild{ - PackageName: cfg.Model.Package, - } - - for _, schemaType := range cfg.Schema.Types { - if cfg.Models.UserDefined(schemaType.Name) { - continue - } - switch schemaType.Kind { - case ast.Interface, ast.Union: - var fields []*Field - var err error - if !cfg.OmitGetters { - fields, err = m.generateFields(cfg, schemaType) - if err != nil { - return err - } - } - - it := &Interface{ - Description: schemaType.Description, - Name: schemaType.Name, - Implements: schemaType.Interfaces, - Fields: fields, - } - - b.Interfaces = append(b.Interfaces, it) - case ast.Object, ast.InputObject: - if schemaType == cfg.Schema.Query || schemaType == cfg.Schema.Mutation || schemaType == cfg.Schema.Subscription { - continue - } - - fields, err := m.generateFields(cfg, schemaType) - if err != nil { - return err - } - - it := &Object{ - Description: schemaType.Description, - Name: schemaType.Name, - Fields: fields, - } - - // If Interface A implements interface B, and Interface C also implements interface B - // then both A and C have methods of B. - // The reason for checking unique is to prevent the same method B from being generated twice. - uniqueMap := map[string]bool{} - for _, implementor := range cfg.Schema.GetImplements(schemaType) { - if !uniqueMap[implementor.Name] { - it.Implements = append(it.Implements, implementor.Name) - uniqueMap[implementor.Name] = true - } - // for interface implements - for _, iface := range implementor.Interfaces { - if !uniqueMap[iface] { - it.Implements = append(it.Implements, iface) - uniqueMap[iface] = true - } - } - } - - b.Models = append(b.Models, it) - case ast.Enum: - it := &Enum{ - Name: schemaType.Name, - Description: schemaType.Description, - } - - for _, v := range schemaType.EnumValues { - it.Values = append(it.Values, &EnumValue{ - Name: v.Name, - Description: v.Description, - }) - } - - b.Enums = append(b.Enums, it) - case ast.Scalar: - b.Scalars = append(b.Scalars, schemaType.Name) - } - } - sort.Slice(b.Enums, func(i, j int) bool { return b.Enums[i].Name < b.Enums[j].Name }) - sort.Slice(b.Models, func(i, j int) bool { return b.Models[i].Name < b.Models[j].Name }) - sort.Slice(b.Interfaces, func(i, j int) bool { return b.Interfaces[i].Name < b.Interfaces[j].Name }) - - // if we are not just turning all struct-type fields in generated structs into pointers, we need to at least - // check for cyclical relationships and recursive structs - if !cfg.StructFieldsAlwaysPointers { - findAndHandleCyclicalRelationships(b) - } - - for _, it := range b.Enums { - cfg.Models.Add(it.Name, cfg.Model.ImportPath()+"."+templates.ToGo(it.Name)) - } - for _, it := range b.Models { - cfg.Models.Add(it.Name, cfg.Model.ImportPath()+"."+templates.ToGo(it.Name)) - } - for _, it := range b.Interfaces { - cfg.Models.Add(it.Name, cfg.Model.ImportPath()+"."+templates.ToGo(it.Name)) - } - for _, it := range b.Scalars { - cfg.Models.Add(it, "github.com/99designs/gqlgen/graphql.String") - } - - if len(b.Models) == 0 && len(b.Enums) == 0 && len(b.Interfaces) == 0 && len(b.Scalars) == 0 { - return nil - } - - if m.MutateHook != nil { - b = m.MutateHook(b) - } - - getInterfaceByName := func(name string) *Interface { - // Allow looking up interfaces, so template can generate getters for each field - for _, i := range b.Interfaces { - if i.Name == name { - return i - } - } - - return nil - } - gettersGenerated := make(map[string]map[string]struct{}) - generateGetter := func(model *Object, field *Field) string { - if model == nil || field == nil { - return "" - } - - // Let templates check if a given getter has been generated already - typeGetters, exists := gettersGenerated[model.Name] - if !exists { - typeGetters = make(map[string]struct{}) - gettersGenerated[model.Name] = typeGetters - } - - _, exists = typeGetters[field.GoName] - typeGetters[field.GoName] = struct{}{} - if exists { - return "" - } - - _, interfaceFieldTypeIsPointer := field.Type.(*types.Pointer) - var structFieldTypeIsPointer bool - for _, f := range model.Fields { - if f.GoName == field.GoName { - _, structFieldTypeIsPointer = f.Type.(*types.Pointer) - break - } - } - goType := templates.CurrentImports.LookupType(field.Type) - if strings.HasPrefix(goType, "[]") { - getter := fmt.Sprintf("func (this %s) Get%s() %s {\n", templates.ToGo(model.Name), field.GoName, goType) - getter += fmt.Sprintf("\tif this.%s == nil { return nil }\n", field.GoName) - getter += fmt.Sprintf("\tinterfaceSlice := make(%s, 0, len(this.%s))\n", goType, field.GoName) - getter += fmt.Sprintf("\tfor _, concrete := range this.%s { interfaceSlice = append(interfaceSlice, ", field.GoName) - if interfaceFieldTypeIsPointer && !structFieldTypeIsPointer { - getter += "&" - } else if !interfaceFieldTypeIsPointer && structFieldTypeIsPointer { - getter += "*" - } - getter += "concrete) }\n" - getter += "\treturn interfaceSlice\n" - getter += "}" - return getter - } else { - getter := fmt.Sprintf("func (this %s) Get%s() %s { return ", templates.ToGo(model.Name), field.GoName, goType) - - if interfaceFieldTypeIsPointer && !structFieldTypeIsPointer { - getter += "&" - } else if !interfaceFieldTypeIsPointer && structFieldTypeIsPointer { - getter += "*" - } - - getter += fmt.Sprintf("this.%s }", field.GoName) - return getter - } - } - funcMap := template.FuncMap{ - "getInterfaceByName": getInterfaceByName, - "generateGetter": generateGetter, - } - - err := templates.Render(templates.Options{ - PackageName: cfg.Model.Package, - Filename: cfg.Model.Filename, - Data: b, - GeneratedHeader: true, - Packages: cfg.Packages, - Template: modelTemplate, - Funcs: funcMap, - }) - if err != nil { - return err - } - - // We may have generated code in a package we already loaded, so we reload all packages - // to allow packages to be compared correctly - cfg.ReloadAllPackages() - - return nil -} - -func (m *Plugin) generateFields(cfg *config.Config, schemaType *ast.Definition) ([]*Field, error) { - binder := cfg.NewBinder() - fields := make([]*Field, 0) - - for _, field := range schemaType.Fields { - var typ types.Type - fieldDef := cfg.Schema.Types[field.Type.Name()] - - if cfg.Models.UserDefined(field.Type.Name()) { - var err error - typ, err = binder.FindTypeFromName(cfg.Models[field.Type.Name()].Model[0]) - if err != nil { - return nil, err - } - } else { - switch fieldDef.Kind { - case ast.Scalar: - // no user defined model, referencing a default scalar - typ = types.NewNamed( - types.NewTypeName(0, cfg.Model.Pkg(), "string", nil), - nil, - nil, - ) - - case ast.Interface, ast.Union: - // no user defined model, referencing a generated interface type - typ = types.NewNamed( - types.NewTypeName(0, cfg.Model.Pkg(), templates.ToGo(field.Type.Name()), nil), - types.NewInterfaceType([]*types.Func{}, []types.Type{}), - nil, - ) - - case ast.Enum: - // no user defined model, must reference a generated enum - typ = types.NewNamed( - types.NewTypeName(0, cfg.Model.Pkg(), templates.ToGo(field.Type.Name()), nil), - nil, - nil, - ) - - case ast.Object, ast.InputObject: - // no user defined model, must reference a generated struct - typ = types.NewNamed( - types.NewTypeName(0, cfg.Model.Pkg(), templates.ToGo(field.Type.Name()), nil), - types.NewStruct(nil, nil), - nil, - ) - - default: - panic(fmt.Errorf("unknown ast type %s", fieldDef.Kind)) - } - } - - name := templates.ToGo(field.Name) - if nameOveride := cfg.Models[schemaType.Name].Fields[field.Name].FieldName; nameOveride != "" { - name = nameOveride - } - - typ = binder.CopyModifiersFromAst(field.Type, typ) - - if cfg.StructFieldsAlwaysPointers { - if isStruct(typ) && (fieldDef.Kind == ast.Object || fieldDef.Kind == ast.InputObject) { - typ = types.NewPointer(typ) - } - } - - f := &Field{ - Name: field.Name, - GoName: name, - Type: typ, - Description: field.Description, - Tag: `json:"` + field.Name + `"`, - } - - if m.FieldHook != nil { - mf, err := m.FieldHook(schemaType, field, f) - if err != nil { - return nil, fmt.Errorf("generror: field %v.%v: %w", schemaType.Name, field.Name, err) - } - f = mf - } - - fields = append(fields, f) - } - - return fields, nil -} - -// GoTagFieldHook applies the goTag directive to the generated Field f. When applying the Tag to the field, the field -// name is used when no value argument is present. -func GoTagFieldHook(td *ast.Definition, fd *ast.FieldDefinition, f *Field) (*Field, error) { - args := make([]string, 0) - for _, goTag := range fd.Directives.ForNames("goTag") { - key := "" - value := fd.Name - - if arg := goTag.Arguments.ForName("key"); arg != nil { - if k, err := arg.Value.Value(nil); err == nil { - key = k.(string) - } - } - - if arg := goTag.Arguments.ForName("value"); arg != nil { - if v, err := arg.Value.Value(nil); err == nil { - value = v.(string) - } - } - - args = append(args, key+":\""+value+"\"") - } - - if len(args) > 0 { - f.Tag = f.Tag + " " + strings.Join(args, " ") - } - - return f, nil -} - -func isStruct(t types.Type) bool { - _, is := t.Underlying().(*types.Struct) - return is -} - -// findAndHandleCyclicalRelationships checks for cyclical relationships between generated structs and replaces them -// with pointers. These relationships will produce compilation errors if they are not pointers. -// Also handles recursive structs. -func findAndHandleCyclicalRelationships(b *ModelBuild) { - for ii, structA := range b.Models { - for _, fieldA := range structA.Fields { - if strings.Contains(fieldA.Type.String(), "NotCyclicalA") { - fmt.Print() - } - if !isStruct(fieldA.Type) { - continue - } - - // the field Type string will be in the form "github.com/99designs/gqlgen/codegen/testserver/followschema.LoopA" - // we only want the part after the last dot: "LoopA" - // this could lead to false positives, as we are only checking the name of the struct type, but these - // should be extremely rare, if it is even possible at all. - fieldAStructNameParts := strings.Split(fieldA.Type.String(), ".") - fieldAStructName := fieldAStructNameParts[len(fieldAStructNameParts)-1] - - // find this struct type amongst the generated structs - for jj, structB := range b.Models { - if structB.Name != fieldAStructName { - continue - } - - // check if structB contains a cyclical reference back to structA - var cyclicalReferenceFound bool - for _, fieldB := range structB.Fields { - if !isStruct(fieldB.Type) { - continue - } - - fieldBStructNameParts := strings.Split(fieldB.Type.String(), ".") - fieldBStructName := fieldBStructNameParts[len(fieldBStructNameParts)-1] - if fieldBStructName == structA.Name { - cyclicalReferenceFound = true - fieldB.Type = types.NewPointer(fieldB.Type) - // keep looping in case this struct has additional fields of this type - } - } - - // if this is a recursive struct (i.e. structA == structB), ensure that we only change this field to a pointer once - if cyclicalReferenceFound && ii != jj { - fieldA.Type = types.NewPointer(fieldA.Type) - break - } - } - } - } -} diff --git a/vendor/github.com/99designs/gqlgen/plugin/modelgen/models.gotpl b/vendor/github.com/99designs/gqlgen/plugin/modelgen/models.gotpl deleted file mode 100644 index 7ad43bef1b..0000000000 --- a/vendor/github.com/99designs/gqlgen/plugin/modelgen/models.gotpl +++ /dev/null @@ -1,102 +0,0 @@ -{{ reserveImport "context" }} -{{ reserveImport "fmt" }} -{{ reserveImport "io" }} -{{ reserveImport "strconv" }} -{{ reserveImport "time" }} -{{ reserveImport "sync" }} -{{ reserveImport "errors" }} -{{ reserveImport "bytes" }} - -{{ reserveImport "github.com/vektah/gqlparser/v2" }} -{{ reserveImport "github.com/vektah/gqlparser/v2/ast" }} -{{ reserveImport "github.com/99designs/gqlgen/graphql" }} -{{ reserveImport "github.com/99designs/gqlgen/graphql/introspection" }} - -{{- range $model := .Interfaces }} - {{ with .Description }} {{.|prefixLines "// "}} {{ end }} - type {{ goModelName .Name }} interface { - {{- range $impl := .Implements }} - Is{{ goModelName $impl }}() - {{- end }} - Is{{ goModelName .Name }}() - {{- range $field := .Fields }} - {{- with .Description }} - {{.|prefixLines "// "}} - {{- end}} - Get{{ $field.GoName }}() {{ $field.Type | ref }} - {{- end }} - } -{{- end }} - -{{ range $model := .Models }} - {{with .Description }} {{.|prefixLines "// "}} {{end}} - type {{ goModelName .Name }} struct { - {{- range $field := .Fields }} - {{- with .Description }} - {{.|prefixLines "// "}} - {{- end}} - {{ $field.GoName }} {{$field.Type | ref}} `{{$field.Tag}}` - {{- end }} - } - - {{ range .Implements }} - func ({{ goModelName $model.Name }}) Is{{ goModelName . }}() {} - {{- with getInterfaceByName . }} - {{- range .Fields }} - {{- with .Description }} - {{.|prefixLines "// "}} - {{- end}} - {{ generateGetter $model . }} - {{- end }} - {{- end }} - {{ end }} -{{- end}} - -{{ range $enum := .Enums }} - {{ with .Description }} {{.|prefixLines "// "}} {{end}} - type {{ goModelName .Name }} string - const ( - {{- range $value := .Values}} - {{- with .Description}} - {{.|prefixLines "// "}} - {{- end}} - {{ goModelName $enum.Name .Name }} {{ goModelName $enum.Name }} = {{ .Name|quote }} - {{- end }} - ) - - var All{{ goModelName .Name }} = []{{ goModelName .Name }}{ - {{- range $value := .Values}} - {{ goModelName $enum.Name .Name }}, - {{- end }} - } - - func (e {{ goModelName .Name }}) IsValid() bool { - switch e { - case {{ range $index, $element := .Values}}{{if $index}},{{end}}{{ goModelName $enum.Name $element.Name }}{{end}}: - return true - } - return false - } - - func (e {{ goModelName .Name }}) String() string { - return string(e) - } - - func (e *{{ goModelName .Name }}) UnmarshalGQL(v interface{}) error { - str, ok := v.(string) - if !ok { - return fmt.Errorf("enums must be strings") - } - - *e = {{ goModelName .Name }}(str) - if !e.IsValid() { - return fmt.Errorf("%s is not a valid {{ .Name }}", str) - } - return nil - } - - func (e {{ goModelName .Name }}) MarshalGQL(w io.Writer) { - fmt.Fprint(w, strconv.Quote(e.String())) - } - -{{- end }} diff --git a/vendor/github.com/99designs/gqlgen/plugin/plugin.go b/vendor/github.com/99designs/gqlgen/plugin/plugin.go deleted file mode 100644 index 7de36bd8cd..0000000000 --- a/vendor/github.com/99designs/gqlgen/plugin/plugin.go +++ /dev/null @@ -1,31 +0,0 @@ -// plugin package interfaces are EXPERIMENTAL. - -package plugin - -import ( - "github.com/99designs/gqlgen/codegen" - "github.com/99designs/gqlgen/codegen/config" - "github.com/vektah/gqlparser/v2/ast" -) - -type Plugin interface { - Name() string -} - -type ConfigMutator interface { - MutateConfig(cfg *config.Config) error -} - -type CodeGenerator interface { - GenerateCode(cfg *codegen.Data) error -} - -// EarlySourceInjector is used to inject things that are required for user schema files to compile. -type EarlySourceInjector interface { - InjectSourceEarly() *ast.Source -} - -// LateSourceInjector is used to inject more sources, after we have loaded the users schema. -type LateSourceInjector interface { - InjectSourceLate(schema *ast.Schema) *ast.Source -} diff --git a/vendor/github.com/99designs/gqlgen/plugin/resolvergen/resolver.go b/vendor/github.com/99designs/gqlgen/plugin/resolvergen/resolver.go deleted file mode 100644 index aa3be72739..0000000000 --- a/vendor/github.com/99designs/gqlgen/plugin/resolvergen/resolver.go +++ /dev/null @@ -1,227 +0,0 @@ -package resolvergen - -import ( - _ "embed" - "errors" - "fmt" - "io/fs" - "os" - "path/filepath" - "strings" - - "github.com/99designs/gqlgen/codegen" - "github.com/99designs/gqlgen/codegen/config" - "github.com/99designs/gqlgen/codegen/templates" - "github.com/99designs/gqlgen/internal/rewrite" - "github.com/99designs/gqlgen/plugin" - "golang.org/x/text/cases" - "golang.org/x/text/language" -) - -//go:embed resolver.gotpl -var resolverTemplate string - -func New() plugin.Plugin { - return &Plugin{} -} - -type Plugin struct{} - -var _ plugin.CodeGenerator = &Plugin{} - -func (m *Plugin) Name() string { - return "resolvergen" -} - -func (m *Plugin) GenerateCode(data *codegen.Data) error { - if !data.Config.Resolver.IsDefined() { - return nil - } - - switch data.Config.Resolver.Layout { - case config.LayoutSingleFile: - return m.generateSingleFile(data) - case config.LayoutFollowSchema: - return m.generatePerSchema(data) - } - - return nil -} - -func (m *Plugin) generateSingleFile(data *codegen.Data) error { - file := File{} - - if _, err := os.Stat(data.Config.Resolver.Filename); err == nil { - // file already exists and we dont support updating resolvers with layout = single so just return - return nil - } - - for _, o := range data.Objects { - if o.HasResolvers() { - file.Objects = append(file.Objects, o) - } - for _, f := range o.Fields { - if !f.IsResolver { - continue - } - - resolver := Resolver{o, f, "// foo", `panic("not implemented")`} - file.Resolvers = append(file.Resolvers, &resolver) - } - } - - resolverBuild := &ResolverBuild{ - File: &file, - PackageName: data.Config.Resolver.Package, - ResolverType: data.Config.Resolver.Type, - HasRoot: true, - } - - return templates.Render(templates.Options{ - PackageName: data.Config.Resolver.Package, - FileNotice: `// THIS CODE IS A STARTING POINT ONLY. IT WILL NOT BE UPDATED WITH SCHEMA CHANGES.`, - Filename: data.Config.Resolver.Filename, - Data: resolverBuild, - Packages: data.Config.Packages, - Template: resolverTemplate, - }) -} - -func (m *Plugin) generatePerSchema(data *codegen.Data) error { - rewriter, err := rewrite.New(data.Config.Resolver.Dir()) - if err != nil { - return err - } - - files := map[string]*File{} - - objects := make(codegen.Objects, len(data.Objects)+len(data.Inputs)) - copy(objects, data.Objects) - copy(objects[len(data.Objects):], data.Inputs) - - for _, o := range objects { - if o.HasResolvers() { - fn := gqlToResolverName(data.Config.Resolver.Dir(), o.Position.Src.Name, data.Config.Resolver.FilenameTemplate) - if files[fn] == nil { - files[fn] = &File{} - } - - caser := cases.Title(language.English, cases.NoLower) - rewriter.MarkStructCopied(templates.LcFirst(o.Name) + templates.UcFirst(data.Config.Resolver.Type)) - rewriter.GetMethodBody(data.Config.Resolver.Type, caser.String(o.Name)) - files[fn].Objects = append(files[fn].Objects, o) - } - for _, f := range o.Fields { - if !f.IsResolver { - continue - } - - structName := templates.LcFirst(o.Name) + templates.UcFirst(data.Config.Resolver.Type) - implementation := strings.TrimSpace(rewriter.GetMethodBody(structName, f.GoFieldName)) - comment := strings.TrimSpace(strings.TrimLeft(rewriter.GetMethodComment(structName, f.GoFieldName), `\`)) - if implementation == "" { - implementation = fmt.Sprintf("panic(fmt.Errorf(\"not implemented: %v - %v\"))", f.GoFieldName, f.Name) - } - if comment == "" { - comment = fmt.Sprintf("%v is the resolver for the %v field.", f.GoFieldName, f.Name) - } - - resolver := Resolver{o, f, comment, implementation} - fn := gqlToResolverName(data.Config.Resolver.Dir(), f.Position.Src.Name, data.Config.Resolver.FilenameTemplate) - if files[fn] == nil { - files[fn] = &File{} - } - - files[fn].Resolvers = append(files[fn].Resolvers, &resolver) - } - } - - for filename, file := range files { - file.imports = rewriter.ExistingImports(filename) - file.RemainingSource = rewriter.RemainingSource(filename) - } - - for filename, file := range files { - resolverBuild := &ResolverBuild{ - File: file, - PackageName: data.Config.Resolver.Package, - ResolverType: data.Config.Resolver.Type, - } - - err := templates.Render(templates.Options{ - PackageName: data.Config.Resolver.Package, - FileNotice: ` - // This file will be automatically regenerated based on the schema, any resolver implementations - // will be copied through when generating and any unknown code will be moved to the end.`, - Filename: filename, - Data: resolverBuild, - Packages: data.Config.Packages, - Template: resolverTemplate, - }) - if err != nil { - return err - } - } - - if _, err := os.Stat(data.Config.Resolver.Filename); errors.Is(err, fs.ErrNotExist) { - err := templates.Render(templates.Options{ - PackageName: data.Config.Resolver.Package, - FileNotice: ` - // This file will not be regenerated automatically. - // - // It serves as dependency injection for your app, add any dependencies you require here.`, - Template: `type {{.}} struct {}`, - Filename: data.Config.Resolver.Filename, - Data: data.Config.Resolver.Type, - Packages: data.Config.Packages, - }) - if err != nil { - return err - } - } - return nil -} - -type ResolverBuild struct { - *File - HasRoot bool - PackageName string - ResolverType string -} - -type File struct { - // These are separated because the type definition of the resolver object may live in a different file from the - // resolver method implementations, for example when extending a type in a different graphql schema file - Objects []*codegen.Object - Resolvers []*Resolver - imports []rewrite.Import - RemainingSource string -} - -func (f *File) Imports() string { - for _, imp := range f.imports { - if imp.Alias == "" { - _, _ = templates.CurrentImports.Reserve(imp.ImportPath) - } else { - _, _ = templates.CurrentImports.Reserve(imp.ImportPath, imp.Alias) - } - } - return "" -} - -type Resolver struct { - Object *codegen.Object - Field *codegen.Field - Comment string - Implementation string -} - -func gqlToResolverName(base string, gqlname, filenameTmpl string) string { - gqlname = filepath.Base(gqlname) - ext := filepath.Ext(gqlname) - if filenameTmpl == "" { - filenameTmpl = "{name}.resolvers.go" - } - filename := strings.ReplaceAll(filenameTmpl, "{name}", strings.TrimSuffix(gqlname, ext)) - return filepath.Join(base, filename) -} diff --git a/vendor/github.com/99designs/gqlgen/plugin/resolvergen/resolver.gotpl b/vendor/github.com/99designs/gqlgen/plugin/resolvergen/resolver.gotpl deleted file mode 100644 index c5d716ff7b..0000000000 --- a/vendor/github.com/99designs/gqlgen/plugin/resolvergen/resolver.gotpl +++ /dev/null @@ -1,46 +0,0 @@ -{{ reserveImport "context" }} -{{ reserveImport "fmt" }} -{{ reserveImport "io" }} -{{ reserveImport "strconv" }} -{{ reserveImport "time" }} -{{ reserveImport "sync" }} -{{ reserveImport "errors" }} -{{ reserveImport "bytes" }} - -{{ reserveImport "github.com/vektah/gqlparser/v2" }} -{{ reserveImport "github.com/vektah/gqlparser/v2/ast" }} -{{ reserveImport "github.com/99designs/gqlgen/graphql" }} -{{ reserveImport "github.com/99designs/gqlgen/graphql/introspection" }} - -{{ .Imports }} - -{{ if .HasRoot }} - type {{.ResolverType}} struct {} -{{ end }} - -{{ range $resolver := .Resolvers -}} - // {{ $resolver.Comment }} - func (r *{{lcFirst $resolver.Object.Name}}{{ucFirst $.ResolverType}}) {{$resolver.Field.GoFieldName}}{{ $resolver.Field.ShortResolverDeclaration }} { - {{ $resolver.Implementation }} - } - -{{ end }} - -{{ range $object := .Objects -}} - // {{ucFirst $object.Name}} returns {{ $object.ResolverInterface | ref }} implementation. - func (r *{{$.ResolverType}}) {{ucFirst $object.Name}}() {{ $object.ResolverInterface | ref }} { return &{{lcFirst $object.Name}}{{ucFirst $.ResolverType}}{r} } -{{ end }} - -{{ range $object := .Objects -}} - type {{lcFirst $object.Name}}{{ucFirst $.ResolverType}} struct { *{{$.ResolverType}} } -{{ end }} - -{{ if (ne .RemainingSource "") }} - // !!! WARNING !!! - // The code below was going to be deleted when updating resolvers. It has been copied here so you have - // one last chance to move it out of harms way if you want. There are two reasons this happens: - // - When renaming or deleting a resolver the old code will be put in here. You can safely delete - // it when you're done. - // - You have helper methods in this file. Move them out to keep these resolver files clean. - {{ .RemainingSource }} -{{ end }} diff --git a/vendor/github.com/actiontech/mybatis-mapper-2-sql/ast/mapper.go b/vendor/github.com/actiontech/mybatis-mapper-2-sql/ast/mapper.go index 9343eb39ad..7588f30472 100644 --- a/vendor/github.com/actiontech/mybatis-mapper-2-sql/ast/mapper.go +++ b/vendor/github.com/actiontech/mybatis-mapper-2-sql/ast/mapper.go @@ -13,6 +13,7 @@ type Mapper struct { SqlNodes map[string]*SqlNode QueryNodeIndex map[string]*QueryNode QueryNodes []*QueryNode + FilePath string } func NewMapper() *Mapper { diff --git a/vendor/github.com/actiontech/mybatis-mapper-2-sql/ast/mappers.go b/vendor/github.com/actiontech/mybatis-mapper-2-sql/ast/mappers.go index b8086594ea..894d2641ff 100644 --- a/vendor/github.com/actiontech/mybatis-mapper-2-sql/ast/mappers.go +++ b/vendor/github.com/actiontech/mybatis-mapper-2-sql/ast/mappers.go @@ -23,9 +23,14 @@ func (s *Mappers) AddMapper(ms ...*Mapper) error { return nil } -func (s *Mappers) GetStmts(skipErrorQuery bool) ([]string, error) { +type StmtInfo struct { + FilePath string + SQL string +} + +func (s *Mappers) GetStmts(skipErrorQuery bool) ([]StmtInfo, error) { ctx := NewContext() - stmts := []string{} + stmts := []StmtInfo{} for _, m := range s.mappers { for id, node := range m.SqlNodes { ctx.Sqls[fmt.Sprintf("%v.%v", m.NameSpace, id)] = node @@ -38,7 +43,12 @@ func (s *Mappers) GetStmts(skipErrorQuery bool) ([]string, error) { if err != nil { return nil, fmt.Errorf("get sqls from mapper failed, namespace: %v, err: %v", m.NameSpace, err) } - stmts = append(stmts, stmt...) + for _, sql := range stmt { + stmts = append(stmts, StmtInfo{ + FilePath: m.FilePath, + SQL: sql, + }) + } } return stmts, nil } diff --git a/vendor/github.com/actiontech/mybatis-mapper-2-sql/parser.go b/vendor/github.com/actiontech/mybatis-mapper-2-sql/parser.go index 1604a1b09f..cc73398150 100644 --- a/vendor/github.com/actiontech/mybatis-mapper-2-sql/parser.go +++ b/vendor/github.com/actiontech/mybatis-mapper-2-sql/parser.go @@ -28,12 +28,17 @@ func ParseXML(data string) (string, error) { return stmt, nil } -// ParseXMLs is a parser for parse all query in several XML files to []string one by one; +type XmlFile struct { + FilePath string + Content string +} + +// ParseXMLs is a parser for parse all query in several XML files to []ast.StmtInfo one by one; // you can set `skipErrorQuery` true to ignore invalid query. -func ParseXMLs(data []string, skipErrorQuery bool) ([]string, error) { +func ParseXMLs(data []XmlFile, skipErrorQuery bool) ([]ast.StmtInfo, error) { ms := ast.NewMappers() - for i := range data { - r := strings.NewReader(data[i]) + for _, data := range data { + r := strings.NewReader(data.Content) d := xml.NewDecoder(r) n, err := parse(d) if err != nil { @@ -56,6 +61,7 @@ func ParseXMLs(data []string, skipErrorQuery bool) ([]string, error) { return nil, errors.New("the mapper is not found") } } + m.FilePath = data.FilePath err = ms.AddMapper(m) if err != nil && !skipErrorQuery { return nil, fmt.Errorf("add mapper failed: %v", err) diff --git a/vendor/github.com/agnivade/levenshtein/.gitignore b/vendor/github.com/agnivade/levenshtein/.gitignore deleted file mode 100644 index 345780a444..0000000000 --- a/vendor/github.com/agnivade/levenshtein/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -coverage.txt -fuzz/fuzz-fuzz.zip -fuzz/corpus/corpus/* -fuzz/corpus/suppressions/* -fuzz/corpus/crashes/* diff --git a/vendor/github.com/agnivade/levenshtein/.travis.yml b/vendor/github.com/agnivade/levenshtein/.travis.yml deleted file mode 100644 index 0873fa983f..0000000000 --- a/vendor/github.com/agnivade/levenshtein/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ -language: go - -# See https://travis-ci.community/t/goos-js-goarch-wasm-go-run-fails-panic-newosproc-not-implemented/1651 -#addons: -# chrome: stable - -before_install: -- export GO111MODULE=on - -#install: -#- go get github.com/agnivade/wasmbrowsertest -#- mv $GOPATH/bin/wasmbrowsertest $GOPATH/bin/go_js_wasm_exec -#- export PATH=$GOPATH/bin:$PATH - -go: -- 1.13.x -- 1.14.x -- 1.15.x -- tip - -script: -#- GOOS=js GOARCH=wasm go test -v -- go test -v diff --git a/vendor/github.com/agnivade/levenshtein/License.txt b/vendor/github.com/agnivade/levenshtein/License.txt deleted file mode 100644 index 54b51f4993..0000000000 --- a/vendor/github.com/agnivade/levenshtein/License.txt +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Agniva De Sarker - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/agnivade/levenshtein/Makefile b/vendor/github.com/agnivade/levenshtein/Makefile deleted file mode 100644 index 5f6890d613..0000000000 --- a/vendor/github.com/agnivade/levenshtein/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -all: test install - -install: - go install - -lint: - gofmt -l -s -w . && go vet . && golint -set_exit_status=1 . - -test: # The first 2 go gets are to support older Go versions - go get github.com/arbovm/levenshtein - go get github.com/dgryski/trifles/leven - GO111MODULE=on go test -race -v -coverprofile=coverage.txt -covermode=atomic - -bench: - go test -run=XXX -bench=. -benchmem -count=5 diff --git a/vendor/github.com/agnivade/levenshtein/README.md b/vendor/github.com/agnivade/levenshtein/README.md deleted file mode 100644 index 13c52a2101..0000000000 --- a/vendor/github.com/agnivade/levenshtein/README.md +++ /dev/null @@ -1,80 +0,0 @@ -levenshtein [![Build Status](https://travis-ci.org/agnivade/levenshtein.svg?branch=master)](https://travis-ci.org/agnivade/levenshtein) [![Go Report Card](https://goreportcard.com/badge/github.com/agnivade/levenshtein)](https://goreportcard.com/report/github.com/agnivade/levenshtein) [![PkgGoDev](https://pkg.go.dev/badge/github.com/agnivade/levenshtein)](https://pkg.go.dev/github.com/agnivade/levenshtein) -=========== - -[Go](http://golang.org) package to calculate the [Levenshtein Distance](http://en.wikipedia.org/wiki/Levenshtein_distance) - -The library is fully capable of working with non-ascii strings. But the strings are not normalized. That is left as a user-dependant use case. Please normalize the strings before passing it to the library if you have such a requirement. -- https://blog.golang.org/normalization - -#### Limitation - -As a performance optimization, the library can handle strings only up to 65536 characters (runes). If you need to handle strings larger than that, please pin to version 1.0.3. - -Install -------- - - go get github.com/agnivade/levenshtein - -Example -------- - -```go -package main - -import ( - "fmt" - "github.com/agnivade/levenshtein" -) - -func main() { - s1 := "kitten" - s2 := "sitting" - distance := levenshtein.ComputeDistance(s1, s2) - fmt.Printf("The distance between %s and %s is %d.\n", s1, s2, distance) - // Output: - // The distance between kitten and sitting is 3. -} - -``` - -Benchmarks ----------- - -``` -name time/op -Simple/ASCII-4 330ns ± 2% -Simple/French-4 617ns ± 2% -Simple/Nordic-4 1.16µs ± 4% -Simple/Tibetan-4 1.05µs ± 1% - -name alloc/op -Simple/ASCII-4 96.0B ± 0% -Simple/French-4 128B ± 0% -Simple/Nordic-4 192B ± 0% -Simple/Tibetan-4 144B ± 0% - -name allocs/op -Simple/ASCII-4 1.00 ± 0% -Simple/French-4 1.00 ± 0% -Simple/Nordic-4 1.00 ± 0% -Simple/Tibetan-4 1.00 ± 0% -``` - -Comparisons with other libraries --------------------------------- - -``` -name time/op -Leven/ASCII/agniva-4 353ns ± 1% -Leven/ASCII/arbovm-4 485ns ± 1% -Leven/ASCII/dgryski-4 395ns ± 0% -Leven/French/agniva-4 648ns ± 1% -Leven/French/arbovm-4 791ns ± 0% -Leven/French/dgryski-4 682ns ± 0% -Leven/Nordic/agniva-4 1.28µs ± 1% -Leven/Nordic/arbovm-4 1.52µs ± 1% -Leven/Nordic/dgryski-4 1.32µs ± 1% -Leven/Tibetan/agniva-4 1.12µs ± 1% -Leven/Tibetan/arbovm-4 1.31µs ± 0% -Leven/Tibetan/dgryski-4 1.16µs ± 0% -``` diff --git a/vendor/github.com/agnivade/levenshtein/levenshtein.go b/vendor/github.com/agnivade/levenshtein/levenshtein.go deleted file mode 100644 index f727a66fe7..0000000000 --- a/vendor/github.com/agnivade/levenshtein/levenshtein.go +++ /dev/null @@ -1,89 +0,0 @@ -// Package levenshtein is a Go implementation to calculate Levenshtein Distance. -// -// Implementation taken from -// https://gist.github.com/andrei-m/982927#gistcomment-1931258 -package levenshtein - -import "unicode/utf8" - -// minLengthThreshold is the length of the string beyond which -// an allocation will be made. Strings smaller than this will be -// zero alloc. -const minLengthThreshold = 32 - -// ComputeDistance computes the levenshtein distance between the two -// strings passed as an argument. The return value is the levenshtein distance -// -// Works on runes (Unicode code points) but does not normalize -// the input strings. See https://blog.golang.org/normalization -// and the golang.org/x/text/unicode/norm package. -func ComputeDistance(a, b string) int { - if len(a) == 0 { - return utf8.RuneCountInString(b) - } - - if len(b) == 0 { - return utf8.RuneCountInString(a) - } - - if a == b { - return 0 - } - - // We need to convert to []rune if the strings are non-ASCII. - // This could be avoided by using utf8.RuneCountInString - // and then doing some juggling with rune indices, - // but leads to far more bounds checks. It is a reasonable trade-off. - s1 := []rune(a) - s2 := []rune(b) - - // swap to save some memory O(min(a,b)) instead of O(a) - if len(s1) > len(s2) { - s1, s2 = s2, s1 - } - lenS1 := len(s1) - lenS2 := len(s2) - - // Init the row. - var x []uint16 - if lenS1+1 > minLengthThreshold { - x = make([]uint16, lenS1+1) - } else { - // We make a small optimization here for small strings. - // Because a slice of constant length is effectively an array, - // it does not allocate. So we can re-slice it to the right length - // as long as it is below a desired threshold. - x = make([]uint16, minLengthThreshold) - x = x[:lenS1+1] - } - - // we start from 1 because index 0 is already 0. - for i := 1; i < len(x); i++ { - x[i] = uint16(i) - } - - // make a dummy bounds check to prevent the 2 bounds check down below. - // The one inside the loop is particularly costly. - _ = x[lenS1] - // fill in the rest - for i := 1; i <= lenS2; i++ { - prev := uint16(i) - for j := 1; j <= lenS1; j++ { - current := x[j-1] // match - if s2[i-1] != s1[j-1] { - current = min(min(x[j-1]+1, prev+1), x[j]+1) - } - x[j-1] = prev - prev = current - } - x[lenS1] = prev - } - return int(x[lenS1]) -} - -func min(a, b uint16) uint16 { - if a < b { - return a - } - return b -} diff --git a/vendor/github.com/vektah/gqlparser/v2/.gitignore b/vendor/github.com/vektah/gqlparser/v2/.gitignore deleted file mode 100644 index 877392a763..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -/vendor -/validator/imported/node_modules -/validator/imported/graphql-js - -.idea/ diff --git a/vendor/github.com/vektah/gqlparser/v2/LICENSE b/vendor/github.com/vektah/gqlparser/v2/LICENSE deleted file mode 100644 index 1221b9d389..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2018 Adam Scarr - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/argmap.go b/vendor/github.com/vektah/gqlparser/v2/ast/argmap.go deleted file mode 100644 index 43f6a3d6fc..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/ast/argmap.go +++ /dev/null @@ -1,37 +0,0 @@ -package ast - -func arg2map(defs ArgumentDefinitionList, args ArgumentList, vars map[string]interface{}) map[string]interface{} { - result := map[string]interface{}{} - var err error - - for _, argDef := range defs { - var val interface{} - var hasValue bool - - if argValue := args.ForName(argDef.Name); argValue != nil { - if argValue.Value.Kind == Variable { - val, hasValue = vars[argValue.Value.Raw] - } else { - val, err = argValue.Value.Value(vars) - if err != nil { - panic(err) - } - hasValue = true - } - } - - if !hasValue && argDef.DefaultValue != nil { - val, err = argDef.DefaultValue.Value(vars) - if err != nil { - panic(err) - } - hasValue = true - } - - if hasValue { - result[argDef.Name] = val - } - } - - return result -} diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/collections.go b/vendor/github.com/vektah/gqlparser/v2/ast/collections.go deleted file mode 100644 index 94b800ee26..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/ast/collections.go +++ /dev/null @@ -1,148 +0,0 @@ -package ast - -type FieldList []*FieldDefinition - -func (l FieldList) ForName(name string) *FieldDefinition { - for _, it := range l { - if it.Name == name { - return it - } - } - return nil -} - -type EnumValueList []*EnumValueDefinition - -func (l EnumValueList) ForName(name string) *EnumValueDefinition { - for _, it := range l { - if it.Name == name { - return it - } - } - return nil -} - -type DirectiveList []*Directive - -func (l DirectiveList) ForName(name string) *Directive { - for _, it := range l { - if it.Name == name { - return it - } - } - return nil -} - -func (l DirectiveList) ForNames(name string) []*Directive { - resp := []*Directive{} - for _, it := range l { - if it.Name == name { - resp = append(resp, it) - } - } - return resp -} - -type OperationList []*OperationDefinition - -func (l OperationList) ForName(name string) *OperationDefinition { - if name == "" && len(l) == 1 { - return l[0] - } - for _, it := range l { - if it.Name == name { - return it - } - } - return nil -} - -type FragmentDefinitionList []*FragmentDefinition - -func (l FragmentDefinitionList) ForName(name string) *FragmentDefinition { - for _, it := range l { - if it.Name == name { - return it - } - } - return nil -} - -type VariableDefinitionList []*VariableDefinition - -func (l VariableDefinitionList) ForName(name string) *VariableDefinition { - for _, it := range l { - if it.Variable == name { - return it - } - } - return nil -} - -type ArgumentList []*Argument - -func (l ArgumentList) ForName(name string) *Argument { - for _, it := range l { - if it.Name == name { - return it - } - } - return nil -} - -type ArgumentDefinitionList []*ArgumentDefinition - -func (l ArgumentDefinitionList) ForName(name string) *ArgumentDefinition { - for _, it := range l { - if it.Name == name { - return it - } - } - return nil -} - -type SchemaDefinitionList []*SchemaDefinition - -type DirectiveDefinitionList []*DirectiveDefinition - -func (l DirectiveDefinitionList) ForName(name string) *DirectiveDefinition { - for _, it := range l { - if it.Name == name { - return it - } - } - return nil -} - -type DefinitionList []*Definition - -func (l DefinitionList) ForName(name string) *Definition { - for _, it := range l { - if it.Name == name { - return it - } - } - return nil -} - -type OperationTypeDefinitionList []*OperationTypeDefinition - -func (l OperationTypeDefinitionList) ForType(name string) *OperationTypeDefinition { - for _, it := range l { - if it.Type == name { - return it - } - } - return nil -} - -type ChildValueList []*ChildValue - -func (v ChildValueList) ForName(name string) *Value { - for _, f := range v { - if f.Name == name { - return f.Value - } - } - return nil -} diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/decode.go b/vendor/github.com/vektah/gqlparser/v2/ast/decode.go deleted file mode 100644 index d00920554c..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/ast/decode.go +++ /dev/null @@ -1,216 +0,0 @@ -package ast - -import ( - "encoding/json" -) - -func UnmarshalSelectionSet(b []byte) (SelectionSet, error) { - var tmp []json.RawMessage - - if err := json.Unmarshal(b, &tmp); err != nil { - return nil, err - } - - var result = make([]Selection, 0) - for _, item := range tmp { - var field Field - if err := json.Unmarshal(item, &field); err == nil { - result = append(result, &field) - continue - } - var fragmentSpread FragmentSpread - if err := json.Unmarshal(item, &fragmentSpread); err == nil { - result = append(result, &fragmentSpread) - continue - } - var inlineFragment InlineFragment - if err := json.Unmarshal(item, &inlineFragment); err == nil { - result = append(result, &inlineFragment) - continue - } - } - - return result, nil -} - -func (f *FragmentDefinition) UnmarshalJSON(b []byte) error { - var tmp map[string]json.RawMessage - if err := json.Unmarshal(b, &tmp); err != nil { - return err - } - for k := range tmp { - switch k { - case "Name": - err := json.Unmarshal(tmp[k], &f.Name) - if err != nil { - return err - } - case "VariableDefinition": - err := json.Unmarshal(tmp[k], &f.VariableDefinition) - if err != nil { - return err - } - case "TypeCondition": - err := json.Unmarshal(tmp[k], &f.TypeCondition) - if err != nil { - return err - } - case "Directives": - err := json.Unmarshal(tmp[k], &f.Directives) - if err != nil { - return err - } - case "SelectionSet": - ss, err := UnmarshalSelectionSet(tmp[k]) - if err != nil { - return err - } - f.SelectionSet = ss - case "Definition": - err := json.Unmarshal(tmp[k], &f.Definition) - if err != nil { - return err - } - case "Position": - err := json.Unmarshal(tmp[k], &f.Position) - if err != nil { - return err - } - } - } - return nil -} - -func (f *InlineFragment) UnmarshalJSON(b []byte) error { - var tmp map[string]json.RawMessage - if err := json.Unmarshal(b, &tmp); err != nil { - return err - } - for k := range tmp { - switch k { - case "TypeCondition": - err := json.Unmarshal(tmp[k], &f.TypeCondition) - if err != nil { - return err - } - case "Directives": - err := json.Unmarshal(tmp[k], &f.Directives) - if err != nil { - return err - } - case "SelectionSet": - ss, err := UnmarshalSelectionSet(tmp[k]) - if err != nil { - return err - } - f.SelectionSet = ss - case "ObjectDefinition": - err := json.Unmarshal(tmp[k], &f.ObjectDefinition) - if err != nil { - return err - } - case "Position": - err := json.Unmarshal(tmp[k], &f.Position) - if err != nil { - return err - } - } - } - return nil -} - -func (f *OperationDefinition) UnmarshalJSON(b []byte) error { - var tmp map[string]json.RawMessage - if err := json.Unmarshal(b, &tmp); err != nil { - return err - } - for k := range tmp { - switch k { - case "Operation": - err := json.Unmarshal(tmp[k], &f.Operation) - if err != nil { - return err - } - case "Name": - err := json.Unmarshal(tmp[k], &f.Name) - if err != nil { - return err - } - case "VariableDefinitions": - err := json.Unmarshal(tmp[k], &f.VariableDefinitions) - if err != nil { - return err - } - case "Directives": - err := json.Unmarshal(tmp[k], &f.Directives) - if err != nil { - return err - } - case "SelectionSet": - ss, err := UnmarshalSelectionSet(tmp[k]) - if err != nil { - return err - } - f.SelectionSet = ss - case "Position": - err := json.Unmarshal(tmp[k], &f.Position) - if err != nil { - return err - } - } - } - return nil -} - -func (f *Field) UnmarshalJSON(b []byte) error { - var tmp map[string]json.RawMessage - if err := json.Unmarshal(b, &tmp); err != nil { - return err - } - for k := range tmp { - switch k { - case "Alias": - err := json.Unmarshal(tmp[k], &f.Alias) - if err != nil { - return err - } - case "Name": - err := json.Unmarshal(tmp[k], &f.Name) - if err != nil { - return err - } - case "Arguments": - err := json.Unmarshal(tmp[k], &f.Arguments) - if err != nil { - return err - } - case "Directives": - err := json.Unmarshal(tmp[k], &f.Directives) - if err != nil { - return err - } - case "SelectionSet": - ss, err := UnmarshalSelectionSet(tmp[k]) - if err != nil { - return err - } - f.SelectionSet = ss - case "Position": - err := json.Unmarshal(tmp[k], &f.Position) - if err != nil { - return err - } - case "Definition": - err := json.Unmarshal(tmp[k], &f.Definition) - if err != nil { - return err - } - case "ObjectDefinition": - err := json.Unmarshal(tmp[k], &f.ObjectDefinition) - if err != nil { - return err - } - } - } - return nil -} diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/definition.go b/vendor/github.com/vektah/gqlparser/v2/ast/definition.go deleted file mode 100644 index d203908168..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/ast/definition.go +++ /dev/null @@ -1,94 +0,0 @@ -package ast - -type DefinitionKind string - -const ( - Scalar DefinitionKind = "SCALAR" - Object DefinitionKind = "OBJECT" - Interface DefinitionKind = "INTERFACE" - Union DefinitionKind = "UNION" - Enum DefinitionKind = "ENUM" - InputObject DefinitionKind = "INPUT_OBJECT" -) - -// Definition is the core type definition object, it includes all of the definable types -// but does *not* cover schema or directives. -// -// @vektah: Javascript implementation has different types for all of these, but they are -// more similar than different and don't define any behaviour. I think this style of -// "some hot" struct works better, at least for go. -// -// Type extensions are also represented by this same struct. -type Definition struct { - Kind DefinitionKind - Description string - Name string - Directives DirectiveList - Interfaces []string // object and input object - Fields FieldList // object and input object - Types []string // union - EnumValues EnumValueList // enum - - Position *Position `dump:"-"` - BuiltIn bool `dump:"-"` -} - -func (d *Definition) IsLeafType() bool { - return d.Kind == Enum || d.Kind == Scalar -} - -func (d *Definition) IsAbstractType() bool { - return d.Kind == Interface || d.Kind == Union -} - -func (d *Definition) IsCompositeType() bool { - return d.Kind == Object || d.Kind == Interface || d.Kind == Union -} - -func (d *Definition) IsInputType() bool { - return d.Kind == Scalar || d.Kind == Enum || d.Kind == InputObject -} - -func (d *Definition) OneOf(types ...string) bool { - for _, t := range types { - if d.Name == t { - return true - } - } - return false -} - -type FieldDefinition struct { - Description string - Name string - Arguments ArgumentDefinitionList // only for objects - DefaultValue *Value // only for input objects - Type *Type - Directives DirectiveList - Position *Position `dump:"-"` -} - -type ArgumentDefinition struct { - Description string - Name string - DefaultValue *Value - Type *Type - Directives DirectiveList - Position *Position `dump:"-"` -} - -type EnumValueDefinition struct { - Description string - Name string - Directives DirectiveList - Position *Position `dump:"-"` -} - -type DirectiveDefinition struct { - Description string - Name string - Arguments ArgumentDefinitionList - Locations []DirectiveLocation - IsRepeatable bool - Position *Position `dump:"-"` -} diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/directive.go b/vendor/github.com/vektah/gqlparser/v2/ast/directive.go deleted file mode 100644 index 5f6e8531f5..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/ast/directive.go +++ /dev/null @@ -1,43 +0,0 @@ -package ast - -type DirectiveLocation string - -const ( - // Executable - LocationQuery DirectiveLocation = `QUERY` - LocationMutation DirectiveLocation = `MUTATION` - LocationSubscription DirectiveLocation = `SUBSCRIPTION` - LocationField DirectiveLocation = `FIELD` - LocationFragmentDefinition DirectiveLocation = `FRAGMENT_DEFINITION` - LocationFragmentSpread DirectiveLocation = `FRAGMENT_SPREAD` - LocationInlineFragment DirectiveLocation = `INLINE_FRAGMENT` - - // Type System - LocationSchema DirectiveLocation = `SCHEMA` - LocationScalar DirectiveLocation = `SCALAR` - LocationObject DirectiveLocation = `OBJECT` - LocationFieldDefinition DirectiveLocation = `FIELD_DEFINITION` - LocationArgumentDefinition DirectiveLocation = `ARGUMENT_DEFINITION` - LocationInterface DirectiveLocation = `INTERFACE` - LocationUnion DirectiveLocation = `UNION` - LocationEnum DirectiveLocation = `ENUM` - LocationEnumValue DirectiveLocation = `ENUM_VALUE` - LocationInputObject DirectiveLocation = `INPUT_OBJECT` - LocationInputFieldDefinition DirectiveLocation = `INPUT_FIELD_DEFINITION` - LocationVariableDefinition DirectiveLocation = `VARIABLE_DEFINITION` -) - -type Directive struct { - Name string - Arguments ArgumentList - Position *Position `dump:"-"` - - // Requires validation - ParentDefinition *Definition - Definition *DirectiveDefinition - Location DirectiveLocation -} - -func (d *Directive) ArgumentMap(vars map[string]interface{}) map[string]interface{} { - return arg2map(d.Definition.Arguments, d.Arguments, vars) -} diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/document.go b/vendor/github.com/vektah/gqlparser/v2/ast/document.go deleted file mode 100644 index 43bfb54ff5..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/ast/document.go +++ /dev/null @@ -1,79 +0,0 @@ -package ast - -type QueryDocument struct { - Operations OperationList - Fragments FragmentDefinitionList - Position *Position `dump:"-"` -} - -type SchemaDocument struct { - Schema SchemaDefinitionList - SchemaExtension SchemaDefinitionList - Directives DirectiveDefinitionList - Definitions DefinitionList - Extensions DefinitionList - Position *Position `dump:"-"` -} - -func (d *SchemaDocument) Merge(other *SchemaDocument) { - d.Schema = append(d.Schema, other.Schema...) - d.SchemaExtension = append(d.SchemaExtension, other.SchemaExtension...) - d.Directives = append(d.Directives, other.Directives...) - d.Definitions = append(d.Definitions, other.Definitions...) - d.Extensions = append(d.Extensions, other.Extensions...) -} - -type Schema struct { - Query *Definition - Mutation *Definition - Subscription *Definition - - Types map[string]*Definition - Directives map[string]*DirectiveDefinition - - PossibleTypes map[string][]*Definition - Implements map[string][]*Definition - - Description string -} - -// AddTypes is the helper to add types definition to the schema -func (s *Schema) AddTypes(defs ...*Definition) { - if s.Types == nil { - s.Types = make(map[string]*Definition) - } - for _, def := range defs { - s.Types[def.Name] = def - } -} - -func (s *Schema) AddPossibleType(name string, def *Definition) { - s.PossibleTypes[name] = append(s.PossibleTypes[name], def) -} - -// GetPossibleTypes will enumerate all the definitions for a given interface or union -func (s *Schema) GetPossibleTypes(def *Definition) []*Definition { - return s.PossibleTypes[def.Name] -} - -func (s *Schema) AddImplements(name string, iface *Definition) { - s.Implements[name] = append(s.Implements[name], iface) -} - -// GetImplements returns all the interface and union definitions that the given definition satisfies -func (s *Schema) GetImplements(def *Definition) []*Definition { - return s.Implements[def.Name] -} - -type SchemaDefinition struct { - Description string - Directives DirectiveList - OperationTypes OperationTypeDefinitionList - Position *Position `dump:"-"` -} - -type OperationTypeDefinition struct { - Operation Operation - Type string - Position *Position `dump:"-"` -} diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/dumper.go b/vendor/github.com/vektah/gqlparser/v2/ast/dumper.go deleted file mode 100644 index dbb7a7efaf..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/ast/dumper.go +++ /dev/null @@ -1,159 +0,0 @@ -package ast - -import ( - "bytes" - "fmt" - "reflect" - "strconv" - "strings" -) - -// Dump turns ast into a stable string format for assertions in tests -func Dump(i interface{}) string { - v := reflect.ValueOf(i) - - d := dumper{Buffer: &bytes.Buffer{}} - d.dump(v) - - return d.String() -} - -type dumper struct { - *bytes.Buffer - indent int -} - -type Dumpable interface { - Dump() string -} - -func (d *dumper) dump(v reflect.Value) { - if dumpable, isDumpable := v.Interface().(Dumpable); isDumpable { - d.WriteString(dumpable.Dump()) - return - } - switch v.Kind() { - case reflect.Bool: - if v.Bool() { - d.WriteString("true") - } else { - d.WriteString("false") - } - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - d.WriteString(fmt.Sprintf("%d", v.Int())) - - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: - d.WriteString(fmt.Sprintf("%d", v.Uint())) - - case reflect.Float32, reflect.Float64: - d.WriteString(fmt.Sprintf("%.2f", v.Float())) - - case reflect.String: - if v.Type().Name() != "string" { - d.WriteString(v.Type().Name() + "(" + strconv.Quote(v.String()) + ")") - } else { - d.WriteString(strconv.Quote(v.String())) - } - - case reflect.Array, reflect.Slice: - d.dumpArray(v) - - case reflect.Interface, reflect.Ptr: - d.dumpPtr(v) - - case reflect.Struct: - d.dumpStruct(v) - - default: - panic(fmt.Errorf("unsupported kind: %s\n buf: %s", v.Kind().String(), d.String())) - } -} - -func (d *dumper) writeIndent() { - d.Buffer.WriteString(strings.Repeat(" ", d.indent)) -} - -func (d *dumper) nl() { - d.Buffer.WriteByte('\n') - d.writeIndent() -} - -func typeName(t reflect.Type) string { - if t.Kind() == reflect.Ptr { - return typeName(t.Elem()) - } - return t.Name() -} - -func (d *dumper) dumpArray(v reflect.Value) { - d.WriteString("[" + typeName(v.Type().Elem()) + "]") - - for i := 0; i < v.Len(); i++ { - d.nl() - d.WriteString("- ") - d.indent++ - d.dump(v.Index(i)) - d.indent-- - } -} - -func (d *dumper) dumpStruct(v reflect.Value) { - d.WriteString("<" + v.Type().Name() + ">") - d.indent++ - - typ := v.Type() - for i := 0; i < v.NumField(); i++ { - f := v.Field(i) - if typ.Field(i).Tag.Get("dump") == "-" { - continue - } - - if isZero(f) { - continue - } - d.nl() - d.WriteString(typ.Field(i).Name) - d.WriteString(": ") - d.dump(v.Field(i)) - } - - d.indent-- -} - -func isZero(v reflect.Value) bool { - switch v.Kind() { - case reflect.Ptr, reflect.Interface: - return v.IsNil() - case reflect.Func, reflect.Map: - return v.IsNil() - - case reflect.Array, reflect.Slice: - if v.IsNil() { - return true - } - z := true - for i := 0; i < v.Len(); i++ { - z = z && isZero(v.Index(i)) - } - return z - case reflect.Struct: - z := true - for i := 0; i < v.NumField(); i++ { - z = z && isZero(v.Field(i)) - } - return z - case reflect.String: - return v.String() == "" - } - - // Compare other types directly: - return reflect.DeepEqual(v.Interface(), reflect.Zero(v.Type())) -} - -func (d *dumper) dumpPtr(v reflect.Value) { - if v.IsNil() { - d.WriteString("nil") - return - } - d.dump(v.Elem()) -} diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/fragment.go b/vendor/github.com/vektah/gqlparser/v2/ast/fragment.go deleted file mode 100644 index 57ab56c7c6..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/ast/fragment.go +++ /dev/null @@ -1,38 +0,0 @@ -package ast - -type FragmentSpread struct { - Name string - Directives DirectiveList - - // Require validation - ObjectDefinition *Definition - Definition *FragmentDefinition - - Position *Position `dump:"-"` -} - -type InlineFragment struct { - TypeCondition string - Directives DirectiveList - SelectionSet SelectionSet - - // Require validation - ObjectDefinition *Definition - - Position *Position `dump:"-"` -} - -type FragmentDefinition struct { - Name string - // Note: fragment variable definitions are experimental and may be changed - // or removed in the future. - VariableDefinition VariableDefinitionList - TypeCondition string - Directives DirectiveList - SelectionSet SelectionSet - - // Require validation - Definition *Definition - - Position *Position `dump:"-"` -} diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/operation.go b/vendor/github.com/vektah/gqlparser/v2/ast/operation.go deleted file mode 100644 index 3b37f81bf3..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/ast/operation.go +++ /dev/null @@ -1,30 +0,0 @@ -package ast - -type Operation string - -const ( - Query Operation = "query" - Mutation Operation = "mutation" - Subscription Operation = "subscription" -) - -type OperationDefinition struct { - Operation Operation - Name string - VariableDefinitions VariableDefinitionList - Directives DirectiveList - SelectionSet SelectionSet - Position *Position `dump:"-"` -} - -type VariableDefinition struct { - Variable string - Type *Type - DefaultValue *Value - Directives DirectiveList - Position *Position `dump:"-"` - - // Requires validation - Definition *Definition - Used bool `dump:"-"` -} diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/path.go b/vendor/github.com/vektah/gqlparser/v2/ast/path.go deleted file mode 100644 index 9af1684388..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/ast/path.go +++ /dev/null @@ -1,67 +0,0 @@ -package ast - -import ( - "bytes" - "encoding/json" - "fmt" -) - -var _ json.Unmarshaler = (*Path)(nil) - -type Path []PathElement - -type PathElement interface { - isPathElement() -} - -var _ PathElement = PathIndex(0) -var _ PathElement = PathName("") - -func (path Path) String() string { - var str bytes.Buffer - for i, v := range path { - switch v := v.(type) { - case PathIndex: - str.WriteString(fmt.Sprintf("[%d]", v)) - case PathName: - if i != 0 { - str.WriteByte('.') - } - str.WriteString(string(v)) - default: - panic(fmt.Sprintf("unknown type: %T", v)) - } - } - return str.String() -} - -func (path *Path) UnmarshalJSON(b []byte) error { - var vs []interface{} - err := json.Unmarshal(b, &vs) - if err != nil { - return err - } - - *path = make([]PathElement, 0, len(vs)) - for _, v := range vs { - switch v := v.(type) { - case string: - *path = append(*path, PathName(v)) - case int: - *path = append(*path, PathIndex(v)) - case float64: - *path = append(*path, PathIndex(int(v))) - default: - return fmt.Errorf("unknown path element type: %T", v) - } - } - return nil -} - -type PathIndex int - -func (_ PathIndex) isPathElement() {} - -type PathName string - -func (_ PathName) isPathElement() {} diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/selection.go b/vendor/github.com/vektah/gqlparser/v2/ast/selection.go deleted file mode 100644 index 159db84471..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/ast/selection.go +++ /dev/null @@ -1,39 +0,0 @@ -package ast - -type SelectionSet []Selection - -type Selection interface { - isSelection() - GetPosition() *Position -} - -func (*Field) isSelection() {} -func (*FragmentSpread) isSelection() {} -func (*InlineFragment) isSelection() {} - -func (s *Field) GetPosition() *Position { return s.Position } -func (s *FragmentSpread) GetPosition() *Position { return s.Position } -func (s *InlineFragment) GetPosition() *Position { return s.Position } - -type Field struct { - Alias string - Name string - Arguments ArgumentList - Directives DirectiveList - SelectionSet SelectionSet - Position *Position `dump:"-"` - - // Require validation - Definition *FieldDefinition - ObjectDefinition *Definition -} - -type Argument struct { - Name string - Value *Value - Position *Position `dump:"-"` -} - -func (f *Field) ArgumentMap(vars map[string]interface{}) map[string]interface{} { - return arg2map(f.Definition.Arguments, f.Arguments, vars) -} diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/source.go b/vendor/github.com/vektah/gqlparser/v2/ast/source.go deleted file mode 100644 index 2949f83f7b..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/ast/source.go +++ /dev/null @@ -1,19 +0,0 @@ -package ast - -// Source covers a single *.graphql file -type Source struct { - // Name is the filename of the source - Name string - // Input is the actual contents of the source file - Input string - // BuiltIn indicate whether the source is a part of the specification - BuiltIn bool -} - -type Position struct { - Start int // The starting position, in runes, of this token in the input. - End int // The end position, in runes, of this token in the input. - Line int // The line number at the start of this item. - Column int // The column number at the start of this item. - Src *Source // The source document this token belongs to -} diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/type.go b/vendor/github.com/vektah/gqlparser/v2/ast/type.go deleted file mode 100644 index 9577fdb48c..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/ast/type.go +++ /dev/null @@ -1,68 +0,0 @@ -package ast - -func NonNullNamedType(named string, pos *Position) *Type { - return &Type{NamedType: named, NonNull: true, Position: pos} -} - -func NamedType(named string, pos *Position) *Type { - return &Type{NamedType: named, NonNull: false, Position: pos} -} - -func NonNullListType(elem *Type, pos *Position) *Type { - return &Type{Elem: elem, NonNull: true, Position: pos} -} - -func ListType(elem *Type, pos *Position) *Type { - return &Type{Elem: elem, NonNull: false, Position: pos} -} - -type Type struct { - NamedType string - Elem *Type - NonNull bool - Position *Position `dump:"-"` -} - -func (t *Type) Name() string { - if t.NamedType != "" { - return t.NamedType - } - - return t.Elem.Name() -} - -func (t *Type) String() string { - nn := "" - if t.NonNull { - nn = "!" - } - if t.NamedType != "" { - return t.NamedType + nn - } - - return "[" + t.Elem.String() + "]" + nn -} - -func (t *Type) IsCompatible(other *Type) bool { - if t.NamedType != other.NamedType { - return false - } - - if t.Elem != nil && other.Elem == nil { - return false - } - - if t.Elem != nil && !t.Elem.IsCompatible(other.Elem) { - return false - } - - if other.NonNull { - return t.NonNull - } - - return true -} - -func (v *Type) Dump() string { - return v.String() -} diff --git a/vendor/github.com/vektah/gqlparser/v2/ast/value.go b/vendor/github.com/vektah/gqlparser/v2/ast/value.go deleted file mode 100644 index c25ef15059..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/ast/value.go +++ /dev/null @@ -1,120 +0,0 @@ -package ast - -import ( - "fmt" - "strconv" - "strings" -) - -type ValueKind int - -const ( - Variable ValueKind = iota - IntValue - FloatValue - StringValue - BlockValue - BooleanValue - NullValue - EnumValue - ListValue - ObjectValue -) - -type Value struct { - Raw string - Children ChildValueList - Kind ValueKind - Position *Position `dump:"-"` - - // Require validation - Definition *Definition - VariableDefinition *VariableDefinition - ExpectedType *Type -} - -type ChildValue struct { - Name string - Value *Value - Position *Position `dump:"-"` -} - -func (v *Value) Value(vars map[string]interface{}) (interface{}, error) { - if v == nil { - return nil, nil - } - switch v.Kind { - case Variable: - if value, ok := vars[v.Raw]; ok { - return value, nil - } - if v.VariableDefinition != nil && v.VariableDefinition.DefaultValue != nil { - return v.VariableDefinition.DefaultValue.Value(vars) - } - return nil, nil - case IntValue: - return strconv.ParseInt(v.Raw, 10, 64) - case FloatValue: - return strconv.ParseFloat(v.Raw, 64) - case StringValue, BlockValue, EnumValue: - return v.Raw, nil - case BooleanValue: - return strconv.ParseBool(v.Raw) - case NullValue: - return nil, nil - case ListValue: - var val []interface{} - for _, elem := range v.Children { - elemVal, err := elem.Value.Value(vars) - if err != nil { - return val, err - } - val = append(val, elemVal) - } - return val, nil - case ObjectValue: - val := map[string]interface{}{} - for _, elem := range v.Children { - elemVal, err := elem.Value.Value(vars) - if err != nil { - return val, err - } - val[elem.Name] = elemVal - } - return val, nil - default: - panic(fmt.Errorf("unknown value kind %d", v.Kind)) - } -} - -func (v *Value) String() string { - if v == nil { - return "" - } - switch v.Kind { - case Variable: - return "$" + v.Raw - case IntValue, FloatValue, EnumValue, BooleanValue, NullValue: - return v.Raw - case StringValue, BlockValue: - return strconv.Quote(v.Raw) - case ListValue: - var val []string - for _, elem := range v.Children { - val = append(val, elem.Value.String()) - } - return "[" + strings.Join(val, ",") + "]" - case ObjectValue: - var val []string - for _, elem := range v.Children { - val = append(val, elem.Name+":"+elem.Value.String()) - } - return "{" + strings.Join(val, ",") + "}" - default: - panic(fmt.Errorf("unknown value kind %d", v.Kind)) - } -} - -func (v *Value) Dump() string { - return v.String() -} diff --git a/vendor/github.com/vektah/gqlparser/v2/gqlerror/error.go b/vendor/github.com/vektah/gqlparser/v2/gqlerror/error.go deleted file mode 100644 index 8145061a22..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/gqlerror/error.go +++ /dev/null @@ -1,145 +0,0 @@ -package gqlerror - -import ( - "bytes" - "errors" - "fmt" - "strconv" - - "github.com/vektah/gqlparser/v2/ast" -) - -// Error is the standard graphql error type described in https://facebook.github.io/graphql/draft/#sec-Errors -type Error struct { - err error `json:"-"` - Message string `json:"message"` - Path ast.Path `json:"path,omitempty"` - Locations []Location `json:"locations,omitempty"` - Extensions map[string]interface{} `json:"extensions,omitempty"` - Rule string `json:"-"` -} - -func (err *Error) SetFile(file string) { - if file == "" { - return - } - if err.Extensions == nil { - err.Extensions = map[string]interface{}{} - } - - err.Extensions["file"] = file -} - -type Location struct { - Line int `json:"line,omitempty"` - Column int `json:"column,omitempty"` -} - -type List []*Error - -func (err *Error) Error() string { - var res bytes.Buffer - if err == nil { - return "" - } - filename, _ := err.Extensions["file"].(string) - if filename == "" { - filename = "input" - } - res.WriteString(filename) - - if len(err.Locations) > 0 { - res.WriteByte(':') - res.WriteString(strconv.Itoa(err.Locations[0].Line)) - } - - res.WriteString(": ") - if ps := err.pathString(); ps != "" { - res.WriteString(ps) - res.WriteByte(' ') - } - - res.WriteString(err.Message) - - return res.String() -} - -func (err Error) pathString() string { - return err.Path.String() -} - -func (err Error) Unwrap() error { - return err.err -} - -func (errs List) Error() string { - var buf bytes.Buffer - for _, err := range errs { - buf.WriteString(err.Error()) - buf.WriteByte('\n') - } - return buf.String() -} - -func (errs List) Is(target error) bool { - for _, err := range errs { - if errors.Is(err, target) { - return true - } - } - return false -} - -func (errs List) As(target interface{}) bool { - for _, err := range errs { - if errors.As(err, target) { - return true - } - } - return false -} - -func WrapPath(path ast.Path, err error) *Error { - return &Error{ - err: err, - Message: err.Error(), - Path: path, - } -} - -func Errorf(message string, args ...interface{}) *Error { - return &Error{ - Message: fmt.Sprintf(message, args...), - } -} - -func ErrorPathf(path ast.Path, message string, args ...interface{}) *Error { - return &Error{ - Message: fmt.Sprintf(message, args...), - Path: path, - } -} - -func ErrorPosf(pos *ast.Position, message string, args ...interface{}) *Error { - return ErrorLocf( - pos.Src.Name, - pos.Line, - pos.Column, - message, - args..., - ) -} - -func ErrorLocf(file string, line int, col int, message string, args ...interface{}) *Error { - var extensions map[string]interface{} - if file != "" { - extensions = map[string]interface{}{"file": file} - } - return &Error{ - Message: fmt.Sprintf(message, args...), - Extensions: extensions, - Locations: []Location{ - {Line: line, Column: col}, - }, - } -} diff --git a/vendor/github.com/vektah/gqlparser/v2/gqlparser.go b/vendor/github.com/vektah/gqlparser/v2/gqlparser.go deleted file mode 100644 index e242a896b4..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/gqlparser.go +++ /dev/null @@ -1,43 +0,0 @@ -package gqlparser - -import ( - "github.com/vektah/gqlparser/v2/ast" - "github.com/vektah/gqlparser/v2/gqlerror" - "github.com/vektah/gqlparser/v2/parser" - "github.com/vektah/gqlparser/v2/validator" - _ "github.com/vektah/gqlparser/v2/validator/rules" -) - -func LoadSchema(str ...*ast.Source) (*ast.Schema, error) { - return validator.LoadSchema(append([]*ast.Source{validator.Prelude}, str...)...) -} - -func MustLoadSchema(str ...*ast.Source) *ast.Schema { - s, err := validator.LoadSchema(append([]*ast.Source{validator.Prelude}, str...)...) - if err != nil { - panic(err) - } - return s -} - -func LoadQuery(schema *ast.Schema, str string) (*ast.QueryDocument, gqlerror.List) { - query, err := parser.ParseQuery(&ast.Source{Input: str}) - if err != nil { - gqlErr := err.(*gqlerror.Error) - return nil, gqlerror.List{gqlErr} - } - errs := validator.Validate(schema, query) - if errs != nil { - return nil, errs - } - - return query, nil -} - -func MustLoadQuery(schema *ast.Schema, str string) *ast.QueryDocument { - q, err := LoadQuery(schema, str) - if err != nil { - panic(err) - } - return q -} diff --git a/vendor/github.com/vektah/gqlparser/v2/lexer/blockstring.go b/vendor/github.com/vektah/gqlparser/v2/lexer/blockstring.go deleted file mode 100644 index 4065a610a8..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/lexer/blockstring.go +++ /dev/null @@ -1,58 +0,0 @@ -package lexer - -import ( - "math" - "strings" -) - -// blockStringValue produces the value of a block string from its parsed raw value, similar to -// Coffeescript's block string, Python's docstring trim or Ruby's strip_heredoc. -// -// This implements the GraphQL spec's BlockStringValue() static algorithm. -func blockStringValue(raw string) string { - lines := strings.Split(raw, "\n") - - commonIndent := math.MaxInt32 - for _, line := range lines { - indent := leadingWhitespace(line) - if indent < len(line) && indent < commonIndent { - commonIndent = indent - if commonIndent == 0 { - break - } - } - } - - if commonIndent != math.MaxInt32 && len(lines) > 0 { - for i := 1; i < len(lines); i++ { - if len(lines[i]) < commonIndent { - lines[i] = "" - } else { - lines[i] = lines[i][commonIndent:] - } - } - } - - start := 0 - end := len(lines) - - for start < end && leadingWhitespace(lines[start]) == math.MaxInt32 { - start++ - } - - for start < end && leadingWhitespace(lines[end-1]) == math.MaxInt32 { - end-- - } - - return strings.Join(lines[start:end], "\n") -} - -func leadingWhitespace(str string) int { - for i, r := range str { - if r != ' ' && r != '\t' { - return i - } - } - // this line is made up entirely of whitespace, its leading whitespace doesnt count. - return math.MaxInt32 -} diff --git a/vendor/github.com/vektah/gqlparser/v2/lexer/lexer.go b/vendor/github.com/vektah/gqlparser/v2/lexer/lexer.go deleted file mode 100644 index 25dcdcb9c4..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/lexer/lexer.go +++ /dev/null @@ -1,515 +0,0 @@ -package lexer - -import ( - "bytes" - "unicode/utf8" - - "github.com/vektah/gqlparser/v2/ast" - "github.com/vektah/gqlparser/v2/gqlerror" -) - -// Lexer turns graphql request and schema strings into tokens -type Lexer struct { - *ast.Source - // An offset into the string in bytes - start int - // An offset into the string in runes - startRunes int - // An offset into the string in bytes - end int - // An offset into the string in runes - endRunes int - // the current line number - line int - // An offset into the string in rune - lineStartRunes int -} - -func New(src *ast.Source) Lexer { - return Lexer{ - Source: src, - line: 1, - } -} - -// take one rune from input and advance end -func (s *Lexer) peek() (rune, int) { - return utf8.DecodeRuneInString(s.Input[s.end:]) -} - -func (s *Lexer) makeToken(kind Type) (Token, error) { - return s.makeValueToken(kind, s.Input[s.start:s.end]) -} - -func (s *Lexer) makeValueToken(kind Type, value string) (Token, error) { - return Token{ - Kind: kind, - Value: value, - Pos: ast.Position{ - Start: s.startRunes, - End: s.endRunes, - Line: s.line, - Column: s.startRunes - s.lineStartRunes + 1, - Src: s.Source, - }, - }, nil -} - -func (s *Lexer) makeError(format string, args ...interface{}) (Token, error) { - column := s.endRunes - s.lineStartRunes + 1 - return Token{ - Kind: Invalid, - Pos: ast.Position{ - Start: s.startRunes, - End: s.endRunes, - Line: s.line, - Column: column, - Src: s.Source, - }, - }, gqlerror.ErrorLocf(s.Source.Name, s.line, column, format, args...) -} - -// ReadToken gets the next token from the source starting at the given position. -// -// This skips over whitespace and comments until it finds the next lexable -// token, then lexes punctuators immediately or calls the appropriate helper -// function for more complicated tokens. -func (s *Lexer) ReadToken() (token Token, err error) { - - s.ws() - s.start = s.end - s.startRunes = s.endRunes - - if s.end >= len(s.Input) { - return s.makeToken(EOF) - } - r := s.Input[s.start] - s.end++ - s.endRunes++ - switch r { - case '!': - return s.makeValueToken(Bang, "") - - case '$': - return s.makeValueToken(Dollar, "") - case '&': - return s.makeValueToken(Amp, "") - case '(': - return s.makeValueToken(ParenL, "") - case ')': - return s.makeValueToken(ParenR, "") - case '.': - if len(s.Input) > s.start+2 && s.Input[s.start:s.start+3] == "..." { - s.end += 2 - s.endRunes += 2 - return s.makeValueToken(Spread, "") - } - case ':': - return s.makeValueToken(Colon, "") - case '=': - return s.makeValueToken(Equals, "") - case '@': - return s.makeValueToken(At, "") - case '[': - return s.makeValueToken(BracketL, "") - case ']': - return s.makeValueToken(BracketR, "") - case '{': - return s.makeValueToken(BraceL, "") - case '}': - return s.makeValueToken(BraceR, "") - case '|': - return s.makeValueToken(Pipe, "") - case '#': - s.readComment() - return s.ReadToken() - - case '_', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z': - return s.readName() - - case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - return s.readNumber() - - case '"': - if len(s.Input) > s.start+2 && s.Input[s.start:s.start+3] == `"""` { - return s.readBlockString() - } - - return s.readString() - } - - s.end-- - s.endRunes-- - - if r < 0x0020 && r != 0x0009 && r != 0x000a && r != 0x000d { - return s.makeError(`Cannot contain the invalid character "\u%04d"`, r) - } - - if r == '\'' { - return s.makeError(`Unexpected single quote character ('), did you mean to use a double quote (")?`) - } - - return s.makeError(`Cannot parse the unexpected character "%s".`, string(r)) -} - -// ws reads from body starting at startPosition until it finds a non-whitespace -// or commented character, and updates the token end to include all whitespace -func (s *Lexer) ws() { - for s.end < len(s.Input) { - switch s.Input[s.end] { - case '\t', ' ', ',': - s.end++ - s.endRunes++ - case '\n': - s.end++ - s.endRunes++ - s.line++ - s.lineStartRunes = s.endRunes - case '\r': - s.end++ - s.endRunes++ - s.line++ - s.lineStartRunes = s.endRunes - // skip the following newline if its there - if s.end < len(s.Input) && s.Input[s.end] == '\n' { - s.end++ - s.endRunes++ - } - // byte order mark, given ws is hot path we aren't relying on the unicode package here. - case 0xef: - if s.end+2 < len(s.Input) && s.Input[s.end+1] == 0xBB && s.Input[s.end+2] == 0xBF { - s.end += 3 - s.endRunes++ - } else { - return - } - default: - return - } - } -} - -// readComment from the input -// -// #[\u0009\u0020-\uFFFF]* -func (s *Lexer) readComment() (Token, error) { - for s.end < len(s.Input) { - r, w := s.peek() - - // SourceCharacter but not LineTerminator - if r > 0x001f || r == '\t' { - s.end += w - s.endRunes++ - } else { - break - } - } - - return s.makeToken(Comment) -} - -// readNumber from the input, either a float -// or an int depending on whether a decimal point appears. -// -// Int: -?(0|[1-9][0-9]*) -// Float: -?(0|[1-9][0-9]*)(\.[0-9]+)?((E|e)(+|-)?[0-9]+)? -func (s *Lexer) readNumber() (Token, error) { - float := false - - // backup to the first digit - s.end-- - s.endRunes-- - - s.acceptByte('-') - - if s.acceptByte('0') { - if consumed := s.acceptDigits(); consumed != 0 { - s.end -= consumed - s.endRunes -= consumed - return s.makeError("Invalid number, unexpected digit after 0: %s.", s.describeNext()) - } - } else { - if consumed := s.acceptDigits(); consumed == 0 { - return s.makeError("Invalid number, expected digit but got: %s.", s.describeNext()) - } - } - - if s.acceptByte('.') { - float = true - - if consumed := s.acceptDigits(); consumed == 0 { - return s.makeError("Invalid number, expected digit but got: %s.", s.describeNext()) - } - } - - if s.acceptByte('e', 'E') { - float = true - - s.acceptByte('-', '+') - - if consumed := s.acceptDigits(); consumed == 0 { - return s.makeError("Invalid number, expected digit but got: %s.", s.describeNext()) - } - } - - if float { - return s.makeToken(Float) - } else { - return s.makeToken(Int) - } -} - -// acceptByte if it matches any of given bytes, returning true if it found anything -func (s *Lexer) acceptByte(bytes ...uint8) bool { - if s.end >= len(s.Input) { - return false - } - - for _, accepted := range bytes { - if s.Input[s.end] == accepted { - s.end++ - s.endRunes++ - return true - } - } - return false -} - -// acceptDigits from the input, returning the number of digits it found -func (s *Lexer) acceptDigits() int { - consumed := 0 - for s.end < len(s.Input) && s.Input[s.end] >= '0' && s.Input[s.end] <= '9' { - s.end++ - s.endRunes++ - consumed++ - } - - return consumed -} - -// describeNext peeks at the input and returns a human readable string. This should will alloc -// and should only be used in errors -func (s *Lexer) describeNext() string { - if s.end < len(s.Input) { - return `"` + string(s.Input[s.end]) + `"` - } - return "" -} - -// readString from the input -// -// "([^"\\\u000A\u000D]|(\\(u[0-9a-fA-F]{4}|["\\/bfnrt])))*" -func (s *Lexer) readString() (Token, error) { - inputLen := len(s.Input) - - // this buffer is lazily created only if there are escape characters. - var buf *bytes.Buffer - - // skip the opening quote - s.start++ - s.startRunes++ - - for s.end < inputLen { - r := s.Input[s.end] - if r == '\n' || r == '\r' { - break - } - if r < 0x0020 && r != '\t' { - return s.makeError(`Invalid character within String: "\u%04d".`, r) - } - switch r { - default: - var char = rune(r) - var w = 1 - - // skip unicode overhead if we are in the ascii range - if r >= 127 { - char, w = utf8.DecodeRuneInString(s.Input[s.end:]) - } - s.end += w - s.endRunes++ - - if buf != nil { - buf.WriteRune(char) - } - - case '"': - t, err := s.makeToken(String) - // the token should not include the quotes in its value, but should cover them in its position - t.Pos.Start-- - t.Pos.End++ - - if buf != nil { - t.Value = buf.String() - } - - // skip the close quote - s.end++ - s.endRunes++ - - return t, err - - case '\\': - if s.end+1 >= inputLen { - s.end++ - s.endRunes++ - return s.makeError(`Invalid character escape sequence.`) - } - - if buf == nil { - buf = bytes.NewBufferString(s.Input[s.start:s.end]) - } - - escape := s.Input[s.end+1] - - if escape == 'u' { - if s.end+6 >= inputLen { - s.end++ - s.endRunes++ - return s.makeError("Invalid character escape sequence: \\%s.", s.Input[s.end:]) - } - - r, ok := unhex(s.Input[s.end+2 : s.end+6]) - if !ok { - s.end++ - s.endRunes++ - return s.makeError("Invalid character escape sequence: \\%s.", s.Input[s.end:s.end+5]) - } - buf.WriteRune(r) - s.end += 6 - s.endRunes += 6 - } else { - switch escape { - case '"', '/', '\\': - buf.WriteByte(escape) - case 'b': - buf.WriteByte('\b') - case 'f': - buf.WriteByte('\f') - case 'n': - buf.WriteByte('\n') - case 'r': - buf.WriteByte('\r') - case 't': - buf.WriteByte('\t') - default: - s.end += 1 - s.endRunes += 1 - return s.makeError("Invalid character escape sequence: \\%s.", string(escape)) - } - s.end += 2 - s.endRunes += 2 - } - } - } - - return s.makeError("Unterminated string.") -} - -// readBlockString from the input -// -// """("?"?(\\"""|\\(?!=""")|[^"\\]))*""" -func (s *Lexer) readBlockString() (Token, error) { - inputLen := len(s.Input) - - var buf bytes.Buffer - - // skip the opening quote - s.start += 3 - s.startRunes += 3 - s.end += 2 - s.endRunes += 2 - - for s.end < inputLen { - r := s.Input[s.end] - - // Closing triple quote (""") - if r == '"' && s.end+3 <= inputLen && s.Input[s.end:s.end+3] == `"""` { - t, err := s.makeValueToken(BlockString, blockStringValue(buf.String())) - - // the token should not include the quotes in its value, but should cover them in its position - t.Pos.Start -= 3 - t.Pos.End += 3 - - // skip the close quote - s.end += 3 - s.endRunes += 3 - return t, err - } - - // SourceCharacter - if r < 0x0020 && r != '\t' && r != '\n' && r != '\r' { - return s.makeError(`Invalid character within String: "\u%04d".`, r) - } - - if r == '\\' && s.end+4 <= inputLen && s.Input[s.end:s.end+4] == `\"""` { - buf.WriteString(`"""`) - s.end += 4 - s.endRunes += 4 - } else if r == '\r' { - if s.end+1 < inputLen && s.Input[s.end+1] == '\n' { - s.end++ - s.endRunes++ - } - - buf.WriteByte('\n') - s.end++ - s.endRunes++ - s.line++ - s.lineStartRunes = s.endRunes - } else { - var char = rune(r) - var w = 1 - - // skip unicode overhead if we are in the ascii range - if r >= 127 { - char, w = utf8.DecodeRuneInString(s.Input[s.end:]) - } - s.end += w - s.endRunes++ - buf.WriteRune(char) - if r == '\n' { - s.line++ - s.lineStartRunes = s.endRunes - } - } - } - - return s.makeError("Unterminated string.") -} - -func unhex(b string) (v rune, ok bool) { - for _, c := range b { - v <<= 4 - switch { - case '0' <= c && c <= '9': - v |= c - '0' - case 'a' <= c && c <= 'f': - v |= c - 'a' + 10 - case 'A' <= c && c <= 'F': - v |= c - 'A' + 10 - default: - return 0, false - } - } - - return v, true -} - -// readName from the input -// -// [_A-Za-z][_0-9A-Za-z]* -func (s *Lexer) readName() (Token, error) { - for s.end < len(s.Input) { - r, w := s.peek() - - if (r >= '0' && r <= '9') || (r >= 'A' && r <= 'Z') || (r >= 'a' && r <= 'z') || r == '_' { - s.end += w - s.endRunes++ - } else { - break - } - } - - return s.makeToken(Name) -} diff --git a/vendor/github.com/vektah/gqlparser/v2/lexer/lexer_test.yml b/vendor/github.com/vektah/gqlparser/v2/lexer/lexer_test.yml deleted file mode 100644 index 5c4d5f0ff5..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/lexer/lexer_test.yml +++ /dev/null @@ -1,692 +0,0 @@ -encoding: - - name: disallows uncommon control characters - input: "\u0007" - error: - message: 'Cannot contain the invalid character "\u0007"' - locations: [{line: 1, column: 1}] - - - name: accepts BOM header - input: "\uFEFF foo" - tokens: - - - kind: NAME - start: 2 - end: 5 - value: 'foo' - -simple tokens: - - name: records line and column - input: "\n \r\n \r foo\n" - tokens: - - - kind: NAME - start: 8 - end: 11 - line: 4 - column: 3 - value: 'foo' - - - name: skips whitespace - input: "\n\n foo\n\n\n" - tokens: - - - kind: NAME - start: 6 - end: 9 - value: 'foo' - - - name: skips comments - input: "\n #comment\n foo#comment\n" - tokens: - - - kind: NAME - start: 18 - end: 21 - value: 'foo' - - - name: skips commas - input: ",,,foo,,," - tokens: - - - kind: NAME - start: 3 - end: 6 - value: 'foo' - - - name: errors respect whitespace - input: "\n\n ?\n\n\n" - error: - message: 'Cannot parse the unexpected character "?".' - locations: [{line: 3, column: 5}] - string: | - Syntax Error: Cannot parse the unexpected character "?". - GraphQL request (3:5) - 2: - 3: ? - ^ - 4: - - - name: lex reports useful information for dashes in names - input: "a-b" - error: - message: 'Invalid number, expected digit but got: "b".' - locations: [{ line: 1, column: 3 }] - tokens: - - - kind: Name - start: 0 - end: 1 - value: a - -lexes strings: - - name: basic - input: '"simple"' - tokens: - - - kind: STRING - start: 0 - end: 8 - value: 'simple' - - - name: whitespace - input: '" white space "' - tokens: - - - kind: STRING - start: 0 - end: 15 - value: ' white space ' - - - name: quote - input: '"quote \""' - tokens: - - - kind: STRING - start: 0 - end: 10 - value: 'quote "' - - - name: escaped - input: '"escaped \n\r\b\t\f"' - tokens: - - - kind: STRING - start: 0 - end: 20 - value: "escaped \n\r\b\t\f" - - - name: slashes - input: '"slashes \\ \/"' - tokens: - - - kind: STRING - start: 0 - end: 15 - value: 'slashes \ /' - - - name: unicode - input: '"unicode \u1234\u5678\u90AB\uCDEF"' - tokens: - - - kind: STRING - start: 0 - end: 34 - value: "unicode \u1234\u5678\u90AB\uCDEF" - -lex reports useful string errors: - - name: unterminated - input: '"' - error: - message: "Unterminated string." - locations: [{ line: 1, column: 2 }] - - - name: no end quote - input: '"no end quote' - error: - message: 'Unterminated string.' - locations: [{ line: 1, column: 14 }] - - - name: single quotes - input: "'single quotes'" - error: - message: "Unexpected single quote character ('), did you mean to use a double quote (\")?" - locations: [{ line: 1, column: 1 }] - - - name: control characters - input: "\"contains unescaped \u0007 control char\"" - error: - message: 'Invalid character within String: "\u0007".' - locations: [{ line: 1, column: 21 }] - - - name: null byte - input: "\"null-byte is not \u0000 end of file\"" - error: - message: 'Invalid character within String: "\u0000".' - locations: [{ line: 1, column: 19 }] - - - name: unterminated newline - input: "\"multi\nline\"" - error: - message: 'Unterminated string.' - locations: [{line: 1, column: 7 }] - - - name: unterminated carriage return - input: "\"multi\rline\"" - error: - message: 'Unterminated string.' - locations: [{ line: 1, column: 7 }] - - - name: bad escape character - input: '"bad \z esc"' - error: - message: 'Invalid character escape sequence: \z.' - locations: [{ line: 1, column: 7 }] - - - name: hex escape sequence - input: '"bad \x esc"' - error: - message: 'Invalid character escape sequence: \x.' - locations: [{ line: 1, column: 7 }] - - - name: short escape sequence - input: '"bad \u1 esc"' - error: - message: 'Invalid character escape sequence: \u1 es.' - locations: [{ line: 1, column: 7 }] - - - name: invalid escape sequence 1 - input: '"bad \u0XX1 esc"' - error: - message: 'Invalid character escape sequence: \u0XX1.' - locations: [{ line: 1, column: 7 }] - - - name: invalid escape sequence 2 - input: '"bad \uXXXX esc"' - error: - message: 'Invalid character escape sequence: \uXXXX.' - locations: [{ line: 1, column: 7 }] - - - name: invalid escape sequence 3 - input: '"bad \uFXXX esc"' - error: - message: 'Invalid character escape sequence: \uFXXX.' - locations: [{ line: 1, column: 7 }] - - - name: invalid character escape sequence - input: '"bad \uXXXF esc"' - error: - message: 'Invalid character escape sequence: \uXXXF.' - locations: [{ line: 1, column: 7 }] - -lexes block strings: - - name: simple - input: '"""simple"""' - tokens: - - - kind: BLOCK_STRING - start: 0 - end: 12 - value: 'simple' - - - name: white space - input: '""" white space """' - tokens: - - - kind: BLOCK_STRING - start: 0 - end: 19 - value: ' white space ' - - - name: contains quote - input: '"""contains " quote"""' - tokens: - - - kind: BLOCK_STRING - start: 0 - end: 22 - value: 'contains " quote' - - - name: contains triplequote - input: "\"\"\"contains \\\"\"\" triplequote\"\"\"" - tokens: - - - kind: BLOCK_STRING - start: 0 - end: 31 - value: 'contains """ triplequote' - - - name: multi line - input: "\"\"\"multi\nline\"\"\"" - tokens: - - - kind: BLOCK_STRING - start: 0 - end: 16 - value: "multi\nline" - - - name: multi line normalized - input: "\"\"\"multi\rline\r\nnormalized\"\"\"" - tokens: - - - kind: BLOCK_STRING - start: 0 - end: 28 - value: "multi\nline\nnormalized" - - - name: unescaped - input: '"""unescaped \n\r\b\t\f\u1234"""' - tokens: - - - kind: BLOCK_STRING - start: 0 - end: 32 - value: 'unescaped \n\r\b\t\f\u1234' - - - name: slashes - input: '"""slashes \\ \/"""' - tokens: - - - kind: BLOCK_STRING - start: 0 - end: 19 - value: 'slashes \\ \/' - - - name: multiple lines - input: | - """ - - spans - multiple - lines - - """ - tokens: - - - kind: BLOCK_STRING - start: 0 - end: 36 - value: "spans\n multiple\n lines" - - - name: records correct line and column after block string - input: | - """ - - some - description - - """ foo - tokens: - - - kind: BLOCK_STRING - value: "some\ndescription" - - - kind: NAME - start: 27 - end: 30 - line: 6 - column: 5 - value: 'foo' - -lex reports useful block string errors: - - name: unterminated string - input: '"""' - error: - message: "Unterminated string." - locations: [{ line: 1, column: 4 }] - - - name: unescaped control characters - input: "\"\"\"contains unescaped \u0007 control char\"\"\"" - error: - message: 'Invalid character within String: "\u0007".' - locations: [{ line: 1, column: 23 }] - - - name: null byte - input: "\"\"\"null-byte is not \u0000 end of file\"\"\"" - error: - message: 'Invalid character within String: "\u0000".' - locations: [{ line: 1, column: 21 }] - -lexes numbers: - - name: integer - input: "4" - tokens: - - - kind: INT - start: 0 - end: 1 - value: '4' - - - name: float - input: "4.123" - tokens: - - - kind: FLOAT - start: 0 - end: 5 - value: '4.123' - - - name: negative - input: "-4" - tokens: - - - kind: INT - start: 0 - end: 2 - value: '-4' - - - name: nine - input: "9" - tokens: - - - kind: INT - start: 0 - end: 1 - value: '9' - - - name: zero - input: "0" - tokens: - - - kind: INT - start: 0 - end: 1 - value: '0' - - - name: negative float - input: "-4.123" - tokens: - - - kind: FLOAT - start: 0 - end: 6 - value: '-4.123' - - - name: float leading zero - input: "0.123" - tokens: - - - kind: FLOAT - start: 0 - end: 5 - value: '0.123' - - - name: exponent whole - input: "123e4" - tokens: - - - kind: FLOAT - start: 0 - end: 5 - value: '123e4' - - - name: exponent uppercase - input: "123E4" - tokens: - - - kind: FLOAT - start: 0 - end: 5 - value: '123E4' - - - name: exponent negative power - input: "123e-4" - tokens: - - - kind: FLOAT - start: 0 - end: 6 - value: '123e-4' - - - name: exponent positive power - input: "123e+4" - tokens: - - - kind: FLOAT - start: 0 - end: 6 - value: '123e+4' - - - name: exponent negative base - input: "-1.123e4" - tokens: - - - kind: FLOAT - start: 0 - end: 8 - value: '-1.123e4' - - - name: exponent negative base upper - input: "-1.123E4" - tokens: - - - kind: FLOAT - start: 0 - end: 8 - value: '-1.123E4' - - - name: exponent negative base negative power - input: "-1.123e-4" - tokens: - - - kind: FLOAT - start: 0 - end: 9 - value: '-1.123e-4' - - - name: exponent negative base positive power - input: "-1.123e+4" - tokens: - - - kind: FLOAT - start: 0 - end: 9 - value: '-1.123e+4' - - - name: exponent negative base large power - input: "-1.123e4567" - tokens: - - - kind: FLOAT - start: 0 - end: 11 - value: '-1.123e4567' - -lex reports useful number errors: - - name: zero - input: "00" - error: - message: 'Invalid number, unexpected digit after 0: "0".' - locations: [{ line: 1, column: 2 }] - - - name: positive - input: "+1" - error: - message: 'Cannot parse the unexpected character "+".' - locations: [{ line: 1, column: 1 }] - - - name: trailing dot - input: "1." - error: - message: 'Invalid number, expected digit but got: .' - locations: [{ line: 1, column: 3 }] - - - name: traililng dot exponent - input: "1.e1" - error: - message: 'Invalid number, expected digit but got: "e".' - locations: [{ line: 1, column: 3 }] - - - name: missing leading zero - input: ".123" - error: - message: 'Cannot parse the unexpected character ".".' - locations: [{ line: 1, column: 1 }] - - - name: characters - input: "1.A" - error: - message: 'Invalid number, expected digit but got: "A".' - locations: [{ line: 1, column: 3 }] - - - name: negative characters - input: "-A" - error: - message: 'Invalid number, expected digit but got: "A".' - locations: [{ line: 1, column: 2 }] - - - name: missing exponent - input: '1.0e' - error: - message: 'Invalid number, expected digit but got: .' - locations: [{ line: 1, column: 5 }] - - - name: character exponent - input: "1.0eA" - error: - message: 'Invalid number, expected digit but got: "A".' - locations: [{ line: 1, column: 5 }] - -lexes punctuation: - - name: bang - input: "!" - tokens: - - - kind: BANG - start: 0 - end: 1 - value: undefined - - - name: dollar - input: "$" - tokens: - - - kind: DOLLAR - start: 0 - end: 1 - value: undefined - - - name: open paren - input: "(" - tokens: - - - kind: PAREN_L - start: 0 - end: 1 - value: undefined - - - name: close paren - input: ")" - tokens: - - - kind: PAREN_R - start: 0 - end: 1 - value: undefined - - - name: spread - input: "..." - tokens: - - - kind: SPREAD - start: 0 - end: 3 - value: undefined - - - name: colon - input: ":" - tokens: - - - kind: COLON - start: 0 - end: 1 - value: undefined - - - name: equals - input: "=" - tokens: - - - kind: EQUALS - start: 0 - end: 1 - value: undefined - - - name: at - input: "@" - tokens: - - - kind: AT - start: 0 - end: 1 - value: undefined - - - name: open bracket - input: "[" - tokens: - - - kind: BRACKET_L - start: 0 - end: 1 - value: undefined - - - name: close bracket - input: "]" - tokens: - - - kind: BRACKET_R - start: 0 - end: 1 - value: undefined - - - name: open brace - input: "{" - tokens: - - - kind: BRACE_L - start: 0 - end: 1 - value: undefined - - - name: close brace - input: "}" - tokens: - - - kind: BRACE_R - start: 0 - end: 1 - value: undefined - - - name: pipe - input: "|" - tokens: - - - kind: PIPE - start: 0 - end: 1 - value: undefined - -lex reports useful unknown character error: - - name: not a spread - input: ".." - error: - message: 'Cannot parse the unexpected character ".".' - locations: [{ line: 1, column: 1 }] - - - name: question mark - input: "?" - error: - message: 'Cannot parse the unexpected character "?".' - message: 'Cannot parse the unexpected character "?".' - locations: [{ line: 1, column: 1 }] - - - name: unicode 203 - input: "\u203B" - error: - message: 'Cannot parse the unexpected character "â".' - locations: [{ line: 1, column: 1 }] - - - name: unicode 200 - input: "\u200b" - error: - message: 'Cannot parse the unexpected character "â".' - locations: [{ line: 1, column: 1 }] - diff --git a/vendor/github.com/vektah/gqlparser/v2/lexer/token.go b/vendor/github.com/vektah/gqlparser/v2/lexer/token.go deleted file mode 100644 index 8985a7efb7..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/lexer/token.go +++ /dev/null @@ -1,148 +0,0 @@ -package lexer - -import ( - "strconv" - - "github.com/vektah/gqlparser/v2/ast" -) - -const ( - Invalid Type = iota - EOF - Bang - Dollar - Amp - ParenL - ParenR - Spread - Colon - Equals - At - BracketL - BracketR - BraceL - BraceR - Pipe - Name - Int - Float - String - BlockString - Comment -) - -func (t Type) Name() string { - switch t { - case Invalid: - return "Invalid" - case EOF: - return "EOF" - case Bang: - return "Bang" - case Dollar: - return "Dollar" - case Amp: - return "Amp" - case ParenL: - return "ParenL" - case ParenR: - return "ParenR" - case Spread: - return "Spread" - case Colon: - return "Colon" - case Equals: - return "Equals" - case At: - return "At" - case BracketL: - return "BracketL" - case BracketR: - return "BracketR" - case BraceL: - return "BraceL" - case BraceR: - return "BraceR" - case Pipe: - return "Pipe" - case Name: - return "Name" - case Int: - return "Int" - case Float: - return "Float" - case String: - return "String" - case BlockString: - return "BlockString" - case Comment: - return "Comment" - } - return "Unknown " + strconv.Itoa(int(t)) -} - -func (t Type) String() string { - switch t { - case Invalid: - return "" - case EOF: - return "" - case Bang: - return "!" - case Dollar: - return "$" - case Amp: - return "&" - case ParenL: - return "(" - case ParenR: - return ")" - case Spread: - return "..." - case Colon: - return ":" - case Equals: - return "=" - case At: - return "@" - case BracketL: - return "[" - case BracketR: - return "]" - case BraceL: - return "{" - case BraceR: - return "}" - case Pipe: - return "|" - case Name: - return "Name" - case Int: - return "Int" - case Float: - return "Float" - case String: - return "String" - case BlockString: - return "BlockString" - case Comment: - return "Comment" - } - return "Unknown " + strconv.Itoa(int(t)) -} - -// Kind represents a type of token. The types are predefined as constants. -type Type int - -type Token struct { - Kind Type // The token type. - Value string // The literal value consumed. - Pos ast.Position // The file and line this token was read from -} - -func (t Token) String() string { - if t.Value != "" { - return t.Kind.String() + " " + strconv.Quote(t.Value) - } - return t.Kind.String() -} diff --git a/vendor/github.com/vektah/gqlparser/v2/parser/parser.go b/vendor/github.com/vektah/gqlparser/v2/parser/parser.go deleted file mode 100644 index 68eb51edc6..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/parser/parser.go +++ /dev/null @@ -1,136 +0,0 @@ -package parser - -import ( - "strconv" - - "github.com/vektah/gqlparser/v2/ast" - "github.com/vektah/gqlparser/v2/gqlerror" - "github.com/vektah/gqlparser/v2/lexer" -) - -type parser struct { - lexer lexer.Lexer - err error - - peeked bool - peekToken lexer.Token - peekError error - - prev lexer.Token -} - -func (p *parser) peekPos() *ast.Position { - if p.err != nil { - return nil - } - - peek := p.peek() - return &peek.Pos -} - -func (p *parser) peek() lexer.Token { - if p.err != nil { - return p.prev - } - - if !p.peeked { - p.peekToken, p.peekError = p.lexer.ReadToken() - p.peeked = true - } - - return p.peekToken -} - -func (p *parser) error(tok lexer.Token, format string, args ...interface{}) { - if p.err != nil { - return - } - p.err = gqlerror.ErrorLocf(tok.Pos.Src.Name, tok.Pos.Line, tok.Pos.Column, format, args...) -} - -func (p *parser) next() lexer.Token { - if p.err != nil { - return p.prev - } - if p.peeked { - p.peeked = false - p.prev, p.err = p.peekToken, p.peekError - } else { - p.prev, p.err = p.lexer.ReadToken() - } - return p.prev -} - -func (p *parser) expectKeyword(value string) lexer.Token { - tok := p.peek() - if tok.Kind == lexer.Name && tok.Value == value { - return p.next() - } - - p.error(tok, "Expected %s, found %s", strconv.Quote(value), tok.String()) - return tok -} - -func (p *parser) expect(kind lexer.Type) lexer.Token { - tok := p.peek() - if tok.Kind == kind { - return p.next() - } - - p.error(tok, "Expected %s, found %s", kind, tok.Kind.String()) - return tok -} - -func (p *parser) skip(kind lexer.Type) bool { - if p.err != nil { - return false - } - - tok := p.peek() - - if tok.Kind != kind { - return false - } - p.next() - return true -} - -func (p *parser) unexpectedError() { - p.unexpectedToken(p.peek()) -} - -func (p *parser) unexpectedToken(tok lexer.Token) { - p.error(tok, "Unexpected %s", tok.String()) -} - -func (p *parser) many(start lexer.Type, end lexer.Type, cb func()) { - hasDef := p.skip(start) - if !hasDef { - return - } - - for p.peek().Kind != end && p.err == nil { - cb() - } - p.next() -} - -func (p *parser) some(start lexer.Type, end lexer.Type, cb func()) { - hasDef := p.skip(start) - if !hasDef { - return - } - - called := false - for p.peek().Kind != end && p.err == nil { - called = true - cb() - } - - if !called { - p.error(p.peek(), "expected at least one definition, found %s", p.peek().Kind.String()) - return - } - - p.next() -} diff --git a/vendor/github.com/vektah/gqlparser/v2/parser/query.go b/vendor/github.com/vektah/gqlparser/v2/parser/query.go deleted file mode 100644 index a38d982acb..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/parser/query.go +++ /dev/null @@ -1,348 +0,0 @@ -package parser - -import ( - "github.com/vektah/gqlparser/v2/lexer" - - . "github.com/vektah/gqlparser/v2/ast" -) - -func ParseQuery(source *Source) (*QueryDocument, error) { - p := parser{ - lexer: lexer.New(source), - } - return p.parseQueryDocument(), p.err -} - -func (p *parser) parseQueryDocument() *QueryDocument { - var doc QueryDocument - for p.peek().Kind != lexer.EOF { - if p.err != nil { - return &doc - } - doc.Position = p.peekPos() - switch p.peek().Kind { - case lexer.Name: - switch p.peek().Value { - case "query", "mutation", "subscription": - doc.Operations = append(doc.Operations, p.parseOperationDefinition()) - case "fragment": - doc.Fragments = append(doc.Fragments, p.parseFragmentDefinition()) - default: - p.unexpectedError() - } - case lexer.BraceL: - doc.Operations = append(doc.Operations, p.parseOperationDefinition()) - default: - p.unexpectedError() - } - } - - return &doc -} - -func (p *parser) parseOperationDefinition() *OperationDefinition { - if p.peek().Kind == lexer.BraceL { - return &OperationDefinition{ - Position: p.peekPos(), - Operation: Query, - SelectionSet: p.parseRequiredSelectionSet(), - } - } - - var od OperationDefinition - od.Position = p.peekPos() - od.Operation = p.parseOperationType() - - if p.peek().Kind == lexer.Name { - od.Name = p.next().Value - } - - od.VariableDefinitions = p.parseVariableDefinitions() - od.Directives = p.parseDirectives(false) - od.SelectionSet = p.parseRequiredSelectionSet() - - return &od -} - -func (p *parser) parseOperationType() Operation { - tok := p.next() - switch tok.Value { - case "query": - return Query - case "mutation": - return Mutation - case "subscription": - return Subscription - } - p.unexpectedToken(tok) - return "" -} - -func (p *parser) parseVariableDefinitions() VariableDefinitionList { - var defs []*VariableDefinition - p.many(lexer.ParenL, lexer.ParenR, func() { - defs = append(defs, p.parseVariableDefinition()) - }) - - return defs -} - -func (p *parser) parseVariableDefinition() *VariableDefinition { - var def VariableDefinition - def.Position = p.peekPos() - def.Variable = p.parseVariable() - - p.expect(lexer.Colon) - - def.Type = p.parseTypeReference() - - if p.skip(lexer.Equals) { - def.DefaultValue = p.parseValueLiteral(true) - } - - def.Directives = p.parseDirectives(false) - - return &def -} - -func (p *parser) parseVariable() string { - p.expect(lexer.Dollar) - return p.parseName() -} - -func (p *parser) parseOptionalSelectionSet() SelectionSet { - var selections []Selection - p.some(lexer.BraceL, lexer.BraceR, func() { - selections = append(selections, p.parseSelection()) - }) - - return SelectionSet(selections) -} - -func (p *parser) parseRequiredSelectionSet() SelectionSet { - if p.peek().Kind != lexer.BraceL { - p.error(p.peek(), "Expected %s, found %s", lexer.BraceL, p.peek().Kind.String()) - return nil - } - - var selections []Selection - p.some(lexer.BraceL, lexer.BraceR, func() { - selections = append(selections, p.parseSelection()) - }) - - return SelectionSet(selections) -} - -func (p *parser) parseSelection() Selection { - if p.peek().Kind == lexer.Spread { - return p.parseFragment() - } - return p.parseField() -} - -func (p *parser) parseField() *Field { - var field Field - field.Position = p.peekPos() - field.Alias = p.parseName() - - if p.skip(lexer.Colon) { - field.Name = p.parseName() - } else { - field.Name = field.Alias - } - - field.Arguments = p.parseArguments(false) - field.Directives = p.parseDirectives(false) - if p.peek().Kind == lexer.BraceL { - field.SelectionSet = p.parseOptionalSelectionSet() - } - - return &field -} - -func (p *parser) parseArguments(isConst bool) ArgumentList { - var arguments ArgumentList - p.many(lexer.ParenL, lexer.ParenR, func() { - arguments = append(arguments, p.parseArgument(isConst)) - }) - - return arguments -} - -func (p *parser) parseArgument(isConst bool) *Argument { - arg := Argument{} - arg.Position = p.peekPos() - arg.Name = p.parseName() - p.expect(lexer.Colon) - - arg.Value = p.parseValueLiteral(isConst) - return &arg -} - -func (p *parser) parseFragment() Selection { - p.expect(lexer.Spread) - - if peek := p.peek(); peek.Kind == lexer.Name && peek.Value != "on" { - return &FragmentSpread{ - Position: p.peekPos(), - Name: p.parseFragmentName(), - Directives: p.parseDirectives(false), - } - } - - var def InlineFragment - def.Position = p.peekPos() - if p.peek().Value == "on" { - p.next() // "on" - - def.TypeCondition = p.parseName() - } - - def.Directives = p.parseDirectives(false) - def.SelectionSet = p.parseRequiredSelectionSet() - return &def -} - -func (p *parser) parseFragmentDefinition() *FragmentDefinition { - var def FragmentDefinition - def.Position = p.peekPos() - p.expectKeyword("fragment") - - def.Name = p.parseFragmentName() - def.VariableDefinition = p.parseVariableDefinitions() - - p.expectKeyword("on") - - def.TypeCondition = p.parseName() - def.Directives = p.parseDirectives(false) - def.SelectionSet = p.parseRequiredSelectionSet() - return &def -} - -func (p *parser) parseFragmentName() string { - if p.peek().Value == "on" { - p.unexpectedError() - return "" - } - - return p.parseName() -} - -func (p *parser) parseValueLiteral(isConst bool) *Value { - token := p.peek() - - var kind ValueKind - switch token.Kind { - case lexer.BracketL: - return p.parseList(isConst) - case lexer.BraceL: - return p.parseObject(isConst) - case lexer.Dollar: - if isConst { - p.unexpectedError() - return nil - } - return &Value{Position: &token.Pos, Raw: p.parseVariable(), Kind: Variable} - case lexer.Int: - kind = IntValue - case lexer.Float: - kind = FloatValue - case lexer.String: - kind = StringValue - case lexer.BlockString: - kind = BlockValue - case lexer.Name: - switch token.Value { - case "true", "false": - kind = BooleanValue - case "null": - kind = NullValue - default: - kind = EnumValue - } - default: - p.unexpectedError() - return nil - } - - p.next() - - return &Value{Position: &token.Pos, Raw: token.Value, Kind: kind} -} - -func (p *parser) parseList(isConst bool) *Value { - var values ChildValueList - pos := p.peekPos() - p.many(lexer.BracketL, lexer.BracketR, func() { - values = append(values, &ChildValue{Value: p.parseValueLiteral(isConst)}) - }) - - return &Value{Children: values, Kind: ListValue, Position: pos} -} - -func (p *parser) parseObject(isConst bool) *Value { - var fields ChildValueList - pos := p.peekPos() - p.many(lexer.BraceL, lexer.BraceR, func() { - fields = append(fields, p.parseObjectField(isConst)) - }) - - return &Value{Children: fields, Kind: ObjectValue, Position: pos} -} - -func (p *parser) parseObjectField(isConst bool) *ChildValue { - field := ChildValue{} - field.Position = p.peekPos() - field.Name = p.parseName() - - p.expect(lexer.Colon) - - field.Value = p.parseValueLiteral(isConst) - return &field -} - -func (p *parser) parseDirectives(isConst bool) []*Directive { - var directives []*Directive - - for p.peek().Kind == lexer.At { - if p.err != nil { - break - } - directives = append(directives, p.parseDirective(isConst)) - } - return directives -} - -func (p *parser) parseDirective(isConst bool) *Directive { - p.expect(lexer.At) - - return &Directive{ - Position: p.peekPos(), - Name: p.parseName(), - Arguments: p.parseArguments(isConst), - } -} - -func (p *parser) parseTypeReference() *Type { - var typ Type - - if p.skip(lexer.BracketL) { - typ.Position = p.peekPos() - typ.Elem = p.parseTypeReference() - p.expect(lexer.BracketR) - } else { - typ.Position = p.peekPos() - typ.NamedType = p.parseName() - } - - if p.skip(lexer.Bang) { - typ.NonNull = true - } - return &typ -} - -func (p *parser) parseName() string { - token := p.expect(lexer.Name) - - return token.Value -} diff --git a/vendor/github.com/vektah/gqlparser/v2/parser/query_test.yml b/vendor/github.com/vektah/gqlparser/v2/parser/query_test.yml deleted file mode 100644 index a46a01e718..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/parser/query_test.yml +++ /dev/null @@ -1,544 +0,0 @@ -parser provides useful errors: - - name: unclosed paren - input: '{' - error: - message: "Expected Name, found " - locations: [{line: 1, column: 2}] - - - name: missing on in fragment - input: | - { ...MissingOn } - fragment MissingOn Type - error: - message: 'Expected "on", found Name "Type"' - locations: [{ line: 2, column: 20 }] - - - name: missing name after alias - input: '{ field: {} }' - error: - message: "Expected Name, found {" - locations: [{ line: 1, column: 10 }] - - - name: not an operation - input: 'notanoperation Foo { field }' - error: - message: 'Unexpected Name "notanoperation"' - locations: [{ line: 1, column: 1 }] - - - name: a wild splat appears - input: '...' - error: - message: 'Unexpected ...' - locations: [{ line: 1, column: 1}] - -variables: - - name: are allowed in args - input: '{ field(complex: { a: { b: [ $var ] } }) }' - - - name: are not allowed in default args - input: 'query Foo($x: Complex = { a: { b: [ $var ] } }) { field }' - error: - message: 'Unexpected $' - locations: [{ line: 1, column: 37 }] - - - name: can have directives - input: 'query ($withDirective: String @first @second, $withoutDirective: String) { f }' - ast: | - - Operations: [OperationDefinition] - - - Operation: Operation("query") - VariableDefinitions: [VariableDefinition] - - - Variable: "withDirective" - Type: String - Directives: [Directive] - - - Name: "first" - - - Name: "second" - - - Variable: "withoutDirective" - Type: String - SelectionSet: [Selection] - - - Alias: "f" - Name: "f" - -fragments: - - name: can not be named 'on' - input: 'fragment on on on { on }' - error: - message: 'Unexpected Name "on"' - locations: [{ line: 1, column: 10 }] - - - name: can not spread fragments called 'on' - input: '{ ...on }' - error: - message: 'Expected Name, found }' - locations: [{ line: 1, column: 9 }] - -encoding: - - name: multibyte characters are supported - input: | - # This comment has a ਊ multi-byte character. - { field(arg: "Has a ਊ multi-byte character.") } - ast: | - - Operations: [OperationDefinition] - - - Operation: Operation("query") - SelectionSet: [Selection] - - - Alias: "field" - Name: "field" - Arguments: [Argument] - - - Name: "arg" - Value: "Has a ਊ multi-byte character." - -keywords are allowed anywhere a name is: - - name: on - input: | - query on { - ... a - ... on on { field } - } - fragment a on Type { - on(on: $on) - @on(on: on) - } - - - name: subscription - input: | - query subscription { - ... subscription - ... on subscription { field } - } - fragment subscription on Type { - subscription(subscription: $subscription) - @subscription(subscription: subscription) - } - - - name: true - input: | - query true { - ... true - ... on true { field } - } - fragment true on Type { - true(true: $true) - @true(true: true) - } - -operations: - - name: anonymous mutation - input: 'mutation { mutationField }' - - - name: named mutation - input: 'mutation Foo { mutationField }' - - - name: anonymous subscription - input: 'subscription { subscriptionField }' - - - name: named subscription - input: 'subscription Foo { subscriptionField }' - - -ast: - - name: simple query - input: | - { - node(id: 4) { - id, - name - } - } - ast: | - - Operations: [OperationDefinition] - - - Operation: Operation("query") - SelectionSet: [Selection] - - - Alias: "node" - Name: "node" - Arguments: [Argument] - - - Name: "id" - Value: 4 - SelectionSet: [Selection] - - - Alias: "id" - Name: "id" - - - Alias: "name" - Name: "name" - - - name: nameless query with no variables - input: | - query { - node { - id - } - } - ast: | - - Operations: [OperationDefinition] - - - Operation: Operation("query") - SelectionSet: [Selection] - - - Alias: "node" - Name: "node" - SelectionSet: [Selection] - - - Alias: "id" - Name: "id" - - - name: fragment defined variables - input: 'fragment a($v: Boolean = false) on t { f(v: $v) }' - ast: | - - Fragments: [FragmentDefinition] - - - Name: "a" - VariableDefinition: [VariableDefinition] - - - Variable: "v" - Type: Boolean - DefaultValue: false - TypeCondition: "t" - SelectionSet: [Selection] - - - Alias: "f" - Name: "f" - Arguments: [Argument] - - - Name: "v" - Value: $v - - -values: - - name: null - input: '{ f(id: null) }' - ast: | - - Operations: [OperationDefinition] - - - Operation: Operation("query") - SelectionSet: [Selection] - - - Alias: "f" - Name: "f" - Arguments: [Argument] - - - Name: "id" - Value: null - - - name: strings - input: '{ f(long: """long""", short: "short") } ' - ast: | - - Operations: [OperationDefinition] - - - Operation: Operation("query") - SelectionSet: [Selection] - - - Alias: "f" - Name: "f" - Arguments: [Argument] - - - Name: "long" - Value: "long" - - - Name: "short" - Value: "short" - - - name: list - input: '{ f(id: [1,2]) }' - ast: | - - Operations: [OperationDefinition] - - - Operation: Operation("query") - SelectionSet: [Selection] - - - Alias: "f" - Name: "f" - Arguments: [Argument] - - - Name: "id" - Value: [1,2] - -types: - - name: common types - input: 'query ($string: String, $int: Int, $arr: [Arr], $notnull: [Arr!]!) { f }' - ast: | - - Operations: [OperationDefinition] - - - Operation: Operation("query") - VariableDefinitions: [VariableDefinition] - - - Variable: "string" - Type: String - - - Variable: "int" - Type: Int - - - Variable: "arr" - Type: [Arr] - - - Variable: "notnull" - Type: [Arr!]! - SelectionSet: [Selection] - - - Alias: "f" - Name: "f" - -large queries: - - name: kitchen sink - input: | - # Copyright (c) 2015-present, Facebook, Inc. - # - # This source code is licensed under the MIT license found in the - # LICENSE file in the root directory of this source tree. - - query queryName($foo: ComplexType, $site: Site = MOBILE) { - whoever123is: node(id: [123, 456]) { - id , - ... on User @defer { - field2 { - id , - alias: field1(first:10, after:$foo,) @include(if: $foo) { - id, - ...frag - } - } - } - ... @skip(unless: $foo) { - id - } - ... { - id - } - } - } - - mutation likeStory { - like(story: 123) @defer { - story { - id - } - } - } - - subscription StoryLikeSubscription($input: StoryLikeSubscribeInput) { - storyLikeSubscribe(input: $input) { - story { - likers { - count - } - likeSentence { - text - } - } - } - } - - fragment frag on Friend { - foo(size: $size, bar: $b, obj: {key: "value", block: """ - block string uses \""" - """}) - } - - { - unnamed(truthy: true, falsey: false, nullish: null), - query - } - ast: | - - Operations: [OperationDefinition] - - - Operation: Operation("query") - Name: "queryName" - VariableDefinitions: [VariableDefinition] - - - Variable: "foo" - Type: ComplexType - - - Variable: "site" - Type: Site - DefaultValue: MOBILE - SelectionSet: [Selection] - - - Alias: "whoever123is" - Name: "node" - Arguments: [Argument] - - - Name: "id" - Value: [123,456] - SelectionSet: [Selection] - - - Alias: "id" - Name: "id" - - - TypeCondition: "User" - Directives: [Directive] - - - Name: "defer" - SelectionSet: [Selection] - - - Alias: "field2" - Name: "field2" - SelectionSet: [Selection] - - - Alias: "id" - Name: "id" - - - Alias: "alias" - Name: "field1" - Arguments: [Argument] - - - Name: "first" - Value: 10 - - - Name: "after" - Value: $foo - Directives: [Directive] - - - Name: "include" - Arguments: [Argument] - - - Name: "if" - Value: $foo - SelectionSet: [Selection] - - - Alias: "id" - Name: "id" - - - Name: "frag" - - - Directives: [Directive] - - - Name: "skip" - Arguments: [Argument] - - - Name: "unless" - Value: $foo - SelectionSet: [Selection] - - - Alias: "id" - Name: "id" - - - SelectionSet: [Selection] - - - Alias: "id" - Name: "id" - - - Operation: Operation("mutation") - Name: "likeStory" - SelectionSet: [Selection] - - - Alias: "like" - Name: "like" - Arguments: [Argument] - - - Name: "story" - Value: 123 - Directives: [Directive] - - - Name: "defer" - SelectionSet: [Selection] - - - Alias: "story" - Name: "story" - SelectionSet: [Selection] - - - Alias: "id" - Name: "id" - - - Operation: Operation("subscription") - Name: "StoryLikeSubscription" - VariableDefinitions: [VariableDefinition] - - - Variable: "input" - Type: StoryLikeSubscribeInput - SelectionSet: [Selection] - - - Alias: "storyLikeSubscribe" - Name: "storyLikeSubscribe" - Arguments: [Argument] - - - Name: "input" - Value: $input - SelectionSet: [Selection] - - - Alias: "story" - Name: "story" - SelectionSet: [Selection] - - - Alias: "likers" - Name: "likers" - SelectionSet: [Selection] - - - Alias: "count" - Name: "count" - - - Alias: "likeSentence" - Name: "likeSentence" - SelectionSet: [Selection] - - - Alias: "text" - Name: "text" - - - Operation: Operation("query") - SelectionSet: [Selection] - - - Alias: "unnamed" - Name: "unnamed" - Arguments: [Argument] - - - Name: "truthy" - Value: true - - - Name: "falsey" - Value: false - - - Name: "nullish" - Value: null - - - Alias: "query" - Name: "query" - Fragments: [FragmentDefinition] - - - Name: "frag" - TypeCondition: "Friend" - SelectionSet: [Selection] - - - Alias: "foo" - Name: "foo" - Arguments: [Argument] - - - Name: "size" - Value: $size - - - Name: "bar" - Value: $b - - - Name: "obj" - Value: {key:"value",block:"block string uses \"\"\""} - -fuzzer: -- name: 01 - input: '{__typename{...}}' - error: - message: 'Expected {, found }' - locations: [{ line: 1, column: 16 }] - -- name: 02 - input: '{...{__typename{...{}}}}' - error: - message: 'expected at least one definition, found }' - locations: [{ line: 1, column: 21 }] diff --git a/vendor/github.com/vektah/gqlparser/v2/parser/schema.go b/vendor/github.com/vektah/gqlparser/v2/parser/schema.go deleted file mode 100644 index aec08a9700..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/parser/schema.go +++ /dev/null @@ -1,534 +0,0 @@ -package parser - -import ( - . "github.com/vektah/gqlparser/v2/ast" - "github.com/vektah/gqlparser/v2/lexer" -) - -func ParseSchema(source *Source) (*SchemaDocument, error) { - p := parser{ - lexer: lexer.New(source), - } - ast, err := p.parseSchemaDocument(), p.err - if err != nil { - return nil, err - } - - for _, def := range ast.Definitions { - def.BuiltIn = source.BuiltIn - } - for _, def := range ast.Extensions { - def.BuiltIn = source.BuiltIn - } - - return ast, nil -} - -func ParseSchemas(inputs ...*Source) (*SchemaDocument, error) { - ast := &SchemaDocument{} - for _, input := range inputs { - inputAst, err := ParseSchema(input) - if err != nil { - return nil, err - } - ast.Merge(inputAst) - } - return ast, nil -} - -func (p *parser) parseSchemaDocument() *SchemaDocument { - var doc SchemaDocument - doc.Position = p.peekPos() - for p.peek().Kind != lexer.EOF { - if p.err != nil { - return nil - } - - var description string - if p.peek().Kind == lexer.BlockString || p.peek().Kind == lexer.String { - description = p.parseDescription() - } - - if p.peek().Kind != lexer.Name { - p.unexpectedError() - break - } - - switch p.peek().Value { - case "scalar", "type", "interface", "union", "enum", "input": - doc.Definitions = append(doc.Definitions, p.parseTypeSystemDefinition(description)) - case "schema": - doc.Schema = append(doc.Schema, p.parseSchemaDefinition(description)) - case "directive": - doc.Directives = append(doc.Directives, p.parseDirectiveDefinition(description)) - case "extend": - if description != "" { - p.unexpectedToken(p.prev) - } - p.parseTypeSystemExtension(&doc) - default: - p.unexpectedError() - return nil - } - } - - return &doc -} - -func (p *parser) parseDescription() string { - token := p.peek() - - if token.Kind != lexer.BlockString && token.Kind != lexer.String { - return "" - } - - return p.next().Value -} - -func (p *parser) parseTypeSystemDefinition(description string) *Definition { - tok := p.peek() - if tok.Kind != lexer.Name { - p.unexpectedError() - return nil - } - - switch tok.Value { - case "scalar": - return p.parseScalarTypeDefinition(description) - case "type": - return p.parseObjectTypeDefinition(description) - case "interface": - return p.parseInterfaceTypeDefinition(description) - case "union": - return p.parseUnionTypeDefinition(description) - case "enum": - return p.parseEnumTypeDefinition(description) - case "input": - return p.parseInputObjectTypeDefinition(description) - default: - p.unexpectedError() - return nil - } -} - -func (p *parser) parseSchemaDefinition(description string) *SchemaDefinition { - p.expectKeyword("schema") - - def := SchemaDefinition{Description: description} - def.Position = p.peekPos() - def.Description = description - def.Directives = p.parseDirectives(true) - - p.some(lexer.BraceL, lexer.BraceR, func() { - def.OperationTypes = append(def.OperationTypes, p.parseOperationTypeDefinition()) - }) - return &def -} - -func (p *parser) parseOperationTypeDefinition() *OperationTypeDefinition { - var op OperationTypeDefinition - op.Position = p.peekPos() - op.Operation = p.parseOperationType() - p.expect(lexer.Colon) - op.Type = p.parseName() - return &op -} - -func (p *parser) parseScalarTypeDefinition(description string) *Definition { - p.expectKeyword("scalar") - - var def Definition - def.Position = p.peekPos() - def.Kind = Scalar - def.Description = description - def.Name = p.parseName() - def.Directives = p.parseDirectives(true) - return &def -} - -func (p *parser) parseObjectTypeDefinition(description string) *Definition { - p.expectKeyword("type") - - var def Definition - def.Position = p.peekPos() - def.Kind = Object - def.Description = description - def.Name = p.parseName() - def.Interfaces = p.parseImplementsInterfaces() - def.Directives = p.parseDirectives(true) - def.Fields = p.parseFieldsDefinition() - return &def -} - -func (p *parser) parseImplementsInterfaces() []string { - var types []string - if p.peek().Value == "implements" { - p.next() - // optional leading ampersand - p.skip(lexer.Amp) - - types = append(types, p.parseName()) - for p.skip(lexer.Amp) && p.err == nil { - types = append(types, p.parseName()) - } - } - return types -} - -func (p *parser) parseFieldsDefinition() FieldList { - var defs FieldList - p.some(lexer.BraceL, lexer.BraceR, func() { - defs = append(defs, p.parseFieldDefinition()) - }) - return defs -} - -func (p *parser) parseFieldDefinition() *FieldDefinition { - var def FieldDefinition - def.Position = p.peekPos() - def.Description = p.parseDescription() - def.Name = p.parseName() - def.Arguments = p.parseArgumentDefs() - p.expect(lexer.Colon) - def.Type = p.parseTypeReference() - def.Directives = p.parseDirectives(true) - - return &def -} - -func (p *parser) parseArgumentDefs() ArgumentDefinitionList { - var args ArgumentDefinitionList - p.some(lexer.ParenL, lexer.ParenR, func() { - args = append(args, p.parseArgumentDef()) - }) - return args -} - -func (p *parser) parseArgumentDef() *ArgumentDefinition { - var def ArgumentDefinition - def.Position = p.peekPos() - def.Description = p.parseDescription() - def.Name = p.parseName() - p.expect(lexer.Colon) - def.Type = p.parseTypeReference() - if p.skip(lexer.Equals) { - def.DefaultValue = p.parseValueLiteral(true) - } - def.Directives = p.parseDirectives(true) - return &def -} - -func (p *parser) parseInputValueDef() *FieldDefinition { - var def FieldDefinition - def.Position = p.peekPos() - def.Description = p.parseDescription() - def.Name = p.parseName() - p.expect(lexer.Colon) - def.Type = p.parseTypeReference() - if p.skip(lexer.Equals) { - def.DefaultValue = p.parseValueLiteral(true) - } - def.Directives = p.parseDirectives(true) - return &def -} - -func (p *parser) parseInterfaceTypeDefinition(description string) *Definition { - p.expectKeyword("interface") - - var def Definition - def.Position = p.peekPos() - def.Kind = Interface - def.Description = description - def.Name = p.parseName() - def.Interfaces = p.parseImplementsInterfaces() - def.Directives = p.parseDirectives(true) - def.Fields = p.parseFieldsDefinition() - return &def -} - -func (p *parser) parseUnionTypeDefinition(description string) *Definition { - p.expectKeyword("union") - - var def Definition - def.Position = p.peekPos() - def.Kind = Union - def.Description = description - def.Name = p.parseName() - def.Directives = p.parseDirectives(true) - def.Types = p.parseUnionMemberTypes() - return &def -} - -func (p *parser) parseUnionMemberTypes() []string { - var types []string - if p.skip(lexer.Equals) { - // optional leading pipe - p.skip(lexer.Pipe) - - types = append(types, p.parseName()) - for p.skip(lexer.Pipe) && p.err == nil { - types = append(types, p.parseName()) - } - } - return types -} - -func (p *parser) parseEnumTypeDefinition(description string) *Definition { - p.expectKeyword("enum") - - var def Definition - def.Position = p.peekPos() - def.Kind = Enum - def.Description = description - def.Name = p.parseName() - def.Directives = p.parseDirectives(true) - def.EnumValues = p.parseEnumValuesDefinition() - return &def -} - -func (p *parser) parseEnumValuesDefinition() EnumValueList { - var values EnumValueList - p.some(lexer.BraceL, lexer.BraceR, func() { - values = append(values, p.parseEnumValueDefinition()) - }) - return values -} - -func (p *parser) parseEnumValueDefinition() *EnumValueDefinition { - return &EnumValueDefinition{ - Position: p.peekPos(), - Description: p.parseDescription(), - Name: p.parseName(), - Directives: p.parseDirectives(true), - } -} - -func (p *parser) parseInputObjectTypeDefinition(description string) *Definition { - p.expectKeyword("input") - - var def Definition - def.Position = p.peekPos() - def.Kind = InputObject - def.Description = description - def.Name = p.parseName() - def.Directives = p.parseDirectives(true) - def.Fields = p.parseInputFieldsDefinition() - return &def -} - -func (p *parser) parseInputFieldsDefinition() FieldList { - var values FieldList - p.some(lexer.BraceL, lexer.BraceR, func() { - values = append(values, p.parseInputValueDef()) - }) - return values -} - -func (p *parser) parseTypeSystemExtension(doc *SchemaDocument) { - p.expectKeyword("extend") - - switch p.peek().Value { - case "schema": - doc.SchemaExtension = append(doc.SchemaExtension, p.parseSchemaExtension()) - case "scalar": - doc.Extensions = append(doc.Extensions, p.parseScalarTypeExtension()) - case "type": - doc.Extensions = append(doc.Extensions, p.parseObjectTypeExtension()) - case "interface": - doc.Extensions = append(doc.Extensions, p.parseInterfaceTypeExtension()) - case "union": - doc.Extensions = append(doc.Extensions, p.parseUnionTypeExtension()) - case "enum": - doc.Extensions = append(doc.Extensions, p.parseEnumTypeExtension()) - case "input": - doc.Extensions = append(doc.Extensions, p.parseInputObjectTypeExtension()) - default: - p.unexpectedError() - } -} - -func (p *parser) parseSchemaExtension() *SchemaDefinition { - p.expectKeyword("schema") - - var def SchemaDefinition - def.Position = p.peekPos() - def.Directives = p.parseDirectives(true) - p.some(lexer.BraceL, lexer.BraceR, func() { - def.OperationTypes = append(def.OperationTypes, p.parseOperationTypeDefinition()) - }) - if len(def.Directives) == 0 && len(def.OperationTypes) == 0 { - p.unexpectedError() - } - return &def -} - -func (p *parser) parseScalarTypeExtension() *Definition { - p.expectKeyword("scalar") - - var def Definition - def.Position = p.peekPos() - def.Kind = Scalar - def.Name = p.parseName() - def.Directives = p.parseDirectives(true) - if len(def.Directives) == 0 { - p.unexpectedError() - } - return &def -} - -func (p *parser) parseObjectTypeExtension() *Definition { - p.expectKeyword("type") - - var def Definition - def.Position = p.peekPos() - def.Kind = Object - def.Name = p.parseName() - def.Interfaces = p.parseImplementsInterfaces() - def.Directives = p.parseDirectives(true) - def.Fields = p.parseFieldsDefinition() - if len(def.Interfaces) == 0 && len(def.Directives) == 0 && len(def.Fields) == 0 { - p.unexpectedError() - } - return &def -} - -func (p *parser) parseInterfaceTypeExtension() *Definition { - p.expectKeyword("interface") - - var def Definition - def.Position = p.peekPos() - def.Kind = Interface - def.Name = p.parseName() - def.Directives = p.parseDirectives(true) - def.Fields = p.parseFieldsDefinition() - if len(def.Directives) == 0 && len(def.Fields) == 0 { - p.unexpectedError() - } - return &def -} - -func (p *parser) parseUnionTypeExtension() *Definition { - p.expectKeyword("union") - - var def Definition - def.Position = p.peekPos() - def.Kind = Union - def.Name = p.parseName() - def.Directives = p.parseDirectives(true) - def.Types = p.parseUnionMemberTypes() - - if len(def.Directives) == 0 && len(def.Types) == 0 { - p.unexpectedError() - } - return &def -} - -func (p *parser) parseEnumTypeExtension() *Definition { - p.expectKeyword("enum") - - var def Definition - def.Position = p.peekPos() - def.Kind = Enum - def.Name = p.parseName() - def.Directives = p.parseDirectives(true) - def.EnumValues = p.parseEnumValuesDefinition() - if len(def.Directives) == 0 && len(def.EnumValues) == 0 { - p.unexpectedError() - } - return &def -} - -func (p *parser) parseInputObjectTypeExtension() *Definition { - p.expectKeyword("input") - - var def Definition - def.Position = p.peekPos() - def.Kind = InputObject - def.Name = p.parseName() - def.Directives = p.parseDirectives(false) - def.Fields = p.parseInputFieldsDefinition() - if len(def.Directives) == 0 && len(def.Fields) == 0 { - p.unexpectedError() - } - return &def -} - -func (p *parser) parseDirectiveDefinition(description string) *DirectiveDefinition { - p.expectKeyword("directive") - p.expect(lexer.At) - - var def DirectiveDefinition - def.Position = p.peekPos() - def.Description = description - def.Name = p.parseName() - def.Arguments = p.parseArgumentDefs() - - if peek := p.peek(); peek.Kind == lexer.Name && peek.Value == "repeatable" { - def.IsRepeatable = true - p.skip(lexer.Name) - } - - p.expectKeyword("on") - def.Locations = p.parseDirectiveLocations() - return &def -} - -func (p *parser) parseDirectiveLocations() []DirectiveLocation { - p.skip(lexer.Pipe) - - locations := []DirectiveLocation{p.parseDirectiveLocation()} - - for p.skip(lexer.Pipe) && p.err == nil { - locations = append(locations, p.parseDirectiveLocation()) - } - - return locations -} - -func (p *parser) parseDirectiveLocation() DirectiveLocation { - name := p.expect(lexer.Name) - - switch name.Value { - case `QUERY`: - return LocationQuery - case `MUTATION`: - return LocationMutation - case `SUBSCRIPTION`: - return LocationSubscription - case `FIELD`: - return LocationField - case `FRAGMENT_DEFINITION`: - return LocationFragmentDefinition - case `FRAGMENT_SPREAD`: - return LocationFragmentSpread - case `INLINE_FRAGMENT`: - return LocationInlineFragment - case `VARIABLE_DEFINITION`: - return LocationVariableDefinition - case `SCHEMA`: - return LocationSchema - case `SCALAR`: - return LocationScalar - case `OBJECT`: - return LocationObject - case `FIELD_DEFINITION`: - return LocationFieldDefinition - case `ARGUMENT_DEFINITION`: - return LocationArgumentDefinition - case `INTERFACE`: - return LocationInterface - case `UNION`: - return LocationUnion - case `ENUM`: - return LocationEnum - case `ENUM_VALUE`: - return LocationEnumValue - case `INPUT_OBJECT`: - return LocationInputObject - case `INPUT_FIELD_DEFINITION`: - return LocationInputFieldDefinition - } - - p.unexpectedToken(name) - return "" -} diff --git a/vendor/github.com/vektah/gqlparser/v2/parser/schema_test.yml b/vendor/github.com/vektah/gqlparser/v2/parser/schema_test.yml deleted file mode 100644 index 8b6a5d0ca3..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/parser/schema_test.yml +++ /dev/null @@ -1,646 +0,0 @@ -object types: - - name: simple - input: | - type Hello { - world: String - } - ast: | - - Definitions: [Definition] - - - Kind: DefinitionKind("OBJECT") - Name: "Hello" - Fields: [FieldDefinition] - - - Name: "world" - Type: String - - - name: with description - input: | - "Description" - type Hello { - world: String - } - ast: | - - Definitions: [Definition] - - - Kind: DefinitionKind("OBJECT") - Description: "Description" - Name: "Hello" - Fields: [FieldDefinition] - - - Name: "world" - Type: String - - - name: with block description - input: | - """ - Description - """ - # Even with comments between them - type Hello { - world: String - } - ast: | - - Definitions: [Definition] - - - Kind: DefinitionKind("OBJECT") - Description: "Description" - Name: "Hello" - Fields: [FieldDefinition] - - - Name: "world" - Type: String - - name: with field arg - input: | - type Hello { - world(flag: Boolean): String - } - ast: | - - Definitions: [Definition] - - - Kind: DefinitionKind("OBJECT") - Name: "Hello" - Fields: [FieldDefinition] - - - Name: "world" - Arguments: [ArgumentDefinition] - - - Name: "flag" - Type: Boolean - Type: String - - - name: with field arg and default value - input: | - type Hello { - world(flag: Boolean = true): String - } - ast: | - - Definitions: [Definition] - - - Kind: DefinitionKind("OBJECT") - Name: "Hello" - Fields: [FieldDefinition] - - - Name: "world" - Arguments: [ArgumentDefinition] - - - Name: "flag" - DefaultValue: true - Type: Boolean - Type: String - - - name: with field list arg - input: | - type Hello { - world(things: [String]): String - } - ast: | - - Definitions: [Definition] - - - Kind: DefinitionKind("OBJECT") - Name: "Hello" - Fields: [FieldDefinition] - - - Name: "world" - Arguments: [ArgumentDefinition] - - - Name: "things" - Type: [String] - Type: String - - - name: with two args - input: | - type Hello { - world(argOne: Boolean, argTwo: Int): String - } - ast: | - - Definitions: [Definition] - - - Kind: DefinitionKind("OBJECT") - Name: "Hello" - Fields: [FieldDefinition] - - - Name: "world" - Arguments: [ArgumentDefinition] - - - Name: "argOne" - Type: Boolean - - - Name: "argTwo" - Type: Int - Type: String - - name: must define one or more fields - input: | - type Hello {} - error: - message: "expected at least one definition, found }" - locations: [{ line: 1, column: 13 }] - -type extensions: - - name: Object extension - input: | - extend type Hello { - world: String - } - ast: | - - Extensions: [Definition] - - - Kind: DefinitionKind("OBJECT") - Name: "Hello" - Fields: [FieldDefinition] - - - Name: "world" - Type: String - - - name: without any fields - input: "extend type Hello implements Greeting" - ast: | - - Extensions: [Definition] - - - Kind: DefinitionKind("OBJECT") - Name: "Hello" - Interfaces: [string] - - "Greeting" - - - name: without fields twice - input: | - extend type Hello implements Greeting - extend type Hello implements SecondGreeting - ast: | - - Extensions: [Definition] - - - Kind: DefinitionKind("OBJECT") - Name: "Hello" - Interfaces: [string] - - "Greeting" - - - Kind: DefinitionKind("OBJECT") - Name: "Hello" - Interfaces: [string] - - "SecondGreeting" - - - name: without anything errors - input: "extend type Hello" - error: - message: "Unexpected " - locations: [{ line: 1, column: 18 }] - - - name: can have descriptions # hmm, this might not be spec compliant... - input: | - "Description" - extend type Hello { - world: String - } - error: - message: 'Unexpected String "Description"' - locations: [{ line: 1, column: 2 }] - - - name: can not have descriptions on types - input: | - extend "Description" type Hello { - world: String - } - error: - message: Unexpected String "Description" - locations: [{ line: 1, column: 9 }] - - - name: all can have directives - input: | - extend scalar Foo @deprecated - extend type Foo @deprecated - extend interface Foo @deprecated - extend union Foo @deprecated - extend enum Foo @deprecated - extend input Foo @deprecated - ast: | - - Extensions: [Definition] - - - Kind: DefinitionKind("SCALAR") - Name: "Foo" - Directives: [Directive] - - - Name: "deprecated" - - - Kind: DefinitionKind("OBJECT") - Name: "Foo" - Directives: [Directive] - - - Name: "deprecated" - - - Kind: DefinitionKind("INTERFACE") - Name: "Foo" - Directives: [Directive] - - - Name: "deprecated" - - - Kind: DefinitionKind("UNION") - Name: "Foo" - Directives: [Directive] - - - Name: "deprecated" - - - Kind: DefinitionKind("ENUM") - Name: "Foo" - Directives: [Directive] - - - Name: "deprecated" - - - Kind: DefinitionKind("INPUT_OBJECT") - Name: "Foo" - Directives: [Directive] - - - Name: "deprecated" - -schema definition: - - name: simple - input: | - schema { - query: Query - } - ast: | - - Schema: [SchemaDefinition] - - - OperationTypes: [OperationTypeDefinition] - - - Operation: Operation("query") - Type: "Query" - -schema extensions: - - name: simple - input: | - extend schema { - mutation: Mutation - } - ast: | - - SchemaExtension: [SchemaDefinition] - - - OperationTypes: [OperationTypeDefinition] - - - Operation: Operation("mutation") - Type: "Mutation" - - - name: directive only - input: "extend schema @directive" - ast: | - - SchemaExtension: [SchemaDefinition] - - - Directives: [Directive] - - - Name: "directive" - - - name: without anything errors - input: "extend schema" - error: - message: "Unexpected " - locations: [{ line: 1, column: 14}] - -inheritance: - - name: single - input: "type Hello implements World { field: String }" - ast: | - - Definitions: [Definition] - - - Kind: DefinitionKind("OBJECT") - Name: "Hello" - Interfaces: [string] - - "World" - Fields: [FieldDefinition] - - - Name: "field" - Type: String - - - name: multi - input: "type Hello implements Wo & rld { field: String }" - ast: | - - Definitions: [Definition] - - - Kind: DefinitionKind("OBJECT") - Name: "Hello" - Interfaces: [string] - - "Wo" - - "rld" - Fields: [FieldDefinition] - - - Name: "field" - Type: String - - - name: multi with leading amp - input: "type Hello implements & Wo & rld { field: String }" - ast: | - - Definitions: [Definition] - - - Kind: DefinitionKind("OBJECT") - Name: "Hello" - Interfaces: [string] - - "Wo" - - "rld" - Fields: [FieldDefinition] - - - Name: "field" - Type: String - -enums: - - name: single value - input: "enum Hello { WORLD }" - ast: | - - Definitions: [Definition] - - - Kind: DefinitionKind("ENUM") - Name: "Hello" - EnumValues: [EnumValueDefinition] - - - Name: "WORLD" - - - name: double value - input: "enum Hello { WO, RLD }" - ast: | - - Definitions: [Definition] - - - Kind: DefinitionKind("ENUM") - Name: "Hello" - EnumValues: [EnumValueDefinition] - - - Name: "WO" - - - Name: "RLD" - - name: must define one or more unique enum values - input: | - enum Hello {} - error: - message: "expected at least one definition, found }" - locations: [{ line: 1, column: 13 }] - -interface: - - name: simple - input: | - interface Hello { - world: String - } - ast: | - - Definitions: [Definition] - - - Kind: DefinitionKind("INTERFACE") - Name: "Hello" - Fields: [FieldDefinition] - - - Name: "world" - Type: String - - name: must define one or more fields - input: | - interface Hello {} - error: - message: "expected at least one definition, found }" - locations: [{ line: 1, column: 18 }] - - - name: may define intermediate interfaces - input: | - interface IA { - id: ID! - } - - interface IIA implements IA { - id: ID! - } - - type A implements IIA { - id: ID! - } - ast: | - - Definitions: [Definition] - - - Kind: DefinitionKind("INTERFACE") - Name: "IA" - Fields: [FieldDefinition] - - - Name: "id" - Type: ID! - - - Kind: DefinitionKind("INTERFACE") - Name: "IIA" - Interfaces: [string] - - "IA" - Fields: [FieldDefinition] - - - Name: "id" - Type: ID! - - - Kind: DefinitionKind("OBJECT") - Name: "A" - Interfaces: [string] - - "IIA" - Fields: [FieldDefinition] - - - Name: "id" - Type: ID! - -unions: - - name: simple - input: "union Hello = World" - ast: | - - Definitions: [Definition] - - - Kind: DefinitionKind("UNION") - Name: "Hello" - Types: [string] - - "World" - - - name: with two types - input: "union Hello = Wo | Rld" - ast: | - - Definitions: [Definition] - - - Kind: DefinitionKind("UNION") - Name: "Hello" - Types: [string] - - "Wo" - - "Rld" - - - name: with leading pipe - input: "union Hello = | Wo | Rld" - ast: | - - Definitions: [Definition] - - - Kind: DefinitionKind("UNION") - Name: "Hello" - Types: [string] - - "Wo" - - "Rld" - - - name: cant be empty - input: "union Hello = || Wo | Rld" - error: - message: "Expected Name, found |" - locations: [{ line: 1, column: 16 }] - - - name: cant double pipe - input: "union Hello = Wo || Rld" - error: - message: "Expected Name, found |" - locations: [{ line: 1, column: 19 }] - - - name: cant have trailing pipe - input: "union Hello = | Wo | Rld |" - error: - message: "Expected Name, found " - locations: [{ line: 1, column: 27 }] - -scalar: - - name: simple - input: "scalar Hello" - ast: | - - Definitions: [Definition] - - - Kind: DefinitionKind("SCALAR") - Name: "Hello" - -input object: - - name: simple - input: | - input Hello { - world: String - } - ast: | - - Definitions: [Definition] - - - Kind: DefinitionKind("INPUT_OBJECT") - Name: "Hello" - Fields: [FieldDefinition] - - - Name: "world" - Type: String - - - name: can not have args - input: | - input Hello { - world(foo: Int): String - } - error: - message: "Expected :, found (" - locations: [{ line: 2, column: 8 }] - - name: must define one or more input fields - input: | - input Hello {} - error: - message: "expected at least one definition, found }" - locations: [{ line: 1, column: 14 }] - -directives: - - name: simple - input: directive @foo on FIELD - ast: | - - Directives: [DirectiveDefinition] - - - Name: "foo" - Locations: [DirectiveLocation] - - DirectiveLocation("FIELD") - IsRepeatable: false - - - name: executable - input: | - directive @onQuery on QUERY - directive @onMutation on MUTATION - directive @onSubscription on SUBSCRIPTION - directive @onField on FIELD - directive @onFragmentDefinition on FRAGMENT_DEFINITION - directive @onFragmentSpread on FRAGMENT_SPREAD - directive @onInlineFragment on INLINE_FRAGMENT - directive @onVariableDefinition on VARIABLE_DEFINITION - ast: | - - Directives: [DirectiveDefinition] - - - Name: "onQuery" - Locations: [DirectiveLocation] - - DirectiveLocation("QUERY") - IsRepeatable: false - - - Name: "onMutation" - Locations: [DirectiveLocation] - - DirectiveLocation("MUTATION") - IsRepeatable: false - - - Name: "onSubscription" - Locations: [DirectiveLocation] - - DirectiveLocation("SUBSCRIPTION") - IsRepeatable: false - - - Name: "onField" - Locations: [DirectiveLocation] - - DirectiveLocation("FIELD") - IsRepeatable: false - - - Name: "onFragmentDefinition" - Locations: [DirectiveLocation] - - DirectiveLocation("FRAGMENT_DEFINITION") - IsRepeatable: false - - - Name: "onFragmentSpread" - Locations: [DirectiveLocation] - - DirectiveLocation("FRAGMENT_SPREAD") - IsRepeatable: false - - - Name: "onInlineFragment" - Locations: [DirectiveLocation] - - DirectiveLocation("INLINE_FRAGMENT") - IsRepeatable: false - - - Name: "onVariableDefinition" - Locations: [DirectiveLocation] - - DirectiveLocation("VARIABLE_DEFINITION") - IsRepeatable: false - - - name: repeatable - input: directive @foo repeatable on FIELD - ast: | - - Directives: [DirectiveDefinition] - - - Name: "foo" - Locations: [DirectiveLocation] - - DirectiveLocation("FIELD") - IsRepeatable: true - - - name: invalid location - input: "directive @foo on FIELD | INCORRECT_LOCATION" - error: - message: 'Unexpected Name "INCORRECT_LOCATION"' - locations: [{ line: 1, column: 27 }] - -fuzzer: - - name: 1 - input: "type o{d(g:[" - error: - message: 'Expected Name, found ' - locations: [{ line: 1, column: 13 }] - - name: 2 - input: "\"\"\"\r" - error: - message: 'Unexpected ' - locations: [{ line: 2, column: 1 }] diff --git a/vendor/github.com/vektah/gqlparser/v2/readme.md b/vendor/github.com/vektah/gqlparser/v2/readme.md deleted file mode 100644 index 9f49ec78e3..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/readme.md +++ /dev/null @@ -1,17 +0,0 @@ -gqlparser [![CircleCI](https://badgen.net/circleci/github/vektah/gqlparser/master)](https://circleci.com/gh/vektah/gqlparser) [![Go Report Card](https://goreportcard.com/badge/github.com/vektah/gqlparser/v2)](https://goreportcard.com/report/github.com/vektah/gqlparser/v2) [![Coverage Status](https://badgen.net/coveralls/c/github/vektah/gqlparser)](https://coveralls.io/github/vektah/gqlparser?branch=master) -=== - -This is a parser for graphql, written to mirror the graphql-js reference implementation as closely while remaining idiomatic and easy to use. - -spec target: June 2018 (Schema definition language, block strings as descriptions, error paths & extension) - -This parser is used by [gqlgen](https://github.com/99designs/gqlgen), and it should be reasonably stable. - -Guiding principles: - - - maintainability: It should be easy to stay up to date with the spec - - well tested: It shouldn't need a graphql server to validate itself. Changes to this repo should be self contained. - - server agnostic: It should be usable by any of the graphql server implementations, and any graphql client tooling. - - idiomatic & stable api: It should follow go best practices, especially around forwards compatibility. - - fast: Where it doesn't impact on the above it should be fast. Avoid unnecessary allocs in hot paths. - - close to reference: Where it doesn't impact on the above, it should stay close to the [graphql/graphql-js](https://github.com/graphql/graphql-js) reference implementation. diff --git a/vendor/github.com/vektah/gqlparser/v2/validator/error.go b/vendor/github.com/vektah/gqlparser/v2/validator/error.go deleted file mode 100644 index f8f76055ac..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/validator/error.go +++ /dev/null @@ -1,55 +0,0 @@ -package validator - -import ( - "fmt" - - "github.com/vektah/gqlparser/v2/ast" - "github.com/vektah/gqlparser/v2/gqlerror" -) - -type ErrorOption func(err *gqlerror.Error) - -func Message(msg string, args ...interface{}) ErrorOption { - return func(err *gqlerror.Error) { - err.Message += fmt.Sprintf(msg, args...) - } -} - -func At(position *ast.Position) ErrorOption { - return func(err *gqlerror.Error) { - if position == nil { - return - } - err.Locations = append(err.Locations, gqlerror.Location{ - Line: position.Line, - Column: position.Column, - }) - if position.Src.Name != "" { - err.SetFile(position.Src.Name) - } - } -} - -func SuggestListQuoted(prefix string, typed string, suggestions []string) ErrorOption { - suggested := SuggestionList(typed, suggestions) - return func(err *gqlerror.Error) { - if len(suggested) > 0 { - err.Message += " " + prefix + " " + QuotedOrList(suggested...) + "?" - } - } -} - -func SuggestListUnquoted(prefix string, typed string, suggestions []string) ErrorOption { - suggested := SuggestionList(typed, suggestions) - return func(err *gqlerror.Error) { - if len(suggested) > 0 { - err.Message += " " + prefix + " " + OrList(suggested...) + "?" - } - } -} - -func Suggestf(suggestion string, args ...interface{}) ErrorOption { - return func(err *gqlerror.Error) { - err.Message += " Did you mean " + fmt.Sprintf(suggestion, args...) + "?" - } -} diff --git a/vendor/github.com/vektah/gqlparser/v2/validator/messaging.go b/vendor/github.com/vektah/gqlparser/v2/validator/messaging.go deleted file mode 100644 index f1ab5873f3..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/validator/messaging.go +++ /dev/null @@ -1,39 +0,0 @@ -package validator - -import "bytes" - -// Given [ A, B, C ] return '"A", "B", or "C"'. -func QuotedOrList(items ...string) string { - itemsQuoted := make([]string, len(items)) - for i, item := range items { - itemsQuoted[i] = `"` + item + `"` - } - return OrList(itemsQuoted...) -} - -// Given [ A, B, C ] return 'A, B, or C'. -func OrList(items ...string) string { - var buf bytes.Buffer - - if len(items) > 5 { - items = items[:5] - } - if len(items) == 2 { - buf.WriteString(items[0]) - buf.WriteString(" or ") - buf.WriteString(items[1]) - return buf.String() - } - - for i, item := range items { - if i != 0 { - if i == len(items)-1 { - buf.WriteString(", or ") - } else { - buf.WriteString(", ") - } - } - buf.WriteString(item) - } - return buf.String() -} diff --git a/vendor/github.com/vektah/gqlparser/v2/validator/prelude.go b/vendor/github.com/vektah/gqlparser/v2/validator/prelude.go deleted file mode 100644 index c354ec0dfa..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/validator/prelude.go +++ /dev/null @@ -1,15 +0,0 @@ -package validator - -import ( - _ "embed" - "github.com/vektah/gqlparser/v2/ast" -) - -//go:embed prelude.graphql -var preludeGraphql string - -var Prelude = &ast.Source{ - Name: "prelude.graphql", - Input: preludeGraphql, - BuiltIn: true, -} diff --git a/vendor/github.com/vektah/gqlparser/v2/validator/prelude.graphql b/vendor/github.com/vektah/gqlparser/v2/validator/prelude.graphql deleted file mode 100644 index bdca0096a5..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/validator/prelude.graphql +++ /dev/null @@ -1,121 +0,0 @@ -# This file defines all the implicitly declared types that are required by the graphql spec. It is implicitly included by calls to LoadSchema - -"The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1." -scalar Int - -"The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](http://en.wikipedia.org/wiki/IEEE_floating_point)." -scalar Float - -"The `String`scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text." -scalar String - -"The `Boolean` scalar type represents `true` or `false`." -scalar Boolean - -"""The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "4") or integer (such as 4) input value will be accepted as an ID.""" -scalar ID - -"The @include directive may be provided for fields, fragment spreads, and inline fragments, and allows for conditional inclusion during execution as described by the if argument." -directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT - -"The @skip directive may be provided for fields, fragment spreads, and inline fragments, and allows for conditional exclusion during execution as described by the if argument." -directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT - -"The @deprecated built-in directive is used within the type system definition language to indicate deprecated portions of a GraphQL service's schema, such as deprecated fields on a type, arguments on a field, input fields on an input type, or values of an enum type." -directive @deprecated(reason: String = "No longer supported") on FIELD_DEFINITION | ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION | ENUM_VALUE - -"The @specifiedBy built-in directive is used within the type system definition language to provide a scalar specification URL for specifying the behavior of custom scalar types." -directive @specifiedBy(url: String!) on SCALAR - -type __Schema { - description: String - types: [__Type!]! - queryType: __Type! - mutationType: __Type - subscriptionType: __Type - directives: [__Directive!]! -} - -type __Type { - kind: __TypeKind! - name: String - description: String - # must be non-null for OBJECT and INTERFACE, otherwise null. - fields(includeDeprecated: Boolean = false): [__Field!] - # must be non-null for OBJECT and INTERFACE, otherwise null. - interfaces: [__Type!] - # must be non-null for INTERFACE and UNION, otherwise null. - possibleTypes: [__Type!] - # must be non-null for ENUM, otherwise null. - enumValues(includeDeprecated: Boolean = false): [__EnumValue!] - # must be non-null for INPUT_OBJECT, otherwise null. - inputFields: [__InputValue!] - # must be non-null for NON_NULL and LIST, otherwise null. - ofType: __Type - # may be non-null for custom SCALAR, otherwise null. - specifiedByURL: String -} - -type __Field { - name: String! - description: String - args: [__InputValue!]! - type: __Type! - isDeprecated: Boolean! - deprecationReason: String -} - -type __InputValue { - name: String! - description: String - type: __Type! - defaultValue: String -} - -type __EnumValue { - name: String! - description: String - isDeprecated: Boolean! - deprecationReason: String -} - -enum __TypeKind { - SCALAR - OBJECT - INTERFACE - UNION - ENUM - INPUT_OBJECT - LIST - NON_NULL -} - -type __Directive { - name: String! - description: String - locations: [__DirectiveLocation!]! - args: [__InputValue!]! - isRepeatable: Boolean! -} - -enum __DirectiveLocation { - QUERY - MUTATION - SUBSCRIPTION - FIELD - FRAGMENT_DEFINITION - FRAGMENT_SPREAD - INLINE_FRAGMENT - VARIABLE_DEFINITION - SCHEMA - SCALAR - OBJECT - FIELD_DEFINITION - ARGUMENT_DEFINITION - INTERFACE - UNION - ENUM - ENUM_VALUE - INPUT_OBJECT - INPUT_FIELD_DEFINITION -} diff --git a/vendor/github.com/vektah/gqlparser/v2/validator/rules/fields_on_correct_type.go b/vendor/github.com/vektah/gqlparser/v2/validator/rules/fields_on_correct_type.go deleted file mode 100644 index aa83c6967e..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/validator/rules/fields_on_correct_type.go +++ /dev/null @@ -1,94 +0,0 @@ -package validator - -import ( - "fmt" - "sort" - "strings" - - "github.com/vektah/gqlparser/v2/ast" - . "github.com/vektah/gqlparser/v2/validator" -) - -func init() { - AddRule("FieldsOnCorrectType", func(observers *Events, addError AddErrFunc) { - observers.OnField(func(walker *Walker, field *ast.Field) { - if field.ObjectDefinition == nil || field.Definition != nil { - return - } - - message := fmt.Sprintf(`Cannot query field "%s" on type "%s".`, field.Name, field.ObjectDefinition.Name) - - if suggestedTypeNames := getSuggestedTypeNames(walker, field.ObjectDefinition, field.Name); suggestedTypeNames != nil { - message += " Did you mean to use an inline fragment on " + QuotedOrList(suggestedTypeNames...) + "?" - } else if suggestedFieldNames := getSuggestedFieldNames(field.ObjectDefinition, field.Name); suggestedFieldNames != nil { - message += " Did you mean " + QuotedOrList(suggestedFieldNames...) + "?" - } - - addError( - Message(message), - At(field.Position), - ) - }) - }) -} - -// Go through all of the implementations of type, as well as the interfaces -// that they implement. If any of those types include the provided field, -// suggest them, sorted by how often the type is referenced, starting -// with Interfaces. -func getSuggestedTypeNames(walker *Walker, parent *ast.Definition, name string) []string { - if !parent.IsAbstractType() { - return nil - } - - var suggestedObjectTypes []string - var suggestedInterfaceTypes []string - interfaceUsageCount := map[string]int{} - - for _, possibleType := range walker.Schema.GetPossibleTypes(parent) { - field := possibleType.Fields.ForName(name) - if field == nil { - continue - } - - suggestedObjectTypes = append(suggestedObjectTypes, possibleType.Name) - - for _, possibleInterface := range possibleType.Interfaces { - interfaceField := walker.Schema.Types[possibleInterface] - if interfaceField != nil && interfaceField.Fields.ForName(name) != nil { - if interfaceUsageCount[possibleInterface] == 0 { - suggestedInterfaceTypes = append(suggestedInterfaceTypes, possibleInterface) - } - interfaceUsageCount[possibleInterface]++ - } - } - } - - suggestedTypes := append(suggestedInterfaceTypes, suggestedObjectTypes...) - - sort.SliceStable(suggestedTypes, func(i, j int) bool { - typeA, typeB := suggestedTypes[i], suggestedTypes[j] - diff := interfaceUsageCount[typeB] - interfaceUsageCount[typeA] - if diff != 0 { - return diff < 0 - } - return strings.Compare(typeA, typeB) < 0 - }) - - return suggestedTypes -} - -// For the field name provided, determine if there are any similar field names -// that may be the result of a typo. -func getSuggestedFieldNames(parent *ast.Definition, name string) []string { - if parent.Kind != ast.Object && parent.Kind != ast.Interface { - return nil - } - - var possibleFieldNames []string - for _, field := range parent.Fields { - possibleFieldNames = append(possibleFieldNames, field.Name) - } - - return SuggestionList(name, possibleFieldNames) -} diff --git a/vendor/github.com/vektah/gqlparser/v2/validator/rules/fragments_on_composite_types.go b/vendor/github.com/vektah/gqlparser/v2/validator/rules/fragments_on_composite_types.go deleted file mode 100644 index 5215f697e7..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/validator/rules/fragments_on_composite_types.go +++ /dev/null @@ -1,39 +0,0 @@ -package validator - -import ( - "fmt" - - "github.com/vektah/gqlparser/v2/ast" - . "github.com/vektah/gqlparser/v2/validator" -) - -func init() { - AddRule("FragmentsOnCompositeTypes", func(observers *Events, addError AddErrFunc) { - observers.OnInlineFragment(func(walker *Walker, inlineFragment *ast.InlineFragment) { - fragmentType := walker.Schema.Types[inlineFragment.TypeCondition] - if fragmentType == nil || fragmentType.IsCompositeType() { - return - } - - message := fmt.Sprintf(`Fragment cannot condition on non composite type "%s".`, inlineFragment.TypeCondition) - - addError( - Message(message), - At(inlineFragment.Position), - ) - }) - - observers.OnFragment(func(walker *Walker, fragment *ast.FragmentDefinition) { - if fragment.Definition == nil || fragment.TypeCondition == "" || fragment.Definition.IsCompositeType() { - return - } - - message := fmt.Sprintf(`Fragment "%s" cannot condition on non composite type "%s".`, fragment.Name, fragment.TypeCondition) - - addError( - Message(message), - At(fragment.Position), - ) - }) - }) -} diff --git a/vendor/github.com/vektah/gqlparser/v2/validator/rules/known_argument_names.go b/vendor/github.com/vektah/gqlparser/v2/validator/rules/known_argument_names.go deleted file mode 100644 index da5a796218..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/validator/rules/known_argument_names.go +++ /dev/null @@ -1,57 +0,0 @@ -package validator - -import ( - "github.com/vektah/gqlparser/v2/ast" - . "github.com/vektah/gqlparser/v2/validator" -) - -func init() { - AddRule("KnownArgumentNames", func(observers *Events, addError AddErrFunc) { - // A GraphQL field is only valid if all supplied arguments are defined by that field. - observers.OnField(func(walker *Walker, field *ast.Field) { - if field.Definition == nil || field.ObjectDefinition == nil { - return - } - for _, arg := range field.Arguments { - def := field.Definition.Arguments.ForName(arg.Name) - if def != nil { - continue - } - - var suggestions []string - for _, argDef := range field.Definition.Arguments { - suggestions = append(suggestions, argDef.Name) - } - - addError( - Message(`Unknown argument "%s" on field "%s.%s".`, arg.Name, field.ObjectDefinition.Name, field.Name), - SuggestListQuoted("Did you mean", arg.Name, suggestions), - At(field.Position), - ) - } - }) - - observers.OnDirective(func(walker *Walker, directive *ast.Directive) { - if directive.Definition == nil { - return - } - for _, arg := range directive.Arguments { - def := directive.Definition.Arguments.ForName(arg.Name) - if def != nil { - continue - } - - var suggestions []string - for _, argDef := range directive.Definition.Arguments { - suggestions = append(suggestions, argDef.Name) - } - - addError( - Message(`Unknown argument "%s" on directive "@%s".`, arg.Name, directive.Name), - SuggestListQuoted("Did you mean", arg.Name, suggestions), - At(directive.Position), - ) - } - }) - }) -} diff --git a/vendor/github.com/vektah/gqlparser/v2/validator/rules/known_directives.go b/vendor/github.com/vektah/gqlparser/v2/validator/rules/known_directives.go deleted file mode 100644 index 18fe41fd78..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/validator/rules/known_directives.go +++ /dev/null @@ -1,47 +0,0 @@ -package validator - -import ( - "github.com/vektah/gqlparser/v2/ast" - . "github.com/vektah/gqlparser/v2/validator" -) - -func init() { - AddRule("KnownDirectives", func(observers *Events, addError AddErrFunc) { - type mayNotBeUsedDirective struct { - Name string - Line int - Column int - } - var seen map[mayNotBeUsedDirective]bool = map[mayNotBeUsedDirective]bool{} - observers.OnDirective(func(walker *Walker, directive *ast.Directive) { - if directive.Definition == nil { - addError( - Message(`Unknown directive "@%s".`, directive.Name), - At(directive.Position), - ) - return - } - - for _, loc := range directive.Definition.Locations { - if loc == directive.Location { - return - } - } - - // position must be exists if directive.Definition != nil - tmp := mayNotBeUsedDirective{ - Name: directive.Name, - Line: directive.Position.Line, - Column: directive.Position.Column, - } - - if !seen[tmp] { - addError( - Message(`Directive "@%s" may not be used on %s.`, directive.Name, directive.Location), - At(directive.Position), - ) - seen[tmp] = true - } - }) - }) -} diff --git a/vendor/github.com/vektah/gqlparser/v2/validator/rules/known_fragment_names.go b/vendor/github.com/vektah/gqlparser/v2/validator/rules/known_fragment_names.go deleted file mode 100644 index b7427d0d0d..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/validator/rules/known_fragment_names.go +++ /dev/null @@ -1,19 +0,0 @@ -package validator - -import ( - "github.com/vektah/gqlparser/v2/ast" - . "github.com/vektah/gqlparser/v2/validator" -) - -func init() { - AddRule("KnownFragmentNames", func(observers *Events, addError AddErrFunc) { - observers.OnFragmentSpread(func(walker *Walker, fragmentSpread *ast.FragmentSpread) { - if fragmentSpread.Definition == nil { - addError( - Message(`Unknown fragment "%s".`, fragmentSpread.Name), - At(fragmentSpread.Position), - ) - } - }) - }) -} diff --git a/vendor/github.com/vektah/gqlparser/v2/validator/rules/known_root_type.go b/vendor/github.com/vektah/gqlparser/v2/validator/rules/known_root_type.go deleted file mode 100644 index 4c60c8d8c2..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/validator/rules/known_root_type.go +++ /dev/null @@ -1,35 +0,0 @@ -package validator - -import ( - "fmt" - - "github.com/vektah/gqlparser/v2/ast" - . "github.com/vektah/gqlparser/v2/validator" -) - -func init() { - AddRule("KnownRootType", func(observers *Events, addError AddErrFunc) { - // A query's root must be a valid type. Surprisingly, this isn't - // checked anywhere else! - observers.OnOperation(func(walker *Walker, operation *ast.OperationDefinition) { - var def *ast.Definition - switch operation.Operation { - case ast.Query, "": - def = walker.Schema.Query - case ast.Mutation: - def = walker.Schema.Mutation - case ast.Subscription: - def = walker.Schema.Subscription - default: - // This shouldn't even parse; if it did we probably need to - // update this switch block to add the new operation type. - panic(fmt.Sprintf(`got unknown operation type "%s"`, operation.Operation)) - } - if def == nil { - addError( - Message(`Schema does not support operation type "%s"`, operation.Operation), - At(operation.Position)) - } - }) - }) -} diff --git a/vendor/github.com/vektah/gqlparser/v2/validator/rules/known_type_names.go b/vendor/github.com/vektah/gqlparser/v2/validator/rules/known_type_names.go deleted file mode 100644 index 7abfbf62f1..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/validator/rules/known_type_names.go +++ /dev/null @@ -1,59 +0,0 @@ -package validator - -import ( - "github.com/vektah/gqlparser/v2/ast" - . "github.com/vektah/gqlparser/v2/validator" -) - -func init() { - AddRule("KnownTypeNames", func(observers *Events, addError AddErrFunc) { - observers.OnVariable(func(walker *Walker, variable *ast.VariableDefinition) { - typeName := variable.Type.Name() - typdef := walker.Schema.Types[typeName] - if typdef != nil { - return - } - - addError( - Message(`Unknown type "%s".`, typeName), - At(variable.Position), - ) - }) - - observers.OnInlineFragment(func(walker *Walker, inlineFragment *ast.InlineFragment) { - typedName := inlineFragment.TypeCondition - if typedName == "" { - return - } - - def := walker.Schema.Types[typedName] - if def != nil { - return - } - - addError( - Message(`Unknown type "%s".`, typedName), - At(inlineFragment.Position), - ) - }) - - observers.OnFragment(func(walker *Walker, fragment *ast.FragmentDefinition) { - typeName := fragment.TypeCondition - def := walker.Schema.Types[typeName] - if def != nil { - return - } - - var possibleTypes []string - for _, t := range walker.Schema.Types { - possibleTypes = append(possibleTypes, t.Name) - } - - addError( - Message(`Unknown type "%s".`, typeName), - SuggestListQuoted("Did you mean", typeName, possibleTypes), - At(fragment.Position), - ) - }) - }) -} diff --git a/vendor/github.com/vektah/gqlparser/v2/validator/rules/lone_anonymous_operation.go b/vendor/github.com/vektah/gqlparser/v2/validator/rules/lone_anonymous_operation.go deleted file mode 100644 index d275285425..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/validator/rules/lone_anonymous_operation.go +++ /dev/null @@ -1,19 +0,0 @@ -package validator - -import ( - "github.com/vektah/gqlparser/v2/ast" - . "github.com/vektah/gqlparser/v2/validator" -) - -func init() { - AddRule("LoneAnonymousOperation", func(observers *Events, addError AddErrFunc) { - observers.OnOperation(func(walker *Walker, operation *ast.OperationDefinition) { - if operation.Name == "" && len(walker.Document.Operations) > 1 { - addError( - Message(`This anonymous operation must be the only defined operation.`), - At(operation.Position), - ) - } - }) - }) -} diff --git a/vendor/github.com/vektah/gqlparser/v2/validator/rules/no_fragment_cycles.go b/vendor/github.com/vektah/gqlparser/v2/validator/rules/no_fragment_cycles.go deleted file mode 100644 index da73f3499f..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/validator/rules/no_fragment_cycles.go +++ /dev/null @@ -1,93 +0,0 @@ -package validator - -import ( - "fmt" - "strings" - - "github.com/vektah/gqlparser/v2/ast" - . "github.com/vektah/gqlparser/v2/validator" -) - -func init() { - AddRule("NoFragmentCycles", func(observers *Events, addError AddErrFunc) { - visitedFrags := make(map[string]bool) - - observers.OnFragment(func(walker *Walker, fragment *ast.FragmentDefinition) { - var spreadPath []*ast.FragmentSpread - spreadPathIndexByName := make(map[string]int) - - var recursive func(fragment *ast.FragmentDefinition) - recursive = func(fragment *ast.FragmentDefinition) { - if visitedFrags[fragment.Name] { - return - } - - visitedFrags[fragment.Name] = true - - spreadNodes := getFragmentSpreads(fragment.SelectionSet) - if len(spreadNodes) == 0 { - return - } - spreadPathIndexByName[fragment.Name] = len(spreadPath) - - for _, spreadNode := range spreadNodes { - spreadName := spreadNode.Name - - cycleIndex, ok := spreadPathIndexByName[spreadName] - - spreadPath = append(spreadPath, spreadNode) - if !ok { - spreadFragment := walker.Document.Fragments.ForName(spreadName) - if spreadFragment != nil { - recursive(spreadFragment) - } - } else { - cyclePath := spreadPath[cycleIndex : len(spreadPath)-1] - var fragmentNames []string - for _, fs := range cyclePath { - fragmentNames = append(fragmentNames, fmt.Sprintf(`"%s"`, fs.Name)) - } - var via string - if len(fragmentNames) != 0 { - via = fmt.Sprintf(" via %s", strings.Join(fragmentNames, ", ")) - } - addError( - Message(`Cannot spread fragment "%s" within itself%s.`, spreadName, via), - At(spreadNode.Position), - ) - } - - spreadPath = spreadPath[:len(spreadPath)-1] - } - - delete(spreadPathIndexByName, fragment.Name) - } - - recursive(fragment) - }) - }) -} - -func getFragmentSpreads(node ast.SelectionSet) []*ast.FragmentSpread { - var spreads []*ast.FragmentSpread - - setsToVisit := []ast.SelectionSet{node} - - for len(setsToVisit) != 0 { - set := setsToVisit[len(setsToVisit)-1] - setsToVisit = setsToVisit[:len(setsToVisit)-1] - - for _, selection := range set { - switch selection := selection.(type) { - case *ast.FragmentSpread: - spreads = append(spreads, selection) - case *ast.Field: - setsToVisit = append(setsToVisit, selection.SelectionSet) - case *ast.InlineFragment: - setsToVisit = append(setsToVisit, selection.SelectionSet) - } - } - } - - return spreads -} diff --git a/vendor/github.com/vektah/gqlparser/v2/validator/rules/no_undefined_variables.go b/vendor/github.com/vektah/gqlparser/v2/validator/rules/no_undefined_variables.go deleted file mode 100644 index 91df727a25..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/validator/rules/no_undefined_variables.go +++ /dev/null @@ -1,28 +0,0 @@ -package validator - -import ( - "github.com/vektah/gqlparser/v2/ast" - . "github.com/vektah/gqlparser/v2/validator" -) - -func init() { - AddRule("NoUndefinedVariables", func(observers *Events, addError AddErrFunc) { - observers.OnValue(func(walker *Walker, value *ast.Value) { - if walker.CurrentOperation == nil || value.Kind != ast.Variable || value.VariableDefinition != nil { - return - } - - if walker.CurrentOperation.Name != "" { - addError( - Message(`Variable "%s" is not defined by operation "%s".`, value, walker.CurrentOperation.Name), - At(value.Position), - ) - } else { - addError( - Message(`Variable "%s" is not defined.`, value), - At(value.Position), - ) - } - }) - }) -} diff --git a/vendor/github.com/vektah/gqlparser/v2/validator/rules/no_unused_fragments.go b/vendor/github.com/vektah/gqlparser/v2/validator/rules/no_unused_fragments.go deleted file mode 100644 index dfc896725a..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/validator/rules/no_unused_fragments.go +++ /dev/null @@ -1,30 +0,0 @@ -package validator - -import ( - "github.com/vektah/gqlparser/v2/ast" - . "github.com/vektah/gqlparser/v2/validator" -) - -func init() { - AddRule("NoUnusedFragments", func(observers *Events, addError AddErrFunc) { - - inFragmentDefinition := false - fragmentNameUsed := make(map[string]bool) - - observers.OnFragmentSpread(func(walker *Walker, fragmentSpread *ast.FragmentSpread) { - if !inFragmentDefinition { - fragmentNameUsed[fragmentSpread.Name] = true - } - }) - - observers.OnFragment(func(walker *Walker, fragment *ast.FragmentDefinition) { - inFragmentDefinition = true - if !fragmentNameUsed[fragment.Name] { - addError( - Message(`Fragment "%s" is never used.`, fragment.Name), - At(fragment.Position), - ) - } - }) - }) -} diff --git a/vendor/github.com/vektah/gqlparser/v2/validator/rules/no_unused_variables.go b/vendor/github.com/vektah/gqlparser/v2/validator/rules/no_unused_variables.go deleted file mode 100644 index df2e5f4b7f..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/validator/rules/no_unused_variables.go +++ /dev/null @@ -1,30 +0,0 @@ -package validator - -import ( - "github.com/vektah/gqlparser/v2/ast" - . "github.com/vektah/gqlparser/v2/validator" -) - -func init() { - AddRule("NoUnusedVariables", func(observers *Events, addError AddErrFunc) { - observers.OnOperation(func(walker *Walker, operation *ast.OperationDefinition) { - for _, varDef := range operation.VariableDefinitions { - if varDef.Used { - continue - } - - if operation.Name != "" { - addError( - Message(`Variable "$%s" is never used in operation "%s".`, varDef.Variable, operation.Name), - At(varDef.Position), - ) - } else { - addError( - Message(`Variable "$%s" is never used.`, varDef.Variable), - At(varDef.Position), - ) - } - } - }) - }) -} diff --git a/vendor/github.com/vektah/gqlparser/v2/validator/rules/overlapping_fields_can_be_merged.go b/vendor/github.com/vektah/gqlparser/v2/validator/rules/overlapping_fields_can_be_merged.go deleted file mode 100644 index 38e1efa11b..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/validator/rules/overlapping_fields_can_be_merged.go +++ /dev/null @@ -1,560 +0,0 @@ -package validator - -import ( - "bytes" - "fmt" - "reflect" - - "github.com/vektah/gqlparser/v2/ast" - . "github.com/vektah/gqlparser/v2/validator" -) - -func init() { - - AddRule("OverlappingFieldsCanBeMerged", func(observers *Events, addError AddErrFunc) { - /** - * Algorithm: - * - * Conflicts occur when two fields exist in a query which will produce the same - * response name, but represent differing values, thus creating a conflict. - * The algorithm below finds all conflicts via making a series of comparisons - * between fields. In order to compare as few fields as possible, this makes - * a series of comparisons "within" sets of fields and "between" sets of fields. - * - * Given any selection set, a collection produces both a set of fields by - * also including all inline fragments, as well as a list of fragments - * referenced by fragment spreads. - * - * A) Each selection set represented in the document first compares "within" its - * collected set of fields, finding any conflicts between every pair of - * overlapping fields. - * Note: This is the *only time* that a the fields "within" a set are compared - * to each other. After this only fields "between" sets are compared. - * - * B) Also, if any fragment is referenced in a selection set, then a - * comparison is made "between" the original set of fields and the - * referenced fragment. - * - * C) Also, if multiple fragments are referenced, then comparisons - * are made "between" each referenced fragment. - * - * D) When comparing "between" a set of fields and a referenced fragment, first - * a comparison is made between each field in the original set of fields and - * each field in the the referenced set of fields. - * - * E) Also, if any fragment is referenced in the referenced selection set, - * then a comparison is made "between" the original set of fields and the - * referenced fragment (recursively referring to step D). - * - * F) When comparing "between" two fragments, first a comparison is made between - * each field in the first referenced set of fields and each field in the the - * second referenced set of fields. - * - * G) Also, any fragments referenced by the first must be compared to the - * second, and any fragments referenced by the second must be compared to the - * first (recursively referring to step F). - * - * H) When comparing two fields, if both have selection sets, then a comparison - * is made "between" both selection sets, first comparing the set of fields in - * the first selection set with the set of fields in the second. - * - * I) Also, if any fragment is referenced in either selection set, then a - * comparison is made "between" the other set of fields and the - * referenced fragment. - * - * J) Also, if two fragments are referenced in both selection sets, then a - * comparison is made "between" the two fragments. - * - */ - - m := &overlappingFieldsCanBeMergedManager{ - comparedFragmentPairs: pairSet{data: make(map[string]map[string]bool)}, - } - - observers.OnOperation(func(walker *Walker, operation *ast.OperationDefinition) { - m.walker = walker - conflicts := m.findConflictsWithinSelectionSet(operation.SelectionSet) - for _, conflict := range conflicts { - conflict.addFieldsConflictMessage(addError) - } - }) - observers.OnField(func(walker *Walker, field *ast.Field) { - if walker.CurrentOperation == nil { - // When checking both Operation and Fragment, errors are duplicated when processing FragmentDefinition referenced from Operation - return - } - m.walker = walker - conflicts := m.findConflictsWithinSelectionSet(field.SelectionSet) - for _, conflict := range conflicts { - conflict.addFieldsConflictMessage(addError) - } - }) - observers.OnInlineFragment(func(walker *Walker, inlineFragment *ast.InlineFragment) { - m.walker = walker - conflicts := m.findConflictsWithinSelectionSet(inlineFragment.SelectionSet) - for _, conflict := range conflicts { - conflict.addFieldsConflictMessage(addError) - } - }) - observers.OnFragment(func(walker *Walker, fragment *ast.FragmentDefinition) { - m.walker = walker - conflicts := m.findConflictsWithinSelectionSet(fragment.SelectionSet) - for _, conflict := range conflicts { - conflict.addFieldsConflictMessage(addError) - } - }) - }) -} - -type pairSet struct { - data map[string]map[string]bool -} - -func (pairSet *pairSet) Add(a *ast.FragmentSpread, b *ast.FragmentSpread, areMutuallyExclusive bool) { - add := func(a *ast.FragmentSpread, b *ast.FragmentSpread) { - m := pairSet.data[a.Name] - if m == nil { - m = make(map[string]bool) - pairSet.data[a.Name] = m - } - m[b.Name] = areMutuallyExclusive - } - add(a, b) - add(b, a) -} - -func (pairSet *pairSet) Has(a *ast.FragmentSpread, b *ast.FragmentSpread, areMutuallyExclusive bool) bool { - am, ok := pairSet.data[a.Name] - if !ok { - return false - } - result, ok := am[b.Name] - if !ok { - return false - } - - // areMutuallyExclusive being false is a superset of being true, - // hence if we want to know if this PairSet "has" these two with no - // exclusivity, we have to ensure it was added as such. - if !areMutuallyExclusive { - return !result - } - - return true -} - -type sequentialFieldsMap struct { - // We can't use map[string][]*ast.Field. because map is not stable... - seq []string - data map[string][]*ast.Field -} - -type fieldIterateEntry struct { - ResponseName string - Fields []*ast.Field -} - -func (m *sequentialFieldsMap) Push(responseName string, field *ast.Field) { - fields, ok := m.data[responseName] - if !ok { - m.seq = append(m.seq, responseName) - } - fields = append(fields, field) - m.data[responseName] = fields -} - -func (m *sequentialFieldsMap) Get(responseName string) ([]*ast.Field, bool) { - fields, ok := m.data[responseName] - return fields, ok -} - -func (m *sequentialFieldsMap) Iterator() [][]*ast.Field { - fieldsList := make([][]*ast.Field, 0, len(m.seq)) - for _, responseName := range m.seq { - fields := m.data[responseName] - fieldsList = append(fieldsList, fields) - } - return fieldsList -} - -func (m *sequentialFieldsMap) KeyValueIterator() []*fieldIterateEntry { - fieldEntriesList := make([]*fieldIterateEntry, 0, len(m.seq)) - for _, responseName := range m.seq { - fields := m.data[responseName] - fieldEntriesList = append(fieldEntriesList, &fieldIterateEntry{ - ResponseName: responseName, - Fields: fields, - }) - } - return fieldEntriesList -} - -type conflictMessageContainer struct { - Conflicts []*ConflictMessage -} - -type ConflictMessage struct { - Message string - ResponseName string - Names []string - SubMessage []*ConflictMessage - Position *ast.Position -} - -func (m *ConflictMessage) String(buf *bytes.Buffer) { - if len(m.SubMessage) == 0 { - buf.WriteString(m.Message) - return - } - - for idx, subMessage := range m.SubMessage { - buf.WriteString(`subfields "`) - buf.WriteString(subMessage.ResponseName) - buf.WriteString(`" conflict because `) - subMessage.String(buf) - if idx != len(m.SubMessage)-1 { - buf.WriteString(" and ") - } - } -} - -func (m *ConflictMessage) addFieldsConflictMessage(addError AddErrFunc) { - var buf bytes.Buffer - m.String(&buf) - addError( - Message(`Fields "%s" conflict because %s. Use different aliases on the fields to fetch both if this was intentional.`, m.ResponseName, buf.String()), - At(m.Position), - ) -} - -type overlappingFieldsCanBeMergedManager struct { - walker *Walker - - // per walker - comparedFragmentPairs pairSet - // cachedFieldsAndFragmentNames interface{} - - // per selectionSet - comparedFragments map[string]bool -} - -func (m *overlappingFieldsCanBeMergedManager) findConflictsWithinSelectionSet(selectionSet ast.SelectionSet) []*ConflictMessage { - if len(selectionSet) == 0 { - return nil - } - - fieldsMap, fragmentSpreads := getFieldsAndFragmentNames(selectionSet) - - var conflicts conflictMessageContainer - - // (A) Find find all conflicts "within" the fieldMap of this selection set. - // Note: this is the *only place* `collectConflictsWithin` is called. - m.collectConflictsWithin(&conflicts, fieldsMap) - - m.comparedFragments = make(map[string]bool) - for idx, fragmentSpreadA := range fragmentSpreads { - // (B) Then collect conflicts between these fieldMap and those represented by - // each spread fragment name found. - m.collectConflictsBetweenFieldsAndFragment(&conflicts, false, fieldsMap, fragmentSpreadA) - - for _, fragmentSpreadB := range fragmentSpreads[idx+1:] { - // (C) Then compare this fragment with all other fragments found in this - // selection set to collect conflicts between fragments spread together. - // This compares each item in the list of fragment names to every other - // item in that same list (except for itself). - m.collectConflictsBetweenFragments(&conflicts, false, fragmentSpreadA, fragmentSpreadB) - } - } - - return conflicts.Conflicts -} - -func (m *overlappingFieldsCanBeMergedManager) collectConflictsBetweenFieldsAndFragment(conflicts *conflictMessageContainer, areMutuallyExclusive bool, fieldsMap *sequentialFieldsMap, fragmentSpread *ast.FragmentSpread) { - if m.comparedFragments[fragmentSpread.Name] { - return - } - m.comparedFragments[fragmentSpread.Name] = true - - if fragmentSpread.Definition == nil { - return - } - - fieldsMapB, fragmentSpreads := getFieldsAndFragmentNames(fragmentSpread.Definition.SelectionSet) - - // Do not compare a fragment's fieldMap to itself. - if reflect.DeepEqual(fieldsMap, fieldsMapB) { - return - } - - // (D) First collect any conflicts between the provided collection of fields - // and the collection of fields represented by the given fragment. - m.collectConflictsBetween(conflicts, areMutuallyExclusive, fieldsMap, fieldsMapB) - - // (E) Then collect any conflicts between the provided collection of fields - // and any fragment names found in the given fragment. - baseFragmentSpread := fragmentSpread - for _, fragmentSpread := range fragmentSpreads { - if fragmentSpread.Name == baseFragmentSpread.Name { - continue - } - m.collectConflictsBetweenFieldsAndFragment(conflicts, areMutuallyExclusive, fieldsMap, fragmentSpread) - } -} - -func (m *overlappingFieldsCanBeMergedManager) collectConflictsBetweenFragments(conflicts *conflictMessageContainer, areMutuallyExclusive bool, fragmentSpreadA *ast.FragmentSpread, fragmentSpreadB *ast.FragmentSpread) { - - var check func(fragmentSpreadA *ast.FragmentSpread, fragmentSpreadB *ast.FragmentSpread) - check = func(fragmentSpreadA *ast.FragmentSpread, fragmentSpreadB *ast.FragmentSpread) { - - if fragmentSpreadA.Name == fragmentSpreadB.Name { - return - } - - if m.comparedFragmentPairs.Has(fragmentSpreadA, fragmentSpreadB, areMutuallyExclusive) { - return - } - m.comparedFragmentPairs.Add(fragmentSpreadA, fragmentSpreadB, areMutuallyExclusive) - - if fragmentSpreadA.Definition == nil { - return - } - if fragmentSpreadB.Definition == nil { - return - } - - fieldsMapA, fragmentSpreadsA := getFieldsAndFragmentNames(fragmentSpreadA.Definition.SelectionSet) - fieldsMapB, fragmentSpreadsB := getFieldsAndFragmentNames(fragmentSpreadB.Definition.SelectionSet) - - // (F) First, collect all conflicts between these two collections of fields - // (not including any nested fragments). - m.collectConflictsBetween(conflicts, areMutuallyExclusive, fieldsMapA, fieldsMapB) - - // (G) Then collect conflicts between the first fragment and any nested - // fragments spread in the second fragment. - for _, fragmentSpread := range fragmentSpreadsB { - check(fragmentSpreadA, fragmentSpread) - } - // (G) Then collect conflicts between the second fragment and any nested - // fragments spread in the first fragment. - for _, fragmentSpread := range fragmentSpreadsA { - check(fragmentSpread, fragmentSpreadB) - } - } - - check(fragmentSpreadA, fragmentSpreadB) -} - -func (m *overlappingFieldsCanBeMergedManager) findConflictsBetweenSubSelectionSets(areMutuallyExclusive bool, selectionSetA ast.SelectionSet, selectionSetB ast.SelectionSet) *conflictMessageContainer { - var conflicts conflictMessageContainer - - fieldsMapA, fragmentSpreadsA := getFieldsAndFragmentNames(selectionSetA) - fieldsMapB, fragmentSpreadsB := getFieldsAndFragmentNames(selectionSetB) - - // (H) First, collect all conflicts between these two collections of field. - m.collectConflictsBetween(&conflicts, areMutuallyExclusive, fieldsMapA, fieldsMapB) - - // (I) Then collect conflicts between the first collection of fields and - // those referenced by each fragment name associated with the second. - for _, fragmentSpread := range fragmentSpreadsB { - m.comparedFragments = make(map[string]bool) - m.collectConflictsBetweenFieldsAndFragment(&conflicts, areMutuallyExclusive, fieldsMapA, fragmentSpread) - } - - // (I) Then collect conflicts between the second collection of fields and - // those referenced by each fragment name associated with the first. - for _, fragmentSpread := range fragmentSpreadsA { - m.comparedFragments = make(map[string]bool) - m.collectConflictsBetweenFieldsAndFragment(&conflicts, areMutuallyExclusive, fieldsMapB, fragmentSpread) - } - - // (J) Also collect conflicts between any fragment names by the first and - // fragment names by the second. This compares each item in the first set of - // names to each item in the second set of names. - for _, fragmentSpreadA := range fragmentSpreadsA { - for _, fragmentSpreadB := range fragmentSpreadsB { - m.collectConflictsBetweenFragments(&conflicts, areMutuallyExclusive, fragmentSpreadA, fragmentSpreadB) - } - } - - if len(conflicts.Conflicts) == 0 { - return nil - } - - return &conflicts -} - -func (m *overlappingFieldsCanBeMergedManager) collectConflictsWithin(conflicts *conflictMessageContainer, fieldsMap *sequentialFieldsMap) { - for _, fields := range fieldsMap.Iterator() { - for idx, fieldA := range fields { - for _, fieldB := range fields[idx+1:] { - conflict := m.findConflict(false, fieldA, fieldB) - if conflict != nil { - conflicts.Conflicts = append(conflicts.Conflicts, conflict) - } - } - } - } -} - -func (m *overlappingFieldsCanBeMergedManager) collectConflictsBetween(conflicts *conflictMessageContainer, parentFieldsAreMutuallyExclusive bool, fieldsMapA *sequentialFieldsMap, fieldsMapB *sequentialFieldsMap) { - for _, fieldsEntryA := range fieldsMapA.KeyValueIterator() { - fieldsB, ok := fieldsMapB.Get(fieldsEntryA.ResponseName) - if !ok { - continue - } - for _, fieldA := range fieldsEntryA.Fields { - for _, fieldB := range fieldsB { - conflict := m.findConflict(parentFieldsAreMutuallyExclusive, fieldA, fieldB) - if conflict != nil { - conflicts.Conflicts = append(conflicts.Conflicts, conflict) - } - } - } - } -} - -func (m *overlappingFieldsCanBeMergedManager) findConflict(parentFieldsAreMutuallyExclusive bool, fieldA *ast.Field, fieldB *ast.Field) *ConflictMessage { - if fieldA.ObjectDefinition == nil || fieldB.ObjectDefinition == nil { - return nil - } - - areMutuallyExclusive := parentFieldsAreMutuallyExclusive - if !areMutuallyExclusive { - tmp := fieldA.ObjectDefinition.Name != fieldB.ObjectDefinition.Name - tmp = tmp && fieldA.ObjectDefinition.Kind == ast.Object - tmp = tmp && fieldB.ObjectDefinition.Kind == ast.Object - tmp = tmp && fieldA.Definition != nil && fieldB.Definition != nil - areMutuallyExclusive = tmp - } - - fieldNameA := fieldA.Name - if fieldA.Alias != "" { - fieldNameA = fieldA.Alias - } - - if !areMutuallyExclusive { - // Two aliases must refer to the same field. - if fieldA.Name != fieldB.Name { - return &ConflictMessage{ - ResponseName: fieldNameA, - Message: fmt.Sprintf(`"%s" and "%s" are different fields`, fieldA.Name, fieldB.Name), - Position: fieldB.Position, - } - } - - // Two field calls must have the same arguments. - if !sameArguments(fieldA.Arguments, fieldB.Arguments) { - return &ConflictMessage{ - ResponseName: fieldNameA, - Message: "they have differing arguments", - Position: fieldB.Position, - } - } - } - - if fieldA.Definition != nil && fieldB.Definition != nil && doTypesConflict(m.walker, fieldA.Definition.Type, fieldB.Definition.Type) { - return &ConflictMessage{ - ResponseName: fieldNameA, - Message: fmt.Sprintf(`they return conflicting types "%s" and "%s"`, fieldA.Definition.Type.String(), fieldB.Definition.Type.String()), - Position: fieldB.Position, - } - } - - // Collect and compare sub-fields. Use the same "visited fragment names" list - // for both collections so fields in a fragment reference are never - // compared to themselves. - conflicts := m.findConflictsBetweenSubSelectionSets(areMutuallyExclusive, fieldA.SelectionSet, fieldB.SelectionSet) - if conflicts == nil { - return nil - } - return &ConflictMessage{ - ResponseName: fieldNameA, - SubMessage: conflicts.Conflicts, - Position: fieldB.Position, - } -} - -func sameArguments(args1 []*ast.Argument, args2 []*ast.Argument) bool { - if len(args1) != len(args2) { - return false - } - for _, arg1 := range args1 { - var matched bool - for _, arg2 := range args2 { - if arg1.Name == arg2.Name && sameValue(arg1.Value, arg2.Value) { - matched = true - break - } - } - if !matched { - return false - } - } - return true -} - -func sameValue(value1 *ast.Value, value2 *ast.Value) bool { - if value1.Kind != value2.Kind { - return false - } - if value1.Raw != value2.Raw { - return false - } - return true -} - -func doTypesConflict(walker *Walker, type1 *ast.Type, type2 *ast.Type) bool { - if type1.Elem != nil { - if type2.Elem != nil { - return doTypesConflict(walker, type1.Elem, type2.Elem) - } - return true - } - if type2.Elem != nil { - return true - } - if type1.NonNull && !type2.NonNull { - return true - } - if !type1.NonNull && type2.NonNull { - return true - } - - t1 := walker.Schema.Types[type1.NamedType] - t2 := walker.Schema.Types[type2.NamedType] - if (t1.Kind == ast.Scalar || t1.Kind == ast.Enum) && (t2.Kind == ast.Scalar || t2.Kind == ast.Enum) { - return t1.Name != t2.Name - } - - return false -} - -func getFieldsAndFragmentNames(selectionSet ast.SelectionSet) (*sequentialFieldsMap, []*ast.FragmentSpread) { - fieldsMap := sequentialFieldsMap{ - data: make(map[string][]*ast.Field), - } - var fragmentSpreads []*ast.FragmentSpread - - var walk func(selectionSet ast.SelectionSet) - walk = func(selectionSet ast.SelectionSet) { - for _, selection := range selectionSet { - switch selection := selection.(type) { - case *ast.Field: - responseName := selection.Name - if selection.Alias != "" { - responseName = selection.Alias - } - fieldsMap.Push(responseName, selection) - - case *ast.InlineFragment: - walk(selection.SelectionSet) - - case *ast.FragmentSpread: - fragmentSpreads = append(fragmentSpreads, selection) - } - } - } - walk(selectionSet) - - return &fieldsMap, fragmentSpreads -} diff --git a/vendor/github.com/vektah/gqlparser/v2/validator/rules/possible_fragment_spreads.go b/vendor/github.com/vektah/gqlparser/v2/validator/rules/possible_fragment_spreads.go deleted file mode 100644 index a3f795c97b..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/validator/rules/possible_fragment_spreads.go +++ /dev/null @@ -1,68 +0,0 @@ -package validator - -import ( - "github.com/vektah/gqlparser/v2/ast" - . "github.com/vektah/gqlparser/v2/validator" -) - -func init() { - AddRule("PossibleFragmentSpreads", func(observers *Events, addError AddErrFunc) { - - validate := func(walker *Walker, parentDef *ast.Definition, fragmentName string, emitError func()) { - if parentDef == nil { - return - } - - var parentDefs []*ast.Definition - switch parentDef.Kind { - case ast.Object: - parentDefs = []*ast.Definition{parentDef} - case ast.Interface, ast.Union: - parentDefs = walker.Schema.GetPossibleTypes(parentDef) - default: - return - } - - fragmentDefType := walker.Schema.Types[fragmentName] - if fragmentDefType == nil { - return - } - if !fragmentDefType.IsCompositeType() { - // checked by FragmentsOnCompositeTypes - return - } - fragmentDefs := walker.Schema.GetPossibleTypes(fragmentDefType) - - for _, fragmentDef := range fragmentDefs { - for _, parentDef := range parentDefs { - if parentDef.Name == fragmentDef.Name { - return - } - } - } - - emitError() - } - - observers.OnInlineFragment(func(walker *Walker, inlineFragment *ast.InlineFragment) { - validate(walker, inlineFragment.ObjectDefinition, inlineFragment.TypeCondition, func() { - addError( - Message(`Fragment cannot be spread here as objects of type "%s" can never be of type "%s".`, inlineFragment.ObjectDefinition.Name, inlineFragment.TypeCondition), - At(inlineFragment.Position), - ) - }) - }) - - observers.OnFragmentSpread(func(walker *Walker, fragmentSpread *ast.FragmentSpread) { - if fragmentSpread.Definition == nil { - return - } - validate(walker, fragmentSpread.ObjectDefinition, fragmentSpread.Definition.TypeCondition, func() { - addError( - Message(`Fragment "%s" cannot be spread here as objects of type "%s" can never be of type "%s".`, fragmentSpread.Name, fragmentSpread.ObjectDefinition.Name, fragmentSpread.Definition.TypeCondition), - At(fragmentSpread.Position), - ) - }) - }) - }) -} diff --git a/vendor/github.com/vektah/gqlparser/v2/validator/rules/provided_required_arguments.go b/vendor/github.com/vektah/gqlparser/v2/validator/rules/provided_required_arguments.go deleted file mode 100644 index d8ed652092..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/validator/rules/provided_required_arguments.go +++ /dev/null @@ -1,62 +0,0 @@ -package validator - -import ( - "github.com/vektah/gqlparser/v2/ast" - . "github.com/vektah/gqlparser/v2/validator" -) - -func init() { - AddRule("ProvidedRequiredArguments", func(observers *Events, addError AddErrFunc) { - observers.OnField(func(walker *Walker, field *ast.Field) { - if field.Definition == nil { - return - } - - argDef: - for _, argDef := range field.Definition.Arguments { - if !argDef.Type.NonNull { - continue - } - if argDef.DefaultValue != nil { - continue - } - for _, arg := range field.Arguments { - if arg.Name == argDef.Name { - continue argDef - } - } - - addError( - Message(`Field "%s" argument "%s" of type "%s" is required, but it was not provided.`, field.Name, argDef.Name, argDef.Type.String()), - At(field.Position), - ) - } - }) - - observers.OnDirective(func(walker *Walker, directive *ast.Directive) { - if directive.Definition == nil { - return - } - - argDef: - for _, argDef := range directive.Definition.Arguments { - if !argDef.Type.NonNull { - continue - } - if argDef.DefaultValue != nil { - continue - } - for _, arg := range directive.Arguments { - if arg.Name == argDef.Name { - continue argDef - } - } - - addError( - Message(`Directive "@%s" argument "%s" of type "%s" is required, but it was not provided.`, directive.Definition.Name, argDef.Name, argDef.Type.String()), - At(directive.Position), - ) - } - }) - }) -} diff --git a/vendor/github.com/vektah/gqlparser/v2/validator/rules/scalar_leafs.go b/vendor/github.com/vektah/gqlparser/v2/validator/rules/scalar_leafs.go deleted file mode 100644 index 718bc6834a..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/validator/rules/scalar_leafs.go +++ /dev/null @@ -1,36 +0,0 @@ -package validator - -import ( - "github.com/vektah/gqlparser/v2/ast" - . "github.com/vektah/gqlparser/v2/validator" -) - -func init() { - AddRule("ScalarLeafs", func(observers *Events, addError AddErrFunc) { - observers.OnField(func(walker *Walker, field *ast.Field) { - if field.Definition == nil { - return - } - - fieldType := walker.Schema.Types[field.Definition.Type.Name()] - if fieldType == nil { - return - } - - if fieldType.IsLeafType() && len(field.SelectionSet) > 0 { - addError( - Message(`Field "%s" must not have a selection since type "%s" has no subfields.`, field.Name, fieldType.Name), - At(field.Position), - ) - } - - if !fieldType.IsLeafType() && len(field.SelectionSet) == 0 { - addError( - Message(`Field "%s" of type "%s" must have a selection of subfields.`, field.Name, field.Definition.Type.String()), - Suggestf(`"%s { ... }"`, field.Name), - At(field.Position), - ) - } - }) - }) -} diff --git a/vendor/github.com/vektah/gqlparser/v2/validator/rules/single_field_subscriptions.go b/vendor/github.com/vektah/gqlparser/v2/validator/rules/single_field_subscriptions.go deleted file mode 100644 index a9e5bf6335..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/validator/rules/single_field_subscriptions.go +++ /dev/null @@ -1,86 +0,0 @@ -package validator - -import ( - "strconv" - "strings" - - "github.com/vektah/gqlparser/v2/ast" - . "github.com/vektah/gqlparser/v2/validator" -) - -func init() { - AddRule("SingleFieldSubscriptions", func(observers *Events, addError AddErrFunc) { - observers.OnOperation(func(walker *Walker, operation *ast.OperationDefinition) { - if walker.Schema.Subscription == nil || operation.Operation != ast.Subscription { - return - } - - fields := retrieveTopFieldNames(operation.SelectionSet) - - name := "Anonymous Subscription" - if operation.Name != "" { - name = `Subscription ` + strconv.Quote(operation.Name) - } - - if len(fields) > 1 { - addError( - Message(`%s must select only one top level field.`, name), - At(fields[1].position), - ) - } - - for _, field := range fields { - if strings.HasPrefix(field.name, "__") { - addError( - Message(`%s must not select an introspection top level field.`, name), - At(field.position), - ) - } - } - }) - }) -} - -type topField struct { - name string - position *ast.Position -} - -func retrieveTopFieldNames(selectionSet ast.SelectionSet) []*topField { - fields := []*topField{} - inFragmentRecursive := map[string]bool{} - var walk func(selectionSet ast.SelectionSet) - walk = func(selectionSet ast.SelectionSet) { - for _, selection := range selectionSet { - switch selection := selection.(type) { - case *ast.Field: - fields = append(fields, &topField{ - name: selection.Name, - position: selection.GetPosition(), - }) - case *ast.InlineFragment: - walk(selection.SelectionSet) - case *ast.FragmentSpread: - if selection.Definition == nil { - return - } - fragment := selection.Definition.Name - if !inFragmentRecursive[fragment] { - inFragmentRecursive[fragment] = true - walk(selection.Definition.SelectionSet) - } - } - } - } - walk(selectionSet) - - seen := make(map[string]bool, len(fields)) - uniquedFields := make([]*topField, 0, len(fields)) - for _, field := range fields { - if !seen[field.name] { - uniquedFields = append(uniquedFields, field) - } - seen[field.name] = true - } - return uniquedFields -} diff --git a/vendor/github.com/vektah/gqlparser/v2/validator/rules/unique_argument_names.go b/vendor/github.com/vektah/gqlparser/v2/validator/rules/unique_argument_names.go deleted file mode 100644 index 1d9a50ab22..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/validator/rules/unique_argument_names.go +++ /dev/null @@ -1,33 +0,0 @@ -package validator - -import ( - "github.com/vektah/gqlparser/v2/ast" - . "github.com/vektah/gqlparser/v2/validator" -) - -func init() { - AddRule("UniqueArgumentNames", func(observers *Events, addError AddErrFunc) { - observers.OnField(func(walker *Walker, field *ast.Field) { - checkUniqueArgs(field.Arguments, addError) - }) - - observers.OnDirective(func(walker *Walker, directive *ast.Directive) { - checkUniqueArgs(directive.Arguments, addError) - }) - }) -} - -func checkUniqueArgs(args ast.ArgumentList, addError AddErrFunc) { - knownArgNames := map[string]int{} - - for _, arg := range args { - if knownArgNames[arg.Name] == 1 { - addError( - Message(`There can be only one argument named "%s".`, arg.Name), - At(arg.Position), - ) - } - - knownArgNames[arg.Name]++ - } -} diff --git a/vendor/github.com/vektah/gqlparser/v2/validator/rules/unique_directives_per_location.go b/vendor/github.com/vektah/gqlparser/v2/validator/rules/unique_directives_per_location.go deleted file mode 100644 index 52dfb21eb3..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/validator/rules/unique_directives_per_location.go +++ /dev/null @@ -1,24 +0,0 @@ -package validator - -import ( - "github.com/vektah/gqlparser/v2/ast" - . "github.com/vektah/gqlparser/v2/validator" -) - -func init() { - AddRule("UniqueDirectivesPerLocation", func(observers *Events, addError AddErrFunc) { - observers.OnDirectiveList(func(walker *Walker, directives []*ast.Directive) { - seen := map[string]bool{} - - for _, dir := range directives { - if dir.Name != "repeatable" && seen[dir.Name] { - addError( - Message(`The directive "@%s" can only be used once at this location.`, dir.Name), - At(dir.Position), - ) - } - seen[dir.Name] = true - } - }) - }) -} diff --git a/vendor/github.com/vektah/gqlparser/v2/validator/rules/unique_fragment_names.go b/vendor/github.com/vektah/gqlparser/v2/validator/rules/unique_fragment_names.go deleted file mode 100644 index 8c348aea06..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/validator/rules/unique_fragment_names.go +++ /dev/null @@ -1,22 +0,0 @@ -package validator - -import ( - "github.com/vektah/gqlparser/v2/ast" - . "github.com/vektah/gqlparser/v2/validator" -) - -func init() { - AddRule("UniqueFragmentNames", func(observers *Events, addError AddErrFunc) { - seenFragments := map[string]bool{} - - observers.OnFragment(func(walker *Walker, fragment *ast.FragmentDefinition) { - if seenFragments[fragment.Name] { - addError( - Message(`There can be only one fragment named "%s".`, fragment.Name), - At(fragment.Position), - ) - } - seenFragments[fragment.Name] = true - }) - }) -} diff --git a/vendor/github.com/vektah/gqlparser/v2/validator/rules/unique_input_field_names.go b/vendor/github.com/vektah/gqlparser/v2/validator/rules/unique_input_field_names.go deleted file mode 100644 index 092be671c0..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/validator/rules/unique_input_field_names.go +++ /dev/null @@ -1,27 +0,0 @@ -package validator - -import ( - "github.com/vektah/gqlparser/v2/ast" - . "github.com/vektah/gqlparser/v2/validator" -) - -func init() { - AddRule("UniqueInputFieldNames", func(observers *Events, addError AddErrFunc) { - observers.OnValue(func(walker *Walker, value *ast.Value) { - if value.Kind != ast.ObjectValue { - return - } - - seen := map[string]bool{} - for _, field := range value.Children { - if seen[field.Name] { - addError( - Message(`There can be only one input field named "%s".`, field.Name), - At(field.Position), - ) - } - seen[field.Name] = true - } - }) - }) -} diff --git a/vendor/github.com/vektah/gqlparser/v2/validator/rules/unique_operation_names.go b/vendor/github.com/vektah/gqlparser/v2/validator/rules/unique_operation_names.go deleted file mode 100644 index 4d41b60ae3..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/validator/rules/unique_operation_names.go +++ /dev/null @@ -1,22 +0,0 @@ -package validator - -import ( - "github.com/vektah/gqlparser/v2/ast" - . "github.com/vektah/gqlparser/v2/validator" -) - -func init() { - AddRule("UniqueOperationNames", func(observers *Events, addError AddErrFunc) { - seen := map[string]bool{} - - observers.OnOperation(func(walker *Walker, operation *ast.OperationDefinition) { - if seen[operation.Name] { - addError( - Message(`There can be only one operation named "%s".`, operation.Name), - At(operation.Position), - ) - } - seen[operation.Name] = true - }) - }) -} diff --git a/vendor/github.com/vektah/gqlparser/v2/validator/rules/unique_variable_names.go b/vendor/github.com/vektah/gqlparser/v2/validator/rules/unique_variable_names.go deleted file mode 100644 index 6481ef4cd2..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/validator/rules/unique_variable_names.go +++ /dev/null @@ -1,24 +0,0 @@ -package validator - -import ( - "github.com/vektah/gqlparser/v2/ast" - . "github.com/vektah/gqlparser/v2/validator" -) - -func init() { - AddRule("UniqueVariableNames", func(observers *Events, addError AddErrFunc) { - observers.OnOperation(func(walker *Walker, operation *ast.OperationDefinition) { - seen := map[string]int{} - for _, def := range operation.VariableDefinitions { - // add the same error only once per a variable. - if seen[def.Variable] == 1 { - addError( - Message(`There can be only one variable named "$%s".`, def.Variable), - At(def.Position), - ) - } - seen[def.Variable]++ - } - }) - }) -} diff --git a/vendor/github.com/vektah/gqlparser/v2/validator/rules/values_of_correct_type.go b/vendor/github.com/vektah/gqlparser/v2/validator/rules/values_of_correct_type.go deleted file mode 100644 index 22bea77117..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/validator/rules/values_of_correct_type.go +++ /dev/null @@ -1,168 +0,0 @@ -package validator - -import ( - "errors" - "fmt" - "strconv" - - "github.com/vektah/gqlparser/v2/ast" - . "github.com/vektah/gqlparser/v2/validator" -) - -func init() { - AddRule("ValuesOfCorrectType", func(observers *Events, addError AddErrFunc) { - observers.OnValue(func(walker *Walker, value *ast.Value) { - if value.Definition == nil || value.ExpectedType == nil { - return - } - - if value.Kind == ast.NullValue && value.ExpectedType.NonNull { - addError( - Message(`Expected value of type "%s", found %s.`, value.ExpectedType.String(), value.String()), - At(value.Position), - ) - } - - if value.Definition.Kind == ast.Scalar { - // Skip custom validating scalars - if !value.Definition.OneOf("Int", "Float", "String", "Boolean", "ID") { - return - } - } - - var possibleEnums []string - if value.Definition.Kind == ast.Enum { - for _, val := range value.Definition.EnumValues { - possibleEnums = append(possibleEnums, val.Name) - } - } - - rawVal, err := value.Value(nil) - if err != nil { - unexpectedTypeMessage(addError, value) - } - - switch value.Kind { - case ast.NullValue: - return - case ast.ListValue: - if value.ExpectedType.Elem == nil { - unexpectedTypeMessage(addError, value) - return - } - - case ast.IntValue: - if !value.Definition.OneOf("Int", "Float", "ID") { - unexpectedTypeMessage(addError, value) - } - - case ast.FloatValue: - if !value.Definition.OneOf("Float") { - unexpectedTypeMessage(addError, value) - } - - case ast.StringValue, ast.BlockValue: - if value.Definition.Kind == ast.Enum { - rawValStr := fmt.Sprint(rawVal) - addError( - Message(`Enum "%s" cannot represent non-enum value: %s.`, value.ExpectedType.String(), value.String()), - SuggestListQuoted("Did you mean the enum value", rawValStr, possibleEnums), - At(value.Position), - ) - } else if !value.Definition.OneOf("String", "ID") { - unexpectedTypeMessage(addError, value) - } - - case ast.EnumValue: - if value.Definition.Kind != ast.Enum { - rawValStr := fmt.Sprint(rawVal) - addError( - unexpectedTypeMessageOnly(value), - SuggestListUnquoted("Did you mean the enum value", rawValStr, possibleEnums), - At(value.Position), - ) - } else if value.Definition.EnumValues.ForName(value.Raw) == nil { - rawValStr := fmt.Sprint(rawVal) - addError( - Message(`Value "%s" does not exist in "%s" enum.`, value.String(), value.ExpectedType.String()), - SuggestListQuoted("Did you mean the enum value", rawValStr, possibleEnums), - At(value.Position), - ) - } - - case ast.BooleanValue: - if !value.Definition.OneOf("Boolean") { - unexpectedTypeMessage(addError, value) - } - - case ast.ObjectValue: - - for _, field := range value.Definition.Fields { - if field.Type.NonNull { - fieldValue := value.Children.ForName(field.Name) - if fieldValue == nil && field.DefaultValue == nil { - addError( - Message(`Field "%s.%s" of required type "%s" was not provided.`, value.Definition.Name, field.Name, field.Type.String()), - At(value.Position), - ) - continue - } - } - } - - for _, fieldValue := range value.Children { - if value.Definition.Fields.ForName(fieldValue.Name) == nil { - var suggestions []string - for _, fieldValue := range value.Definition.Fields { - suggestions = append(suggestions, fieldValue.Name) - } - - addError( - Message(`Field "%s" is not defined by type "%s".`, fieldValue.Name, value.Definition.Name), - SuggestListQuoted("Did you mean", fieldValue.Name, suggestions), - At(fieldValue.Position), - ) - } - } - - case ast.Variable: - return - - default: - panic(fmt.Errorf("unhandled %T", value)) - } - }) - }) -} - -func unexpectedTypeMessage(addError AddErrFunc, v *ast.Value) { - addError( - unexpectedTypeMessageOnly(v), - At(v.Position), - ) -} - -func unexpectedTypeMessageOnly(v *ast.Value) ErrorOption { - switch v.ExpectedType.String() { - case "Int", "Int!": - if _, err := strconv.ParseInt(v.Raw, 10, 32); err != nil && errors.Is(err, strconv.ErrRange) { - return Message(`Int cannot represent non 32-bit signed integer value: %s`, v.String()) - } - return Message(`Int cannot represent non-integer value: %s`, v.String()) - case "String", "String!", "[String]": - return Message(`String cannot represent a non string value: %s`, v.String()) - case "Boolean", "Boolean!": - return Message(`Boolean cannot represent a non boolean value: %s`, v.String()) - case "Float", "Float!": - return Message(`Float cannot represent non numeric value: %s`, v.String()) - case "ID", "ID!": - return Message(`ID cannot represent a non-string and non-integer value: %s`, v.String()) - //case "Enum": - // return Message(`Enum "%s" cannot represent non-enum value: %s`, v.ExpectedType.String(), v.String()) - default: - if v.Definition.Kind == ast.Enum { - return Message(`Enum "%s" cannot represent non-enum value: %s.`, v.ExpectedType.String(), v.String()) - } - return Message(`Expected value of type "%s", found %s.`, v.ExpectedType.String(), v.String()) - } -} diff --git a/vendor/github.com/vektah/gqlparser/v2/validator/rules/variables_are_input_types.go b/vendor/github.com/vektah/gqlparser/v2/validator/rules/variables_are_input_types.go deleted file mode 100644 index 4ea94e5a82..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/validator/rules/variables_are_input_types.go +++ /dev/null @@ -1,28 +0,0 @@ -package validator - -import ( - "github.com/vektah/gqlparser/v2/ast" - . "github.com/vektah/gqlparser/v2/validator" -) - -func init() { - AddRule("VariablesAreInputTypes", func(observers *Events, addError AddErrFunc) { - observers.OnOperation(func(walker *Walker, operation *ast.OperationDefinition) { - for _, def := range operation.VariableDefinitions { - if def.Definition == nil { - continue - } - if !def.Definition.IsInputType() { - addError( - Message( - `Variable "$%s" cannot be non-input type "%s".`, - def.Variable, - def.Type.String(), - ), - At(def.Position), - ) - } - } - }) - }) -} diff --git a/vendor/github.com/vektah/gqlparser/v2/validator/rules/variables_in_allowed_position.go b/vendor/github.com/vektah/gqlparser/v2/validator/rules/variables_in_allowed_position.go deleted file mode 100644 index eef7435400..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/validator/rules/variables_in_allowed_position.go +++ /dev/null @@ -1,38 +0,0 @@ -package validator - -import ( - "github.com/vektah/gqlparser/v2/ast" - . "github.com/vektah/gqlparser/v2/validator" -) - -func init() { - AddRule("VariablesInAllowedPosition", func(observers *Events, addError AddErrFunc) { - observers.OnValue(func(walker *Walker, value *ast.Value) { - if value.Kind != ast.Variable || value.ExpectedType == nil || value.VariableDefinition == nil || walker.CurrentOperation == nil { - return - } - - tmp := *value.ExpectedType - - // todo: move me into walk - // If there is a default non nullable types can be null - if value.VariableDefinition.DefaultValue != nil && value.VariableDefinition.DefaultValue.Kind != ast.NullValue { - if value.ExpectedType.NonNull { - tmp.NonNull = false - } - } - - if !value.VariableDefinition.Type.IsCompatible(&tmp) { - addError( - Message( - `Variable "%s" of type "%s" used in position expecting type "%s".`, - value, - value.VariableDefinition.Type.String(), - value.ExpectedType.String(), - ), - At(value.Position), - ) - } - }) - }) -} diff --git a/vendor/github.com/vektah/gqlparser/v2/validator/schema.go b/vendor/github.com/vektah/gqlparser/v2/validator/schema.go deleted file mode 100644 index 976ed8304e..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/validator/schema.go +++ /dev/null @@ -1,512 +0,0 @@ -package validator - -import ( - "sort" - "strconv" - "strings" - - . "github.com/vektah/gqlparser/v2/ast" - "github.com/vektah/gqlparser/v2/gqlerror" - "github.com/vektah/gqlparser/v2/parser" -) - -func LoadSchema(inputs ...*Source) (*Schema, error) { - ast, err := parser.ParseSchemas(inputs...) - if err != nil { - return nil, err - } - return ValidateSchemaDocument(ast) -} - -func ValidateSchemaDocument(ast *SchemaDocument) (*Schema, error) { - schema := Schema{ - Types: map[string]*Definition{}, - Directives: map[string]*DirectiveDefinition{}, - PossibleTypes: map[string][]*Definition{}, - Implements: map[string][]*Definition{}, - } - - for i, def := range ast.Definitions { - if schema.Types[def.Name] != nil { - return nil, gqlerror.ErrorPosf(def.Position, "Cannot redeclare type %s.", def.Name) - } - schema.Types[def.Name] = ast.Definitions[i] - } - - defs := append(DefinitionList{}, ast.Definitions...) - - for _, ext := range ast.Extensions { - def := schema.Types[ext.Name] - if def == nil { - schema.Types[ext.Name] = &Definition{ - Kind: ext.Kind, - Name: ext.Name, - Position: ext.Position, - } - def = schema.Types[ext.Name] - defs = append(defs, def) - } - - if def.Kind != ext.Kind { - return nil, gqlerror.ErrorPosf(ext.Position, "Cannot extend type %s because the base type is a %s, not %s.", ext.Name, def.Kind, ext.Kind) - } - - def.Directives = append(def.Directives, ext.Directives...) - def.Interfaces = append(def.Interfaces, ext.Interfaces...) - def.Fields = append(def.Fields, ext.Fields...) - def.Types = append(def.Types, ext.Types...) - def.EnumValues = append(def.EnumValues, ext.EnumValues...) - } - - for _, def := range defs { - switch def.Kind { - case Union: - for _, t := range def.Types { - schema.AddPossibleType(def.Name, schema.Types[t]) - schema.AddImplements(t, def) - } - case InputObject, Object: - for _, intf := range def.Interfaces { - schema.AddPossibleType(intf, def) - schema.AddImplements(def.Name, schema.Types[intf]) - } - schema.AddPossibleType(def.Name, def) - case Interface: - for _, intf := range def.Interfaces { - schema.AddPossibleType(intf, def) - schema.AddImplements(def.Name, schema.Types[intf]) - } - } - } - - for i, dir := range ast.Directives { - if schema.Directives[dir.Name] != nil { - // While the spec says SDL must not (§3.5) explicitly define builtin - // scalars, it may (§3.13) define builtin directives. Here we check for - // that, and reject doubly-defined directives otherwise. - switch dir.Name { - case "include", "skip", "deprecated", "specifiedBy": // the builtins - // In principle here we might want to validate that the - // directives are the same. But they might not be, if the - // server has an older spec than we do. (Plus, validating this - // is a lot of work.) So we just keep the first one we saw. - // That's an arbitrary choice, but in theory the only way it - // fails is if the server is using features newer than this - // version of gqlparser, in which case they're in trouble - // anyway. - default: - return nil, gqlerror.ErrorPosf(dir.Position, "Cannot redeclare directive %s.", dir.Name) - } - } - schema.Directives[dir.Name] = ast.Directives[i] - } - - if len(ast.Schema) > 1 { - return nil, gqlerror.ErrorPosf(ast.Schema[1].Position, "Cannot have multiple schema entry points, consider schema extensions instead.") - } - - if len(ast.Schema) == 1 { - schema.Description = ast.Schema[0].Description - for _, entrypoint := range ast.Schema[0].OperationTypes { - def := schema.Types[entrypoint.Type] - if def == nil { - return nil, gqlerror.ErrorPosf(entrypoint.Position, "Schema root %s refers to a type %s that does not exist.", entrypoint.Operation, entrypoint.Type) - } - switch entrypoint.Operation { - case Query: - schema.Query = def - case Mutation: - schema.Mutation = def - case Subscription: - schema.Subscription = def - } - } - } - - for _, ext := range ast.SchemaExtension { - for _, entrypoint := range ext.OperationTypes { - def := schema.Types[entrypoint.Type] - if def == nil { - return nil, gqlerror.ErrorPosf(entrypoint.Position, "Schema root %s refers to a type %s that does not exist.", entrypoint.Operation, entrypoint.Type) - } - switch entrypoint.Operation { - case Query: - schema.Query = def - case Mutation: - schema.Mutation = def - case Subscription: - schema.Subscription = def - } - } - } - - if err := validateTypeDefinitions(&schema); err != nil { - return nil, err - } - - if err := validateDirectiveDefinitions(&schema); err != nil { - return nil, err - } - - // Inferred root operation type names should be performed only when a `schema` directive is - // **not** provided, when it is, `Mutation` and `Subscription` becomes valid types and are not - // assigned as a root operation on the schema. - if len(ast.Schema) == 0 { - if schema.Query == nil && schema.Types["Query"] != nil { - schema.Query = schema.Types["Query"] - } - - if schema.Mutation == nil && schema.Types["Mutation"] != nil { - schema.Mutation = schema.Types["Mutation"] - } - - if schema.Subscription == nil && schema.Types["Subscription"] != nil { - schema.Subscription = schema.Types["Subscription"] - } - } - - if schema.Query != nil { - schema.Query.Fields = append( - schema.Query.Fields, - &FieldDefinition{ - Name: "__schema", - Type: NonNullNamedType("__Schema", nil), - }, - &FieldDefinition{ - Name: "__type", - Type: NamedType("__Type", nil), - Arguments: ArgumentDefinitionList{ - {Name: "name", Type: NonNullNamedType("String", nil)}, - }, - }, - ) - } - - return &schema, nil -} - -func validateTypeDefinitions(schema *Schema) *gqlerror.Error { - types := make([]string, 0, len(schema.Types)) - for typ := range schema.Types { - types = append(types, typ) - } - sort.Strings(types) - for _, typ := range types { - err := validateDefinition(schema, schema.Types[typ]) - if err != nil { - return err - } - } - return nil -} - -func validateDirectiveDefinitions(schema *Schema) *gqlerror.Error { - directives := make([]string, 0, len(schema.Directives)) - for directive := range schema.Directives { - directives = append(directives, directive) - } - sort.Strings(directives) - for _, directive := range directives { - err := validateDirective(schema, schema.Directives[directive]) - if err != nil { - return err - } - } - return nil -} - -func validateDirective(schema *Schema, def *DirectiveDefinition) *gqlerror.Error { - if err := validateName(def.Position, def.Name); err != nil { - // now, GraphQL spec doesn't have reserved directive name - return err - } - - return validateArgs(schema, def.Arguments, def) -} - -func validateDefinition(schema *Schema, def *Definition) *gqlerror.Error { - for _, field := range def.Fields { - if err := validateName(field.Position, field.Name); err != nil { - // now, GraphQL spec doesn't have reserved field name - return err - } - if err := validateTypeRef(schema, field.Type); err != nil { - return err - } - if err := validateArgs(schema, field.Arguments, nil); err != nil { - return err - } - wantDirLocation := LocationFieldDefinition - if def.Kind == InputObject { - wantDirLocation = LocationInputFieldDefinition - } - if err := validateDirectives(schema, field.Directives, wantDirLocation, nil); err != nil { - return err - } - } - - for _, typ := range def.Types { - typDef := schema.Types[typ] - if typDef == nil { - return gqlerror.ErrorPosf(def.Position, "Undefined type %s.", strconv.Quote(typ)) - } - if !isValidKind(typDef.Kind, Object) { - return gqlerror.ErrorPosf(def.Position, "%s type %s must be %s.", def.Kind, strconv.Quote(typ), kindList(Object)) - } - } - - for _, intf := range def.Interfaces { - if err := validateImplements(schema, def, intf); err != nil { - return err - } - } - - switch def.Kind { - case Object, Interface: - if len(def.Fields) == 0 { - return gqlerror.ErrorPosf(def.Position, "%s %s: must define one or more fields.", def.Kind, def.Name) - } - for _, field := range def.Fields { - if typ, ok := schema.Types[field.Type.Name()]; ok { - if !isValidKind(typ.Kind, Scalar, Object, Interface, Union, Enum) { - return gqlerror.ErrorPosf(field.Position, "%s %s: field must be one of %s.", def.Kind, def.Name, kindList(Scalar, Object, Interface, Union, Enum)) - } - } - } - case Enum: - if len(def.EnumValues) == 0 { - return gqlerror.ErrorPosf(def.Position, "%s %s: must define one or more unique enum values.", def.Kind, def.Name) - } - for _, value := range def.EnumValues { - for _, nonEnum := range [3]string{"true", "false", "null"} { - if value.Name == nonEnum { - return gqlerror.ErrorPosf(def.Position, "%s %s: non-enum value %s.", def.Kind, def.Name, value.Name) - } - } - } - case InputObject: - if len(def.Fields) == 0 { - return gqlerror.ErrorPosf(def.Position, "%s %s: must define one or more input fields.", def.Kind, def.Name) - } - for _, field := range def.Fields { - if typ, ok := schema.Types[field.Type.Name()]; ok { - if !isValidKind(typ.Kind, Scalar, Enum, InputObject) { - return gqlerror.ErrorPosf(field.Position, "%s %s: field must be one of %s.", typ.Kind, field.Name, kindList(Scalar, Enum, InputObject)) - } - } - } - } - - for idx, field1 := range def.Fields { - for _, field2 := range def.Fields[idx+1:] { - if field1.Name == field2.Name { - return gqlerror.ErrorPosf(field2.Position, "Field %s.%s can only be defined once.", def.Name, field2.Name) - } - } - } - - if !def.BuiltIn { - // GraphQL spec has reserved type names a lot! - err := validateName(def.Position, def.Name) - if err != nil { - return err - } - } - - return validateDirectives(schema, def.Directives, DirectiveLocation(def.Kind), nil) -} - -func validateTypeRef(schema *Schema, typ *Type) *gqlerror.Error { - if schema.Types[typ.Name()] == nil { - return gqlerror.ErrorPosf(typ.Position, "Undefined type %s.", typ.Name()) - } - return nil -} - -func validateArgs(schema *Schema, args ArgumentDefinitionList, currentDirective *DirectiveDefinition) *gqlerror.Error { - for _, arg := range args { - if err := validateName(arg.Position, arg.Name); err != nil { - // now, GraphQL spec doesn't have reserved argument name - return err - } - if err := validateTypeRef(schema, arg.Type); err != nil { - return err - } - def := schema.Types[arg.Type.Name()] - if !def.IsInputType() { - return gqlerror.ErrorPosf( - arg.Position, - "cannot use %s as argument %s because %s is not a valid input type", - arg.Type.String(), - arg.Name, - def.Kind, - ) - } - if err := validateDirectives(schema, arg.Directives, LocationArgumentDefinition, currentDirective); err != nil { - return err - } - } - return nil -} - -func validateDirectives(schema *Schema, dirs DirectiveList, location DirectiveLocation, currentDirective *DirectiveDefinition) *gqlerror.Error { - for _, dir := range dirs { - if err := validateName(dir.Position, dir.Name); err != nil { - // now, GraphQL spec doesn't have reserved directive name - return err - } - if currentDirective != nil && dir.Name == currentDirective.Name { - return gqlerror.ErrorPosf(dir.Position, "Directive %s cannot refer to itself.", currentDirective.Name) - } - if schema.Directives[dir.Name] == nil { - return gqlerror.ErrorPosf(dir.Position, "Undefined directive %s.", dir.Name) - } - validKind := false - for _, dirLocation := range schema.Directives[dir.Name].Locations { - if dirLocation == location { - validKind = true - break - } - } - if !validKind { - return gqlerror.ErrorPosf(dir.Position, "Directive %s is not applicable on %s.", dir.Name, location) - } - dir.Definition = schema.Directives[dir.Name] - } - return nil -} - -func validateImplements(schema *Schema, def *Definition, intfName string) *gqlerror.Error { - // see validation rules at the bottom of - // https://facebook.github.io/graphql/October2021/#sec-Objects - intf := schema.Types[intfName] - if intf == nil { - return gqlerror.ErrorPosf(def.Position, "Undefined type %s.", strconv.Quote(intfName)) - } - if intf.Kind != Interface { - return gqlerror.ErrorPosf(def.Position, "%s is a non interface type %s.", strconv.Quote(intfName), intf.Kind) - } - for _, requiredField := range intf.Fields { - foundField := def.Fields.ForName(requiredField.Name) - if foundField == nil { - return gqlerror.ErrorPosf(def.Position, - `For %s to implement %s it must have a field called %s.`, - def.Name, intf.Name, requiredField.Name, - ) - } - - if !isCovariant(schema, requiredField.Type, foundField.Type) { - return gqlerror.ErrorPosf(foundField.Position, - `For %s to implement %s the field %s must have type %s.`, - def.Name, intf.Name, requiredField.Name, requiredField.Type.String(), - ) - } - - for _, requiredArg := range requiredField.Arguments { - foundArg := foundField.Arguments.ForName(requiredArg.Name) - if foundArg == nil { - return gqlerror.ErrorPosf(foundField.Position, - `For %s to implement %s the field %s must have the same arguments but it is missing %s.`, - def.Name, intf.Name, requiredField.Name, requiredArg.Name, - ) - } - - if !requiredArg.Type.IsCompatible(foundArg.Type) { - return gqlerror.ErrorPosf(foundArg.Position, - `For %s to implement %s the field %s must have the same arguments but %s has the wrong type.`, - def.Name, intf.Name, requiredField.Name, requiredArg.Name, - ) - } - } - for _, foundArgs := range foundField.Arguments { - if requiredField.Arguments.ForName(foundArgs.Name) == nil && foundArgs.Type.NonNull && foundArgs.DefaultValue == nil { - return gqlerror.ErrorPosf(foundArgs.Position, - `For %s to implement %s any additional arguments on %s must be optional or have a default value but %s is required.`, - def.Name, intf.Name, foundField.Name, foundArgs.Name, - ) - } - } - } - return validateTypeImplementsAncestors(schema, def, intfName) -} - -// validateTypeImplementsAncestors -// https://github.com/graphql/graphql-js/blob/47bd8c8897c72d3efc17ecb1599a95cee6bac5e8/src/type/validate.ts#L428 -func validateTypeImplementsAncestors(schema *Schema, def *Definition, intfName string) *gqlerror.Error { - intf := schema.Types[intfName] - if intf == nil { - return gqlerror.ErrorPosf(def.Position, "Undefined type %s.", strconv.Quote(intfName)) - } - for _, transitive := range intf.Interfaces { - if !containsString(def.Interfaces, transitive) { - if transitive == def.Name { - return gqlerror.ErrorPosf(def.Position, - `Type %s cannot implement %s because it would create a circular reference.`, - def.Name, intfName, - ) - } - return gqlerror.ErrorPosf(def.Position, - `Type %s must implement %s because it is implemented by %s.`, - def.Name, transitive, intfName, - ) - } - } - return nil -} - -func containsString(slice []string, want string) bool { - for _, str := range slice { - if want == str { - return true - } - } - return false -} - -func isCovariant(schema *Schema, required *Type, actual *Type) bool { - if required.NonNull && !actual.NonNull { - return false - } - - if required.NamedType != "" { - if required.NamedType == actual.NamedType { - return true - } - for _, pt := range schema.PossibleTypes[required.NamedType] { - if pt.Name == actual.NamedType { - return true - } - } - return false - } - - if required.Elem != nil && actual.Elem == nil { - return false - } - - return isCovariant(schema, required.Elem, actual.Elem) -} - -func validateName(pos *Position, name string) *gqlerror.Error { - if strings.HasPrefix(name, "__") { - return gqlerror.ErrorPosf(pos, `Name "%s" must not begin with "__", which is reserved by GraphQL introspection.`, name) - } - return nil -} - -func isValidKind(kind DefinitionKind, valid ...DefinitionKind) bool { - for _, k := range valid { - if kind == k { - return true - } - } - return false -} - -func kindList(kinds ...DefinitionKind) string { - s := make([]string, len(kinds)) - for i, k := range kinds { - s[i] = string(k) - } - return strings.Join(s, ", ") -} diff --git a/vendor/github.com/vektah/gqlparser/v2/validator/schema_test.yml b/vendor/github.com/vektah/gqlparser/v2/validator/schema_test.yml deleted file mode 100644 index 7034a4697c..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/validator/schema_test.yml +++ /dev/null @@ -1,678 +0,0 @@ -types: - - name: cannot be redeclared - input: | - type A { - name: String - } - type A { - name: String - } - error: - message: "Cannot redeclare type A." - locations: [{line: 4, column: 6}] - - name: cannot be duplicated field at same definition 1 - input: | - type A { - name: String - name: String - } - error: - message: "Field A.name can only be defined once." - locations: [{line: 3, column: 3}] - - name: cannot be duplicated field at same definition 2 - input: | - type A { - name: String - } - extend type A { - name: String - } - error: - message: "Field A.name can only be defined once." - locations: [{line: 5, column: 3}] - - name: cannot be duplicated field at same definition 3 - input: | - type A { - name: String - } - extend type A { - age: Int - age: Int - } - error: - message: "Field A.age can only be defined once." - locations: [{line: 6, column: 3}] - -object types: - - name: must define one or more fields - input: | - directive @D on OBJECT - - # This pattern rejected by parser - # type InvalidObject1 {} - - type InvalidObject2 @D - - type ValidObject { - id: ID - } - extend type ValidObject @D - extend type ValidObject { - b: Int - } - error: - message: 'OBJECT InvalidObject2: must define one or more fields.' - locations: [{line: 6, column: 6}] - - name: check reserved names on type name - input: | - type __FooBar { - id: ID - } - error: - message: 'Name "__FooBar" must not begin with "__", which is reserved by GraphQL introspection.' - locations: [{line: 1, column: 6}] - - name: check reserved names on type field - input: | - type FooBar { - __id: ID - } - error: - message: 'Name "__id" must not begin with "__", which is reserved by GraphQL introspection.' - locations: [{line: 2, column: 3}] - - - name: check reserved names on type field argument - input: | - type FooBar { - foo(__bar: ID): ID - } - error: - message: 'Name "__bar" must not begin with "__", which is reserved by GraphQL introspection.' - locations: [{line: 2, column: 7}] - - - name: must not allow input object as field type - input: | - input Input { - id: ID - } - type Query { - input: Input! - } - error: - message: 'OBJECT Query: field must be one of SCALAR, OBJECT, INTERFACE, UNION, ENUM.' - locations: [{line: 5, column: 3}] - -interfaces: - - name: must exist - input: | - type Thing implements Object { - id: ID! - } - - type Query { - Things: [Thing!]! - } - error: - message: 'Undefined type "Object".' - locations: [{line: 1, column: 6}] - - - name: must be an interface - input: | - type Thing implements Object { - id: ID! - } - - type Query { - Things: [Thing!]! - } - - type Object { - name: String - } - error: - message: '"Object" is a non interface type OBJECT.' - locations: [{line: 1, column: 6}] - - - name: must define one or more fields - input: | - directive @D on INTERFACE - - # This pattern rejected by parser - # interface InvalidInterface1 {} - - interface InvalidInterface2 @D - - interface ValidInterface { - id: ID - } - extend interface ValidInterface @D - extend interface ValidInterface { - b: Int - } - error: - message: 'INTERFACE InvalidInterface2: must define one or more fields.' - locations: [{line: 6, column: 11}] - - - name: check reserved names on type name - input: | - interface __FooBar { - id: ID - } - error: - message: 'Name "__FooBar" must not begin with "__", which is reserved by GraphQL introspection.' - locations: [{line: 1, column: 11}] - - - name: must not allow input object as field type - input: | - input Input { - id: ID - } - type Query { - foo: Foo! - } - interface Foo { - input: Input! - } - error: - message: 'INTERFACE Foo: field must be one of SCALAR, OBJECT, INTERFACE, UNION, ENUM.' - locations: [{line: 8, column: 3}] - - - name: must have all fields from interface - input: | - type Bar implements BarInterface { - someField: Int! - } - - interface BarInterface { - id: ID! - } - error: - message: 'For Bar to implement BarInterface it must have a field called id.' - locations: [{line: 1, column: 6}] - - - name: must have same type of fields - input: | - type Bar implements BarInterface { - id: Int! - } - - interface BarInterface { - id: ID! - } - error: - message: 'For Bar to implement BarInterface the field id must have type ID!.' - locations: [{line: 2, column: 5}] - - - name: must have all required arguments - input: | - type Bar implements BarInterface { - id: ID! - } - - interface BarInterface { - id(ff: Int!): ID! - } - error: - message: 'For Bar to implement BarInterface the field id must have the same arguments but it is missing ff.' - locations: [{line: 2, column: 5}] - - - name: must have same argument types - input: | - type Bar implements BarInterface { - id(ff: ID!): ID! - } - - interface BarInterface { - id(ff: Int!): ID! - } - error: - message: 'For Bar to implement BarInterface the field id must have the same arguments but ff has the wrong type.' - locations: [{line: 2, column: 8}] - - - name: may defined additional nullable arguments - input: | - type Bar implements BarInterface { - id(opt: Int): ID! - } - - interface BarInterface { - id: ID! - } - - - name: may defined additional required arguments with defaults - input: | - type Bar implements BarInterface { - id(opt: Int! = 1): ID! - } - - interface BarInterface { - id: ID! - } - - - name: must not define additional required arguments without defaults - input: | - type Bar implements BarInterface { - id(opt: Int!): ID! - } - - interface BarInterface { - id: ID! - } - error: - message: 'For Bar to implement BarInterface any additional arguments on id must be optional or have a default value but opt is required.' - locations: [{line: 2, column: 8}] - - - name: can have covariant argument types - input: | - union U = A|B - - type A { name: String } - type B { name: String } - - type Bar implements BarInterface { - f: A! - } - - interface BarInterface { - f: U! - } - - - name: may define intermediate interfaces - input: | - interface IA { - id: ID! - } - - interface IIA implements IA { - id: ID! - } - - type A implements IIA & IA { - id: ID! - } - - - name: Type Foo must implement Baz because it is implemented by Bar - input: | - interface Baz { - baz: String - } - - interface Bar implements Baz { - bar: String - baz: String - } - - type Foo implements Bar { - foo: String - bar: String - baz: String - } - error: - message: 'Type Foo must implement Baz because it is implemented by Bar.' - locations: [{line: 10, column: 6}] - - - name: circular reference error - input: | - interface Circular1 implements Circular2 { - id: ID! - } - - interface Circular2 implements Circular1 { - id: ID! - } - error: - message: 'Type Circular1 cannot implement Circular2 because it would create a circular reference.' - locations: [{line: 1, column: 11}] - -inputs: - - name: must define one or more input fields - input: | - directive @D on INPUT_OBJECT - - # This pattern rejected by parser - # input InvalidInput1 {} - - input InvalidInput2 @D - - input ValidInput { - id: ID - } - extend input ValidInput @D - extend input ValidInput { - b: Int - } - error: - message: 'INPUT_OBJECT InvalidInput2: must define one or more input fields.' - locations: [{line: 6, column: 7}] - - name: check reserved names on type name - input: | - input __FooBar { - id: ID - } - error: - message: 'Name "__FooBar" must not begin with "__", which is reserved by GraphQL introspection.' - locations: [{line: 1, column: 7}] - - - name: fields cannot be Objects - input: | - type Object { id: ID } - input Foo { a: Object! } - error: - message: 'OBJECT a: field must be one of SCALAR, ENUM, INPUT_OBJECT.' - locations: [{line: 2, column: 13}] - - - name: fields cannot be Interfaces - input: | - interface Interface { id: ID! } - input Foo { a: Interface! } - error: - message: 'INTERFACE a: field must be one of SCALAR, ENUM, INPUT_OBJECT.' - locations: [{line: 2, column: 13}] - - - name: fields cannot be Unions - input: | - type Object { id: ID } - union Union = Object - input Foo { a: Union! } - error: - message: 'UNION a: field must be one of SCALAR, ENUM, INPUT_OBJECT.' - locations: [{line: 3, column: 13}] - -args: - - name: Valid arg types - input: | - input Input { id: ID } - enum Enum { A } - scalar Scalar - - type Query { - f(a: Input, b: Scalar, c: Enum): Boolean! - } - - - name: Objects not allowed - input: | - type Object { id: ID } - type Query { f(a: Object): Boolean! } - - error: - message: 'cannot use Object as argument a because OBJECT is not a valid input type' - locations: [{line: 2, column: 16}] - - - name: Union not allowed - input: | - type Object { id: ID } - union Union = Object - type Query { f(a: Union): Boolean! } - - error: - message: 'cannot use Union as argument a because UNION is not a valid input type' - locations: [{line: 3, column: 16}] - - - name: Interface not allowed - input: | - interface Interface { id: ID } - type Query { f(a: Interface): Boolean! } - - error: - message: 'cannot use Interface as argument a because INTERFACE is not a valid input type' - locations: [{line: 2, column: 16}] - -enums: - - name: must define one or more unique enum values - input: | - directive @D on ENUM - - # This pattern rejected by parser - # enum InvalidEmum1 {} - - enum InvalidEnum2 @D - - enum ValidEnum { - FOO - } - extend enum ValidEnum @D - extend enum ValidEnum { - BAR - } - error: - message: 'ENUM InvalidEnum2: must define one or more unique enum values.' - locations: [{line: 6, column: 6}] - - name: check reserved names on type name - input: | - enum __FooBar { - A - B - } - error: - message: 'Name "__FooBar" must not begin with "__", which is reserved by GraphQL introspection.' - locations: [{line: 1, column: 6}] - -unions: - - name: union types must be defined - input: | - union Foo = Bar | Baz - type Bar { - id: ID - } - error: - message: "Undefined type \"Baz\"." - locations: [{line: 1, column: 7}] - - name: union types must be objects - input: | - union Foo = Baz - interface Baz { - id: ID - } - error: - message: "UNION type \"Baz\" must be OBJECT." - locations: [{line: 1, column: 7}] - - - name: unions of pure type extensions are valid - input: | - - type Review { - body: String! - author: User! @provides(fields: "username") - product: Product! - } - - extend type User @key(fields: "id") { - id: ID! @external - reviews: [Review] - } - - extend type Product @key(fields: "upc") { - upc: String! @external - reviews: [Review] - } - - union Foo = User | Product - scalar _Any - scalar _FieldSet - directive @external on FIELD_DEFINITION - directive @requires(fields: _FieldSet!) on FIELD_DEFINITION - directive @provides(fields: _FieldSet!) on FIELD_DEFINITION - directive @key(fields: _FieldSet!) on OBJECT | INTERFACE - directive @extends on OBJECT - - - -type extensions: - - name: can extend non existant types - input: | - extend type A { - name: String - } - - - - name: cannot extend incorret type existant types - input: | - scalar A - extend type A { - name: String - } - error: - message: "Cannot extend type A because the base type is a SCALAR, not OBJECT." - locations: [{line: 2, column: 13}] - -directives: - - name: cannot redeclare directives - input: | - directive @A on FIELD_DEFINITION - directive @A on FIELD_DEFINITION - error: - message: "Cannot redeclare directive A." - locations: [{line: 2, column: 12}] - - - name: can redeclare builtin directives - input: | - directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT - directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT - - - name: must be declared - input: | - type User { - name: String @foo - } - error: - message: "Undefined directive foo." - locations: [{line: 2, column: 17}] - - - name: cannot be self-referential - input: | - directive @A(foo: Int! @A) on FIELD_DEFINITION - error: - message: "Directive A cannot refer to itself." - locations: [{line: 1, column: 25}] - - name: check reserved names on type name - input: | - directive @__A on FIELD_DEFINITION - error: - message: 'Name "__A" must not begin with "__", which is reserved by GraphQL introspection.' - locations: [{line: 1, column: 12}] - - - name: Valid arg types - input: | - input Input { id: ID } - enum Enum { A } - scalar Scalar - - directive @A(a: Input, b: Scalar, c: Enum) on FIELD_DEFINITION - - - name: Objects not allowed - input: | - type Object { id: ID } - directive @A(a: Object) on FIELD_DEFINITION - - error: - message: 'cannot use Object as argument a because OBJECT is not a valid input type' - locations: [{line: 2, column: 14}] - - - name: Union not allowed - input: | - type Object { id: ID } - union Union = Object - directive @A(a: Union) on FIELD_DEFINITION - - error: - message: 'cannot use Union as argument a because UNION is not a valid input type' - locations: [{line: 3, column: 14}] - - - name: Interface not allowed - input: | - interface Interface { id: ID } - directive @A(a: Interface) on FIELD_DEFINITION - - error: - message: 'cannot use Interface as argument a because INTERFACE is not a valid input type' - locations: [{line: 2, column: 14}] - - - name: Invalid location usage not allowed - input: | - directive @test on FIELD_DEFINITION - input I1 @test { f: String } - - error: - message: 'Directive test is not applicable on INPUT_OBJECT.' - locations: [{line: 2, column: 11}] - - - name: Valid location usage - input: | - directive @testInputField on INPUT_FIELD_DEFINITION - directive @testField on FIELD_DEFINITION - directive @inp on INPUT_OBJECT - input I1 @inp { f: String @testInputField } - type P { name: String @testField } - interface I { id: ID @testField } - - -entry points: - - name: multiple schema entry points - input: | - schema { - query: Query - } - schema { - query: Query - } - scalar Query - error: - message: "Cannot have multiple schema entry points, consider schema extensions instead." - locations: [{line: 4, column: 8}] - - - name: Undefined schema entrypoint - input: | - schema { - query: Query - } - error: - message: "Schema root query refers to a type Query that does not exist." - locations: [{line: 2, column: 3}] - -entry point extensions: - - name: Undefined schema entrypoint - input: | - schema { - query: Query - } - scalar Query - extend schema { - mutation: Mutation - } - error: - message: "Schema root mutation refers to a type Mutation that does not exist." - locations: [{line: 6, column: 3}] - -type references: - - name: Field types - input: | - type User { - posts: Post - } - error: - message: "Undefined type Post." - locations: [{line: 2, column: 10}] - - - name: Arg types - input: | - type User { - posts(foo: FooBar): String - } - error: - message: "Undefined type FooBar." - locations: [{line: 2, column: 14}] - - - name: Directive arg types - input: | - directive @Foo(foo: FooBar) on FIELD_DEFINITION - - error: - message: "Undefined type FooBar." - locations: [{line: 1, column: 21}] - - - name: Invalid enum value - input: | - enum Enum { true } - - error: - message: "ENUM Enum: non-enum value true." - locations: [{line: 1, column: 6}] diff --git a/vendor/github.com/vektah/gqlparser/v2/validator/suggestionList.go b/vendor/github.com/vektah/gqlparser/v2/validator/suggestionList.go deleted file mode 100644 index f0bbc32786..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/validator/suggestionList.go +++ /dev/null @@ -1,69 +0,0 @@ -package validator - -import ( - "math" - "sort" - "strings" - - "github.com/agnivade/levenshtein" -) - -// Given an invalid input string and a list of valid options, returns a filtered -// list of valid options sorted based on their similarity with the input. -func SuggestionList(input string, options []string) []string { - var results []string - optionsByDistance := map[string]int{} - - for _, option := range options { - distance := lexicalDistance(input, option) - threshold := calcThreshold(input) - if distance <= threshold { - results = append(results, option) - optionsByDistance[option] = distance - } - } - - sort.Slice(results, func(i, j int) bool { - return optionsByDistance[results[i]] < optionsByDistance[results[j]] - }) - return results -} - -func calcThreshold(a string) (threshold int) { - // the logic is copied from here - // https://github.com/graphql/graphql-js/blob/47bd8c8897c72d3efc17ecb1599a95cee6bac5e8/src/jsutils/suggestionList.ts#L14 - threshold = int(math.Floor(float64(len(a))*0.4) + 1) - - if threshold < 1 { - threshold = 1 - } - return -} - -// Computes the lexical distance between strings A and B. -// -// The "distance" between two strings is given by counting the minimum number -// of edits needed to transform string A into string B. An edit can be an -// insertion, deletion, or substitution of a single character, or a swap of two -// adjacent characters. -// -// Includes a custom alteration from Damerau-Levenshtein to treat case changes -// as a single edit which helps identify mis-cased values with an edit distance -// of 1. -// -// This distance can be useful for detecting typos in input or sorting -func lexicalDistance(a, b string) int { - if a == b { - return 0 - } - - a = strings.ToLower(a) - b = strings.ToLower(b) - - // Any case change counts as a single edit - if a == b { - return 1 - } - - return levenshtein.ComputeDistance(a, b) -} diff --git a/vendor/github.com/vektah/gqlparser/v2/validator/validator.go b/vendor/github.com/vektah/gqlparser/v2/validator/validator.go deleted file mode 100644 index 34bf93db3d..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/validator/validator.go +++ /dev/null @@ -1,44 +0,0 @@ -package validator - -import ( - . "github.com/vektah/gqlparser/v2/ast" - "github.com/vektah/gqlparser/v2/gqlerror" -) - -type AddErrFunc func(options ...ErrorOption) - -type ruleFunc func(observers *Events, addError AddErrFunc) - -type rule struct { - name string - rule ruleFunc -} - -var rules []rule - -// addRule to rule set. -// f is called once each time `Validate` is executed. -func AddRule(name string, f ruleFunc) { - rules = append(rules, rule{name: name, rule: f}) -} - -func Validate(schema *Schema, doc *QueryDocument) gqlerror.List { - var errs gqlerror.List - - observers := &Events{} - for i := range rules { - rule := rules[i] - rule.rule(observers, func(options ...ErrorOption) { - err := &gqlerror.Error{ - Rule: rule.name, - } - for _, o := range options { - o(err) - } - errs = append(errs, err) - }) - } - - Walk(schema, doc, observers) - return errs -} diff --git a/vendor/github.com/vektah/gqlparser/v2/validator/vars.go b/vendor/github.com/vektah/gqlparser/v2/validator/vars.go deleted file mode 100644 index 8dbb05bc15..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/validator/vars.go +++ /dev/null @@ -1,258 +0,0 @@ -package validator - -import ( - "encoding/json" - "fmt" - "reflect" - "strconv" - "strings" - - "github.com/vektah/gqlparser/v2/ast" - "github.com/vektah/gqlparser/v2/gqlerror" -) - -var UnexpectedType = fmt.Errorf("Unexpected Type") - -// VariableValues coerces and validates variable values -func VariableValues(schema *ast.Schema, op *ast.OperationDefinition, variables map[string]interface{}) (map[string]interface{}, error) { - coercedVars := map[string]interface{}{} - - validator := varValidator{ - path: ast.Path{ast.PathName("variable")}, - schema: schema, - } - - for _, v := range op.VariableDefinitions { - validator.path = append(validator.path, ast.PathName(v.Variable)) - - if !v.Definition.IsInputType() { - return nil, gqlerror.ErrorPathf(validator.path, "must an input type") - } - - val, hasValue := variables[v.Variable] - - if !hasValue { - if v.DefaultValue != nil { - var err error - val, err = v.DefaultValue.Value(nil) - if err != nil { - return nil, gqlerror.WrapPath(validator.path, err) - } - hasValue = true - } else if v.Type.NonNull { - return nil, gqlerror.ErrorPathf(validator.path, "must be defined") - } - } - - if hasValue { - if val == nil { - if v.Type.NonNull { - return nil, gqlerror.ErrorPathf(validator.path, "cannot be null") - } - coercedVars[v.Variable] = nil - } else { - rv := reflect.ValueOf(val) - - jsonNumber, isJsonNumber := val.(json.Number) - if isJsonNumber { - if v.Type.NamedType == "Int" { - n, err := jsonNumber.Int64() - if err != nil { - return nil, gqlerror.ErrorPathf(validator.path, "cannot use value %d as %s", n, v.Type.NamedType) - } - rv = reflect.ValueOf(n) - } else if v.Type.NamedType == "Float" { - f, err := jsonNumber.Float64() - if err != nil { - return nil, gqlerror.ErrorPathf(validator.path, "cannot use value %f as %s", f, v.Type.NamedType) - } - rv = reflect.ValueOf(f) - - } - } - if rv.Kind() == reflect.Ptr || rv.Kind() == reflect.Interface { - rv = rv.Elem() - } - - rval, err := validator.validateVarType(v.Type, rv) - if err != nil { - return nil, err - } - coercedVars[v.Variable] = rval.Interface() - } - } - - validator.path = validator.path[0 : len(validator.path)-1] - } - return coercedVars, nil -} - -type varValidator struct { - path ast.Path - schema *ast.Schema -} - -func (v *varValidator) validateVarType(typ *ast.Type, val reflect.Value) (reflect.Value, *gqlerror.Error) { - currentPath := v.path - resetPath := func() { - v.path = currentPath - } - defer resetPath() - if typ.Elem != nil { - if val.Kind() != reflect.Slice { - // GraphQL spec says that non-null values should be coerced to an array when possible. - // Hence if the value is not a slice, we create a slice and add val to it. - slc := reflect.MakeSlice(reflect.SliceOf(val.Type()), 0, 0) - slc = reflect.Append(slc, val) - val = slc - } - for i := 0; i < val.Len(); i++ { - resetPath() - v.path = append(v.path, ast.PathIndex(i)) - field := val.Index(i) - if field.Kind() == reflect.Ptr || field.Kind() == reflect.Interface { - if typ.Elem.NonNull && field.IsNil() { - return val, gqlerror.ErrorPathf(v.path, "cannot be null") - } - field = field.Elem() - } - _, err := v.validateVarType(typ.Elem, field) - if err != nil { - return val, err - } - } - return val, nil - } - def := v.schema.Types[typ.NamedType] - if def == nil { - panic(fmt.Errorf("missing def for %s", typ.NamedType)) - } - - if !typ.NonNull && !val.IsValid() { - // If the type is not null and we got a invalid value namely null/nil, then it's valid - return val, nil - } - - switch def.Kind { - case ast.Enum: - kind := val.Type().Kind() - if kind != reflect.Int && kind != reflect.Int32 && kind != reflect.Int64 && kind != reflect.String { - return val, gqlerror.ErrorPathf(v.path, "enums must be ints or strings") - } - isValidEnum := false - for _, enumVal := range def.EnumValues { - if strings.EqualFold(val.String(), enumVal.Name) { - isValidEnum = true - } - } - if !isValidEnum { - return val, gqlerror.ErrorPathf(v.path, "%s is not a valid %s", val.String(), def.Name) - } - return val, nil - case ast.Scalar: - kind := val.Type().Kind() - switch typ.NamedType { - case "Int": - if kind == reflect.Int || kind == reflect.Int32 || kind == reflect.Int64 || kind == reflect.Float32 || kind == reflect.Float64 || IsValidIntString(val, kind) { - return val, nil - } - case "Float": - if kind == reflect.Float32 || kind == reflect.Float64 || kind == reflect.Int || kind == reflect.Int32 || kind == reflect.Int64 || IsValidFloatString(val, kind) { - return val, nil - } - case "String": - if kind == reflect.String { - return val, nil - } - - case "Boolean": - if kind == reflect.Bool { - return val, nil - } - - case "ID": - if kind == reflect.Int || kind == reflect.Int32 || kind == reflect.Int64 || kind == reflect.String { - return val, nil - } - default: - // assume custom scalars are ok - return val, nil - } - return val, gqlerror.ErrorPathf(v.path, "cannot use %s as %s", kind.String(), typ.NamedType) - case ast.InputObject: - if val.Kind() != reflect.Map { - return val, gqlerror.ErrorPathf(v.path, "must be a %s", def.Name) - } - - // check for unknown fields - for _, name := range val.MapKeys() { - val.MapIndex(name) - fieldDef := def.Fields.ForName(name.String()) - resetPath() - v.path = append(v.path, ast.PathName(name.String())) - - switch { - case name.String() == "__typename": - continue - case fieldDef == nil: - return val, gqlerror.ErrorPathf(v.path, "unknown field") - } - } - - for _, fieldDef := range def.Fields { - resetPath() - v.path = append(v.path, ast.PathName(fieldDef.Name)) - - field := val.MapIndex(reflect.ValueOf(fieldDef.Name)) - if !field.IsValid() { - if fieldDef.Type.NonNull { - if fieldDef.DefaultValue != nil { - var err error - _, err = fieldDef.DefaultValue.Value(nil) - if err == nil { - continue - } - } - return val, gqlerror.ErrorPathf(v.path, "must be defined") - } - continue - } - - if field.Kind() == reflect.Ptr || field.Kind() == reflect.Interface { - if fieldDef.Type.NonNull && field.IsNil() { - return val, gqlerror.ErrorPathf(v.path, "cannot be null") - } - //allow null object field and skip it - if !fieldDef.Type.NonNull && field.IsNil() { - continue - } - field = field.Elem() - } - cval, err := v.validateVarType(fieldDef.Type, field) - if err != nil { - return val, err - } - val.SetMapIndex(reflect.ValueOf(fieldDef.Name), cval) - } - default: - panic(fmt.Errorf("unsupported type %s", def.Kind)) - } - return val, nil -} - -func IsValidIntString(val reflect.Value, kind reflect.Kind) bool { - if kind != reflect.String { - return false - } - _, e := strconv.ParseInt(fmt.Sprintf("%v", val.Interface()), 10, 64) - - return e == nil -} - -func IsValidFloatString(val reflect.Value, kind reflect.Kind) bool { - if kind != reflect.String { - return false - } - _, e := strconv.ParseFloat(fmt.Sprintf("%v", val.Interface()), 64) - return e == nil -} diff --git a/vendor/github.com/vektah/gqlparser/v2/validator/walk.go b/vendor/github.com/vektah/gqlparser/v2/validator/walk.go deleted file mode 100644 index 6ee69e4c2e..0000000000 --- a/vendor/github.com/vektah/gqlparser/v2/validator/walk.go +++ /dev/null @@ -1,292 +0,0 @@ -package validator - -import ( - "context" - "fmt" - - "github.com/vektah/gqlparser/v2/ast" -) - -type Events struct { - operationVisitor []func(walker *Walker, operation *ast.OperationDefinition) - field []func(walker *Walker, field *ast.Field) - fragment []func(walker *Walker, fragment *ast.FragmentDefinition) - inlineFragment []func(walker *Walker, inlineFragment *ast.InlineFragment) - fragmentSpread []func(walker *Walker, fragmentSpread *ast.FragmentSpread) - directive []func(walker *Walker, directive *ast.Directive) - directiveList []func(walker *Walker, directives []*ast.Directive) - value []func(walker *Walker, value *ast.Value) - variable []func(walker *Walker, variable *ast.VariableDefinition) -} - -func (o *Events) OnOperation(f func(walker *Walker, operation *ast.OperationDefinition)) { - o.operationVisitor = append(o.operationVisitor, f) -} -func (o *Events) OnField(f func(walker *Walker, field *ast.Field)) { - o.field = append(o.field, f) -} -func (o *Events) OnFragment(f func(walker *Walker, fragment *ast.FragmentDefinition)) { - o.fragment = append(o.fragment, f) -} -func (o *Events) OnInlineFragment(f func(walker *Walker, inlineFragment *ast.InlineFragment)) { - o.inlineFragment = append(o.inlineFragment, f) -} -func (o *Events) OnFragmentSpread(f func(walker *Walker, fragmentSpread *ast.FragmentSpread)) { - o.fragmentSpread = append(o.fragmentSpread, f) -} -func (o *Events) OnDirective(f func(walker *Walker, directive *ast.Directive)) { - o.directive = append(o.directive, f) -} -func (o *Events) OnDirectiveList(f func(walker *Walker, directives []*ast.Directive)) { - o.directiveList = append(o.directiveList, f) -} -func (o *Events) OnValue(f func(walker *Walker, value *ast.Value)) { - o.value = append(o.value, f) -} -func (o *Events) OnVariable(f func(walker *Walker, variable *ast.VariableDefinition)) { - o.variable = append(o.variable, f) -} - -func Walk(schema *ast.Schema, document *ast.QueryDocument, observers *Events) { - w := Walker{ - Observers: observers, - Schema: schema, - Document: document, - } - - w.walk() -} - -type Walker struct { - Context context.Context - Observers *Events - Schema *ast.Schema - Document *ast.QueryDocument - - validatedFragmentSpreads map[string]bool - CurrentOperation *ast.OperationDefinition -} - -func (w *Walker) walk() { - for _, child := range w.Document.Operations { - w.validatedFragmentSpreads = make(map[string]bool) - w.walkOperation(child) - } - for _, child := range w.Document.Fragments { - w.validatedFragmentSpreads = make(map[string]bool) - w.walkFragment(child) - } -} - -func (w *Walker) walkOperation(operation *ast.OperationDefinition) { - w.CurrentOperation = operation - for _, varDef := range operation.VariableDefinitions { - varDef.Definition = w.Schema.Types[varDef.Type.Name()] - for _, v := range w.Observers.variable { - v(w, varDef) - } - if varDef.DefaultValue != nil { - varDef.DefaultValue.ExpectedType = varDef.Type - varDef.DefaultValue.Definition = w.Schema.Types[varDef.Type.Name()] - } - } - - var def *ast.Definition - var loc ast.DirectiveLocation - switch operation.Operation { - case ast.Query, "": - def = w.Schema.Query - loc = ast.LocationQuery - case ast.Mutation: - def = w.Schema.Mutation - loc = ast.LocationMutation - case ast.Subscription: - def = w.Schema.Subscription - loc = ast.LocationSubscription - } - - for _, varDef := range operation.VariableDefinitions { - if varDef.DefaultValue != nil { - w.walkValue(varDef.DefaultValue) - } - w.walkDirectives(varDef.Definition, varDef.Directives, ast.LocationVariableDefinition) - } - - w.walkDirectives(def, operation.Directives, loc) - w.walkSelectionSet(def, operation.SelectionSet) - - for _, v := range w.Observers.operationVisitor { - v(w, operation) - } - w.CurrentOperation = nil -} - -func (w *Walker) walkFragment(it *ast.FragmentDefinition) { - def := w.Schema.Types[it.TypeCondition] - - it.Definition = def - - w.walkDirectives(def, it.Directives, ast.LocationFragmentDefinition) - w.walkSelectionSet(def, it.SelectionSet) - - for _, v := range w.Observers.fragment { - v(w, it) - } -} - -func (w *Walker) walkDirectives(parentDef *ast.Definition, directives []*ast.Directive, location ast.DirectiveLocation) { - for _, dir := range directives { - def := w.Schema.Directives[dir.Name] - dir.Definition = def - dir.ParentDefinition = parentDef - dir.Location = location - - for _, arg := range dir.Arguments { - var argDef *ast.ArgumentDefinition - if def != nil { - argDef = def.Arguments.ForName(arg.Name) - } - - w.walkArgument(argDef, arg) - } - - for _, v := range w.Observers.directive { - v(w, dir) - } - } - - for _, v := range w.Observers.directiveList { - v(w, directives) - } -} - -func (w *Walker) walkValue(value *ast.Value) { - if value.Kind == ast.Variable && w.CurrentOperation != nil { - value.VariableDefinition = w.CurrentOperation.VariableDefinitions.ForName(value.Raw) - if value.VariableDefinition != nil { - value.VariableDefinition.Used = true - } - } - - if value.Kind == ast.ObjectValue { - for _, child := range value.Children { - if value.Definition != nil { - fieldDef := value.Definition.Fields.ForName(child.Name) - if fieldDef != nil { - child.Value.ExpectedType = fieldDef.Type - child.Value.Definition = w.Schema.Types[fieldDef.Type.Name()] - } - } - w.walkValue(child.Value) - } - } - - if value.Kind == ast.ListValue { - for _, child := range value.Children { - if value.ExpectedType != nil && value.ExpectedType.Elem != nil { - child.Value.ExpectedType = value.ExpectedType.Elem - child.Value.Definition = value.Definition - } - - w.walkValue(child.Value) - } - } - - for _, v := range w.Observers.value { - v(w, value) - } -} - -func (w *Walker) walkArgument(argDef *ast.ArgumentDefinition, arg *ast.Argument) { - if argDef != nil { - arg.Value.ExpectedType = argDef.Type - arg.Value.Definition = w.Schema.Types[argDef.Type.Name()] - } - - w.walkValue(arg.Value) -} - -func (w *Walker) walkSelectionSet(parentDef *ast.Definition, it ast.SelectionSet) { - for _, child := range it { - w.walkSelection(parentDef, child) - } -} - -func (w *Walker) walkSelection(parentDef *ast.Definition, it ast.Selection) { - switch it := it.(type) { - case *ast.Field: - var def *ast.FieldDefinition - if it.Name == "__typename" { - def = &ast.FieldDefinition{ - Name: "__typename", - Type: ast.NamedType("String", nil), - } - } else if parentDef != nil { - def = parentDef.Fields.ForName(it.Name) - } - - it.Definition = def - it.ObjectDefinition = parentDef - - var nextParentDef *ast.Definition - if def != nil { - nextParentDef = w.Schema.Types[def.Type.Name()] - } - - for _, arg := range it.Arguments { - var argDef *ast.ArgumentDefinition - if def != nil { - argDef = def.Arguments.ForName(arg.Name) - } - - w.walkArgument(argDef, arg) - } - - w.walkDirectives(nextParentDef, it.Directives, ast.LocationField) - w.walkSelectionSet(nextParentDef, it.SelectionSet) - - for _, v := range w.Observers.field { - v(w, it) - } - - case *ast.InlineFragment: - it.ObjectDefinition = parentDef - - nextParentDef := parentDef - if it.TypeCondition != "" { - nextParentDef = w.Schema.Types[it.TypeCondition] - } - - w.walkDirectives(nextParentDef, it.Directives, ast.LocationInlineFragment) - w.walkSelectionSet(nextParentDef, it.SelectionSet) - - for _, v := range w.Observers.inlineFragment { - v(w, it) - } - - case *ast.FragmentSpread: - def := w.Document.Fragments.ForName(it.Name) - it.Definition = def - it.ObjectDefinition = parentDef - - var nextParentDef *ast.Definition - if def != nil { - nextParentDef = w.Schema.Types[def.TypeCondition] - } - - w.walkDirectives(nextParentDef, it.Directives, ast.LocationFragmentSpread) - - if def != nil && !w.validatedFragmentSpreads[def.Name] { - // prevent inifinite recursion - w.validatedFragmentSpreads[def.Name] = true - w.walkSelectionSet(nextParentDef, def.SelectionSet) - } - - for _, v := range w.Observers.fragmentSpread { - v(w, it) - } - - default: - panic(fmt.Errorf("unsupported %T", it)) - } -} diff --git a/vendor/golang.org/x/mod/internal/lazyregexp/lazyre.go b/vendor/golang.org/x/mod/internal/lazyregexp/lazyre.go deleted file mode 100644 index 150f887e7a..0000000000 --- a/vendor/golang.org/x/mod/internal/lazyregexp/lazyre.go +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package lazyregexp is a thin wrapper over regexp, allowing the use of global -// regexp variables without forcing them to be compiled at init. -package lazyregexp - -import ( - "os" - "regexp" - "strings" - "sync" -) - -// Regexp is a wrapper around [regexp.Regexp], where the underlying regexp will be -// compiled the first time it is needed. -type Regexp struct { - str string - once sync.Once - rx *regexp.Regexp -} - -func (r *Regexp) re() *regexp.Regexp { - r.once.Do(r.build) - return r.rx -} - -func (r *Regexp) build() { - r.rx = regexp.MustCompile(r.str) - r.str = "" -} - -func (r *Regexp) FindSubmatch(s []byte) [][]byte { - return r.re().FindSubmatch(s) -} - -func (r *Regexp) FindStringSubmatch(s string) []string { - return r.re().FindStringSubmatch(s) -} - -func (r *Regexp) FindStringSubmatchIndex(s string) []int { - return r.re().FindStringSubmatchIndex(s) -} - -func (r *Regexp) ReplaceAllString(src, repl string) string { - return r.re().ReplaceAllString(src, repl) -} - -func (r *Regexp) FindString(s string) string { - return r.re().FindString(s) -} - -func (r *Regexp) FindAllString(s string, n int) []string { - return r.re().FindAllString(s, n) -} - -func (r *Regexp) MatchString(s string) bool { - return r.re().MatchString(s) -} - -func (r *Regexp) SubexpNames() []string { - return r.re().SubexpNames() -} - -var inTest = len(os.Args) > 0 && strings.HasSuffix(strings.TrimSuffix(os.Args[0], ".exe"), ".test") - -// New creates a new lazy regexp, delaying the compiling work until it is first -// needed. If the code is being run as part of tests, the regexp compiling will -// happen immediately. -func New(str string) *Regexp { - lr := &Regexp{str: str} - if inTest { - // In tests, always compile the regexps early. - lr.re() - } - return lr -} diff --git a/vendor/golang.org/x/mod/module/module.go b/vendor/golang.org/x/mod/module/module.go deleted file mode 100644 index 2a364b229b..0000000000 --- a/vendor/golang.org/x/mod/module/module.go +++ /dev/null @@ -1,841 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package module defines the module.Version type along with support code. -// -// The [module.Version] type is a simple Path, Version pair: -// -// type Version struct { -// Path string -// Version string -// } -// -// There are no restrictions imposed directly by use of this structure, -// but additional checking functions, most notably [Check], verify that -// a particular path, version pair is valid. -// -// # Escaped Paths -// -// Module paths appear as substrings of file system paths -// (in the download cache) and of web server URLs in the proxy protocol. -// In general we cannot rely on file systems to be case-sensitive, -// nor can we rely on web servers, since they read from file systems. -// That is, we cannot rely on the file system to keep rsc.io/QUOTE -// and rsc.io/quote separate. Windows and macOS don't. -// Instead, we must never require two different casings of a file path. -// Because we want the download cache to match the proxy protocol, -// and because we want the proxy protocol to be possible to serve -// from a tree of static files (which might be stored on a case-insensitive -// file system), the proxy protocol must never require two different casings -// of a URL path either. -// -// One possibility would be to make the escaped form be the lowercase -// hexadecimal encoding of the actual path bytes. This would avoid ever -// needing different casings of a file path, but it would be fairly illegible -// to most programmers when those paths appeared in the file system -// (including in file paths in compiler errors and stack traces) -// in web server logs, and so on. Instead, we want a safe escaped form that -// leaves most paths unaltered. -// -// The safe escaped form is to replace every uppercase letter -// with an exclamation mark followed by the letter's lowercase equivalent. -// -// For example, -// -// github.com/Azure/azure-sdk-for-go -> github.com/!azure/azure-sdk-for-go. -// github.com/GoogleCloudPlatform/cloudsql-proxy -> github.com/!google!cloud!platform/cloudsql-proxy -// github.com/Sirupsen/logrus -> github.com/!sirupsen/logrus. -// -// Import paths that avoid upper-case letters are left unchanged. -// Note that because import paths are ASCII-only and avoid various -// problematic punctuation (like : < and >), the escaped form is also ASCII-only -// and avoids the same problematic punctuation. -// -// Import paths have never allowed exclamation marks, so there is no -// need to define how to escape a literal !. -// -// # Unicode Restrictions -// -// Today, paths are disallowed from using Unicode. -// -// Although paths are currently disallowed from using Unicode, -// we would like at some point to allow Unicode letters as well, to assume that -// file systems and URLs are Unicode-safe (storing UTF-8), and apply -// the !-for-uppercase convention for escaping them in the file system. -// But there are at least two subtle considerations. -// -// First, note that not all case-fold equivalent distinct runes -// form an upper/lower pair. -// For example, U+004B ('K'), U+006B ('k'), and U+212A ('K' for Kelvin) -// are three distinct runes that case-fold to each other. -// When we do add Unicode letters, we must not assume that upper/lower -// are the only case-equivalent pairs. -// Perhaps the Kelvin symbol would be disallowed entirely, for example. -// Or perhaps it would escape as "!!k", or perhaps as "(212A)". -// -// Second, it would be nice to allow Unicode marks as well as letters, -// but marks include combining marks, and then we must deal not -// only with case folding but also normalization: both U+00E9 ('é') -// and U+0065 U+0301 ('e' followed by combining acute accent) -// look the same on the page and are treated by some file systems -// as the same path. If we do allow Unicode marks in paths, there -// must be some kind of normalization to allow only one canonical -// encoding of any character used in an import path. -package module - -// IMPORTANT NOTE -// -// This file essentially defines the set of valid import paths for the go command. -// There are many subtle considerations, including Unicode ambiguity, -// security, network, and file system representations. -// -// This file also defines the set of valid module path and version combinations, -// another topic with many subtle considerations. -// -// Changes to the semantics in this file require approval from rsc. - -import ( - "errors" - "fmt" - "path" - "sort" - "strings" - "unicode" - "unicode/utf8" - - "golang.org/x/mod/semver" -) - -// A Version (for clients, a module.Version) is defined by a module path and version pair. -// These are stored in their plain (unescaped) form. -type Version struct { - // Path is a module path, like "golang.org/x/text" or "rsc.io/quote/v2". - Path string - - // Version is usually a semantic version in canonical form. - // There are three exceptions to this general rule. - // First, the top-level target of a build has no specific version - // and uses Version = "". - // Second, during MVS calculations the version "none" is used - // to represent the decision to take no version of a given module. - // Third, filesystem paths found in "replace" directives are - // represented by a path with an empty version. - Version string `json:",omitempty"` -} - -// String returns a representation of the Version suitable for logging -// (Path@Version, or just Path if Version is empty). -func (m Version) String() string { - if m.Version == "" { - return m.Path - } - return m.Path + "@" + m.Version -} - -// A ModuleError indicates an error specific to a module. -type ModuleError struct { - Path string - Version string - Err error -} - -// VersionError returns a [ModuleError] derived from a [Version] and error, -// or err itself if it is already such an error. -func VersionError(v Version, err error) error { - var mErr *ModuleError - if errors.As(err, &mErr) && mErr.Path == v.Path && mErr.Version == v.Version { - return err - } - return &ModuleError{ - Path: v.Path, - Version: v.Version, - Err: err, - } -} - -func (e *ModuleError) Error() string { - if v, ok := e.Err.(*InvalidVersionError); ok { - return fmt.Sprintf("%s@%s: invalid %s: %v", e.Path, v.Version, v.noun(), v.Err) - } - if e.Version != "" { - return fmt.Sprintf("%s@%s: %v", e.Path, e.Version, e.Err) - } - return fmt.Sprintf("module %s: %v", e.Path, e.Err) -} - -func (e *ModuleError) Unwrap() error { return e.Err } - -// An InvalidVersionError indicates an error specific to a version, with the -// module path unknown or specified externally. -// -// A [ModuleError] may wrap an InvalidVersionError, but an InvalidVersionError -// must not wrap a ModuleError. -type InvalidVersionError struct { - Version string - Pseudo bool - Err error -} - -// noun returns either "version" or "pseudo-version", depending on whether -// e.Version is a pseudo-version. -func (e *InvalidVersionError) noun() string { - if e.Pseudo { - return "pseudo-version" - } - return "version" -} - -func (e *InvalidVersionError) Error() string { - return fmt.Sprintf("%s %q invalid: %s", e.noun(), e.Version, e.Err) -} - -func (e *InvalidVersionError) Unwrap() error { return e.Err } - -// An InvalidPathError indicates a module, import, or file path doesn't -// satisfy all naming constraints. See [CheckPath], [CheckImportPath], -// and [CheckFilePath] for specific restrictions. -type InvalidPathError struct { - Kind string // "module", "import", or "file" - Path string - Err error -} - -func (e *InvalidPathError) Error() string { - return fmt.Sprintf("malformed %s path %q: %v", e.Kind, e.Path, e.Err) -} - -func (e *InvalidPathError) Unwrap() error { return e.Err } - -// Check checks that a given module path, version pair is valid. -// In addition to the path being a valid module path -// and the version being a valid semantic version, -// the two must correspond. -// For example, the path "yaml/v2" only corresponds to -// semantic versions beginning with "v2.". -func Check(path, version string) error { - if err := CheckPath(path); err != nil { - return err - } - if !semver.IsValid(version) { - return &ModuleError{ - Path: path, - Err: &InvalidVersionError{Version: version, Err: errors.New("not a semantic version")}, - } - } - _, pathMajor, _ := SplitPathVersion(path) - if err := CheckPathMajor(version, pathMajor); err != nil { - return &ModuleError{Path: path, Err: err} - } - return nil -} - -// firstPathOK reports whether r can appear in the first element of a module path. -// The first element of the path must be an LDH domain name, at least for now. -// To avoid case ambiguity, the domain name must be entirely lower case. -func firstPathOK(r rune) bool { - return r == '-' || r == '.' || - '0' <= r && r <= '9' || - 'a' <= r && r <= 'z' -} - -// modPathOK reports whether r can appear in a module path element. -// Paths can be ASCII letters, ASCII digits, and limited ASCII punctuation: - . _ and ~. -// -// This matches what "go get" has historically recognized in import paths, -// and avoids confusing sequences like '%20' or '+' that would change meaning -// if used in a URL. -// -// TODO(rsc): We would like to allow Unicode letters, but that requires additional -// care in the safe encoding (see "escaped paths" above). -func modPathOK(r rune) bool { - if r < utf8.RuneSelf { - return r == '-' || r == '.' || r == '_' || r == '~' || - '0' <= r && r <= '9' || - 'A' <= r && r <= 'Z' || - 'a' <= r && r <= 'z' - } - return false -} - -// importPathOK reports whether r can appear in a package import path element. -// -// Import paths are intermediate between module paths and file paths: we allow -// disallow characters that would be confusing or ambiguous as arguments to -// 'go get' (such as '@' and ' ' ), but allow certain characters that are -// otherwise-unambiguous on the command line and historically used for some -// binary names (such as '++' as a suffix for compiler binaries and wrappers). -func importPathOK(r rune) bool { - return modPathOK(r) || r == '+' -} - -// fileNameOK reports whether r can appear in a file name. -// For now we allow all Unicode letters but otherwise limit to pathOK plus a few more punctuation characters. -// If we expand the set of allowed characters here, we have to -// work harder at detecting potential case-folding and normalization collisions. -// See note about "escaped paths" above. -func fileNameOK(r rune) bool { - if r < utf8.RuneSelf { - // Entire set of ASCII punctuation, from which we remove characters: - // ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~ - // We disallow some shell special characters: " ' * < > ? ` | - // (Note that some of those are disallowed by the Windows file system as well.) - // We also disallow path separators / : and \ (fileNameOK is only called on path element characters). - // We allow spaces (U+0020) in file names. - const allowed = "!#$%&()+,-.=@[]^_{}~ " - if '0' <= r && r <= '9' || 'A' <= r && r <= 'Z' || 'a' <= r && r <= 'z' { - return true - } - return strings.ContainsRune(allowed, r) - } - // It may be OK to add more ASCII punctuation here, but only carefully. - // For example Windows disallows < > \, and macOS disallows :, so we must not allow those. - return unicode.IsLetter(r) -} - -// CheckPath checks that a module path is valid. -// A valid module path is a valid import path, as checked by [CheckImportPath], -// with three additional constraints. -// First, the leading path element (up to the first slash, if any), -// by convention a domain name, must contain only lower-case ASCII letters, -// ASCII digits, dots (U+002E), and dashes (U+002D); -// it must contain at least one dot and cannot start with a dash. -// Second, for a final path element of the form /vN, where N looks numeric -// (ASCII digits and dots) must not begin with a leading zero, must not be /v1, -// and must not contain any dots. For paths beginning with "gopkg.in/", -// this second requirement is replaced by a requirement that the path -// follow the gopkg.in server's conventions. -// Third, no path element may begin with a dot. -func CheckPath(path string) (err error) { - defer func() { - if err != nil { - err = &InvalidPathError{Kind: "module", Path: path, Err: err} - } - }() - - if err := checkPath(path, modulePath); err != nil { - return err - } - i := strings.Index(path, "/") - if i < 0 { - i = len(path) - } - if i == 0 { - return fmt.Errorf("leading slash") - } - if !strings.Contains(path[:i], ".") { - return fmt.Errorf("missing dot in first path element") - } - if path[0] == '-' { - return fmt.Errorf("leading dash in first path element") - } - for _, r := range path[:i] { - if !firstPathOK(r) { - return fmt.Errorf("invalid char %q in first path element", r) - } - } - if _, _, ok := SplitPathVersion(path); !ok { - return fmt.Errorf("invalid version") - } - return nil -} - -// CheckImportPath checks that an import path is valid. -// -// A valid import path consists of one or more valid path elements -// separated by slashes (U+002F). (It must not begin with nor end in a slash.) -// -// A valid path element is a non-empty string made up of -// ASCII letters, ASCII digits, and limited ASCII punctuation: - . _ and ~. -// It must not end with a dot (U+002E), nor contain two dots in a row. -// -// The element prefix up to the first dot must not be a reserved file name -// on Windows, regardless of case (CON, com1, NuL, and so on). The element -// must not have a suffix of a tilde followed by one or more ASCII digits -// (to exclude paths elements that look like Windows short-names). -// -// CheckImportPath may be less restrictive in the future, but see the -// top-level package documentation for additional information about -// subtleties of Unicode. -func CheckImportPath(path string) error { - if err := checkPath(path, importPath); err != nil { - return &InvalidPathError{Kind: "import", Path: path, Err: err} - } - return nil -} - -// pathKind indicates what kind of path we're checking. Module paths, -// import paths, and file paths have different restrictions. -type pathKind int - -const ( - modulePath pathKind = iota - importPath - filePath -) - -// checkPath checks that a general path is valid. kind indicates what -// specific constraints should be applied. -// -// checkPath returns an error describing why the path is not valid. -// Because these checks apply to module, import, and file paths, -// and because other checks may be applied, the caller is expected to wrap -// this error with [InvalidPathError]. -func checkPath(path string, kind pathKind) error { - if !utf8.ValidString(path) { - return fmt.Errorf("invalid UTF-8") - } - if path == "" { - return fmt.Errorf("empty string") - } - if path[0] == '-' && kind != filePath { - return fmt.Errorf("leading dash") - } - if strings.Contains(path, "//") { - return fmt.Errorf("double slash") - } - if path[len(path)-1] == '/' { - return fmt.Errorf("trailing slash") - } - elemStart := 0 - for i, r := range path { - if r == '/' { - if err := checkElem(path[elemStart:i], kind); err != nil { - return err - } - elemStart = i + 1 - } - } - if err := checkElem(path[elemStart:], kind); err != nil { - return err - } - return nil -} - -// checkElem checks whether an individual path element is valid. -func checkElem(elem string, kind pathKind) error { - if elem == "" { - return fmt.Errorf("empty path element") - } - if strings.Count(elem, ".") == len(elem) { - return fmt.Errorf("invalid path element %q", elem) - } - if elem[0] == '.' && kind == modulePath { - return fmt.Errorf("leading dot in path element") - } - if elem[len(elem)-1] == '.' { - return fmt.Errorf("trailing dot in path element") - } - for _, r := range elem { - ok := false - switch kind { - case modulePath: - ok = modPathOK(r) - case importPath: - ok = importPathOK(r) - case filePath: - ok = fileNameOK(r) - default: - panic(fmt.Sprintf("internal error: invalid kind %v", kind)) - } - if !ok { - return fmt.Errorf("invalid char %q", r) - } - } - - // Windows disallows a bunch of path elements, sadly. - // See https://docs.microsoft.com/en-us/windows/desktop/fileio/naming-a-file - short := elem - if i := strings.Index(short, "."); i >= 0 { - short = short[:i] - } - for _, bad := range badWindowsNames { - if strings.EqualFold(bad, short) { - return fmt.Errorf("%q disallowed as path element component on Windows", short) - } - } - - if kind == filePath { - // don't check for Windows short-names in file names. They're - // only an issue for import paths. - return nil - } - - // Reject path components that look like Windows short-names. - // Those usually end in a tilde followed by one or more ASCII digits. - if tilde := strings.LastIndexByte(short, '~'); tilde >= 0 && tilde < len(short)-1 { - suffix := short[tilde+1:] - suffixIsDigits := true - for _, r := range suffix { - if r < '0' || r > '9' { - suffixIsDigits = false - break - } - } - if suffixIsDigits { - return fmt.Errorf("trailing tilde and digits in path element") - } - } - - return nil -} - -// CheckFilePath checks that a slash-separated file path is valid. -// The definition of a valid file path is the same as the definition -// of a valid import path except that the set of allowed characters is larger: -// all Unicode letters, ASCII digits, the ASCII space character (U+0020), -// and the ASCII punctuation characters -// “!#$%&()+,-.=@[]^_{}~”. -// (The excluded punctuation characters, " * < > ? ` ' | / \ and :, -// have special meanings in certain shells or operating systems.) -// -// CheckFilePath may be less restrictive in the future, but see the -// top-level package documentation for additional information about -// subtleties of Unicode. -func CheckFilePath(path string) error { - if err := checkPath(path, filePath); err != nil { - return &InvalidPathError{Kind: "file", Path: path, Err: err} - } - return nil -} - -// badWindowsNames are the reserved file path elements on Windows. -// See https://docs.microsoft.com/en-us/windows/desktop/fileio/naming-a-file -var badWindowsNames = []string{ - "CON", - "PRN", - "AUX", - "NUL", - "COM1", - "COM2", - "COM3", - "COM4", - "COM5", - "COM6", - "COM7", - "COM8", - "COM9", - "LPT1", - "LPT2", - "LPT3", - "LPT4", - "LPT5", - "LPT6", - "LPT7", - "LPT8", - "LPT9", -} - -// SplitPathVersion returns prefix and major version such that prefix+pathMajor == path -// and version is either empty or "/vN" for N >= 2. -// As a special case, gopkg.in paths are recognized directly; -// they require ".vN" instead of "/vN", and for all N, not just N >= 2. -// SplitPathVersion returns with ok = false when presented with -// a path whose last path element does not satisfy the constraints -// applied by [CheckPath], such as "example.com/pkg/v1" or "example.com/pkg/v1.2". -func SplitPathVersion(path string) (prefix, pathMajor string, ok bool) { - if strings.HasPrefix(path, "gopkg.in/") { - return splitGopkgIn(path) - } - - i := len(path) - dot := false - for i > 0 && ('0' <= path[i-1] && path[i-1] <= '9' || path[i-1] == '.') { - if path[i-1] == '.' { - dot = true - } - i-- - } - if i <= 1 || i == len(path) || path[i-1] != 'v' || path[i-2] != '/' { - return path, "", true - } - prefix, pathMajor = path[:i-2], path[i-2:] - if dot || len(pathMajor) <= 2 || pathMajor[2] == '0' || pathMajor == "/v1" { - return path, "", false - } - return prefix, pathMajor, true -} - -// splitGopkgIn is like SplitPathVersion but only for gopkg.in paths. -func splitGopkgIn(path string) (prefix, pathMajor string, ok bool) { - if !strings.HasPrefix(path, "gopkg.in/") { - return path, "", false - } - i := len(path) - if strings.HasSuffix(path, "-unstable") { - i -= len("-unstable") - } - for i > 0 && ('0' <= path[i-1] && path[i-1] <= '9') { - i-- - } - if i <= 1 || path[i-1] != 'v' || path[i-2] != '.' { - // All gopkg.in paths must end in vN for some N. - return path, "", false - } - prefix, pathMajor = path[:i-2], path[i-2:] - if len(pathMajor) <= 2 || pathMajor[2] == '0' && pathMajor != ".v0" { - return path, "", false - } - return prefix, pathMajor, true -} - -// MatchPathMajor reports whether the semantic version v -// matches the path major version pathMajor. -// -// MatchPathMajor returns true if and only if [CheckPathMajor] returns nil. -func MatchPathMajor(v, pathMajor string) bool { - return CheckPathMajor(v, pathMajor) == nil -} - -// CheckPathMajor returns a non-nil error if the semantic version v -// does not match the path major version pathMajor. -func CheckPathMajor(v, pathMajor string) error { - // TODO(jayconrod): return errors or panic for invalid inputs. This function - // (and others) was covered by integration tests for cmd/go, and surrounding - // code protected against invalid inputs like non-canonical versions. - if strings.HasPrefix(pathMajor, ".v") && strings.HasSuffix(pathMajor, "-unstable") { - pathMajor = strings.TrimSuffix(pathMajor, "-unstable") - } - if strings.HasPrefix(v, "v0.0.0-") && pathMajor == ".v1" { - // Allow old bug in pseudo-versions that generated v0.0.0- pseudoversion for gopkg .v1. - // For example, gopkg.in/yaml.v2@v2.2.1's go.mod requires gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405. - return nil - } - m := semver.Major(v) - if pathMajor == "" { - if m == "v0" || m == "v1" || semver.Build(v) == "+incompatible" { - return nil - } - pathMajor = "v0 or v1" - } else if pathMajor[0] == '/' || pathMajor[0] == '.' { - if m == pathMajor[1:] { - return nil - } - pathMajor = pathMajor[1:] - } - return &InvalidVersionError{ - Version: v, - Err: fmt.Errorf("should be %s, not %s", pathMajor, semver.Major(v)), - } -} - -// PathMajorPrefix returns the major-version tag prefix implied by pathMajor. -// An empty PathMajorPrefix allows either v0 or v1. -// -// Note that [MatchPathMajor] may accept some versions that do not actually begin -// with this prefix: namely, it accepts a 'v0.0.0-' prefix for a '.v1' -// pathMajor, even though that pathMajor implies 'v1' tagging. -func PathMajorPrefix(pathMajor string) string { - if pathMajor == "" { - return "" - } - if pathMajor[0] != '/' && pathMajor[0] != '.' { - panic("pathMajor suffix " + pathMajor + " passed to PathMajorPrefix lacks separator") - } - if strings.HasPrefix(pathMajor, ".v") && strings.HasSuffix(pathMajor, "-unstable") { - pathMajor = strings.TrimSuffix(pathMajor, "-unstable") - } - m := pathMajor[1:] - if m != semver.Major(m) { - panic("pathMajor suffix " + pathMajor + "passed to PathMajorPrefix is not a valid major version") - } - return m -} - -// CanonicalVersion returns the canonical form of the version string v. -// It is the same as [semver.Canonical] except that it preserves the special build suffix "+incompatible". -func CanonicalVersion(v string) string { - cv := semver.Canonical(v) - if semver.Build(v) == "+incompatible" { - cv += "+incompatible" - } - return cv -} - -// Sort sorts the list by Path, breaking ties by comparing [Version] fields. -// The Version fields are interpreted as semantic versions (using [semver.Compare]) -// optionally followed by a tie-breaking suffix introduced by a slash character, -// like in "v0.0.1/go.mod". -func Sort(list []Version) { - sort.Slice(list, func(i, j int) bool { - mi := list[i] - mj := list[j] - if mi.Path != mj.Path { - return mi.Path < mj.Path - } - // To help go.sum formatting, allow version/file. - // Compare semver prefix by semver rules, - // file by string order. - vi := mi.Version - vj := mj.Version - var fi, fj string - if k := strings.Index(vi, "/"); k >= 0 { - vi, fi = vi[:k], vi[k:] - } - if k := strings.Index(vj, "/"); k >= 0 { - vj, fj = vj[:k], vj[k:] - } - if vi != vj { - return semver.Compare(vi, vj) < 0 - } - return fi < fj - }) -} - -// EscapePath returns the escaped form of the given module path. -// It fails if the module path is invalid. -func EscapePath(path string) (escaped string, err error) { - if err := CheckPath(path); err != nil { - return "", err - } - - return escapeString(path) -} - -// EscapeVersion returns the escaped form of the given module version. -// Versions are allowed to be in non-semver form but must be valid file names -// and not contain exclamation marks. -func EscapeVersion(v string) (escaped string, err error) { - if err := checkElem(v, filePath); err != nil || strings.Contains(v, "!") { - return "", &InvalidVersionError{ - Version: v, - Err: fmt.Errorf("disallowed version string"), - } - } - return escapeString(v) -} - -func escapeString(s string) (escaped string, err error) { - haveUpper := false - for _, r := range s { - if r == '!' || r >= utf8.RuneSelf { - // This should be disallowed by CheckPath, but diagnose anyway. - // The correctness of the escaping loop below depends on it. - return "", fmt.Errorf("internal error: inconsistency in EscapePath") - } - if 'A' <= r && r <= 'Z' { - haveUpper = true - } - } - - if !haveUpper { - return s, nil - } - - var buf []byte - for _, r := range s { - if 'A' <= r && r <= 'Z' { - buf = append(buf, '!', byte(r+'a'-'A')) - } else { - buf = append(buf, byte(r)) - } - } - return string(buf), nil -} - -// UnescapePath returns the module path for the given escaped path. -// It fails if the escaped path is invalid or describes an invalid path. -func UnescapePath(escaped string) (path string, err error) { - path, ok := unescapeString(escaped) - if !ok { - return "", fmt.Errorf("invalid escaped module path %q", escaped) - } - if err := CheckPath(path); err != nil { - return "", fmt.Errorf("invalid escaped module path %q: %v", escaped, err) - } - return path, nil -} - -// UnescapeVersion returns the version string for the given escaped version. -// It fails if the escaped form is invalid or describes an invalid version. -// Versions are allowed to be in non-semver form but must be valid file names -// and not contain exclamation marks. -func UnescapeVersion(escaped string) (v string, err error) { - v, ok := unescapeString(escaped) - if !ok { - return "", fmt.Errorf("invalid escaped version %q", escaped) - } - if err := checkElem(v, filePath); err != nil { - return "", fmt.Errorf("invalid escaped version %q: %v", v, err) - } - return v, nil -} - -func unescapeString(escaped string) (string, bool) { - var buf []byte - - bang := false - for _, r := range escaped { - if r >= utf8.RuneSelf { - return "", false - } - if bang { - bang = false - if r < 'a' || 'z' < r { - return "", false - } - buf = append(buf, byte(r+'A'-'a')) - continue - } - if r == '!' { - bang = true - continue - } - if 'A' <= r && r <= 'Z' { - return "", false - } - buf = append(buf, byte(r)) - } - if bang { - return "", false - } - return string(buf), true -} - -// MatchPrefixPatterns reports whether any path prefix of target matches one of -// the glob patterns (as defined by [path.Match]) in the comma-separated globs -// list. This implements the algorithm used when matching a module path to the -// GOPRIVATE environment variable, as described by 'go help module-private'. -// -// It ignores any empty or malformed patterns in the list. -// Trailing slashes on patterns are ignored. -func MatchPrefixPatterns(globs, target string) bool { - for globs != "" { - // Extract next non-empty glob in comma-separated list. - var glob string - if i := strings.Index(globs, ","); i >= 0 { - glob, globs = globs[:i], globs[i+1:] - } else { - glob, globs = globs, "" - } - glob = strings.TrimSuffix(glob, "/") - if glob == "" { - continue - } - - // A glob with N+1 path elements (N slashes) needs to be matched - // against the first N+1 path elements of target, - // which end just before the N+1'th slash. - n := strings.Count(glob, "/") - prefix := target - // Walk target, counting slashes, truncating at the N+1'th slash. - for i := 0; i < len(target); i++ { - if target[i] == '/' { - if n == 0 { - prefix = target[:i] - break - } - n-- - } - } - if n > 0 { - // Not enough prefix elements. - continue - } - matched, _ := path.Match(glob, prefix) - if matched { - return true - } - } - return false -} diff --git a/vendor/golang.org/x/mod/module/pseudo.go b/vendor/golang.org/x/mod/module/pseudo.go deleted file mode 100644 index 9cf19d3254..0000000000 --- a/vendor/golang.org/x/mod/module/pseudo.go +++ /dev/null @@ -1,250 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Pseudo-versions -// -// Code authors are expected to tag the revisions they want users to use, -// including prereleases. However, not all authors tag versions at all, -// and not all commits a user might want to try will have tags. -// A pseudo-version is a version with a special form that allows us to -// address an untagged commit and order that version with respect to -// other versions we might encounter. -// -// A pseudo-version takes one of the general forms: -// -// (1) vX.0.0-yyyymmddhhmmss-abcdef123456 -// (2) vX.Y.(Z+1)-0.yyyymmddhhmmss-abcdef123456 -// (3) vX.Y.(Z+1)-0.yyyymmddhhmmss-abcdef123456+incompatible -// (4) vX.Y.Z-pre.0.yyyymmddhhmmss-abcdef123456 -// (5) vX.Y.Z-pre.0.yyyymmddhhmmss-abcdef123456+incompatible -// -// If there is no recently tagged version with the right major version vX, -// then form (1) is used, creating a space of pseudo-versions at the bottom -// of the vX version range, less than any tagged version, including the unlikely v0.0.0. -// -// If the most recent tagged version before the target commit is vX.Y.Z or vX.Y.Z+incompatible, -// then the pseudo-version uses form (2) or (3), making it a prerelease for the next -// possible semantic version after vX.Y.Z. The leading 0 segment in the prerelease string -// ensures that the pseudo-version compares less than possible future explicit prereleases -// like vX.Y.(Z+1)-rc1 or vX.Y.(Z+1)-1. -// -// If the most recent tagged version before the target commit is vX.Y.Z-pre or vX.Y.Z-pre+incompatible, -// then the pseudo-version uses form (4) or (5), making it a slightly later prerelease. - -package module - -import ( - "errors" - "fmt" - "strings" - "time" - - "golang.org/x/mod/internal/lazyregexp" - "golang.org/x/mod/semver" -) - -var pseudoVersionRE = lazyregexp.New(`^v[0-9]+\.(0\.0-|\d+\.\d+-([^+]*\.)?0\.)\d{14}-[A-Za-z0-9]+(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$`) - -const PseudoVersionTimestampFormat = "20060102150405" - -// PseudoVersion returns a pseudo-version for the given major version ("v1") -// preexisting older tagged version ("" or "v1.2.3" or "v1.2.3-pre"), revision time, -// and revision identifier (usually a 12-byte commit hash prefix). -func PseudoVersion(major, older string, t time.Time, rev string) string { - if major == "" { - major = "v0" - } - segment := fmt.Sprintf("%s-%s", t.UTC().Format(PseudoVersionTimestampFormat), rev) - build := semver.Build(older) - older = semver.Canonical(older) - if older == "" { - return major + ".0.0-" + segment // form (1) - } - if semver.Prerelease(older) != "" { - return older + ".0." + segment + build // form (4), (5) - } - - // Form (2), (3). - // Extract patch from vMAJOR.MINOR.PATCH - i := strings.LastIndex(older, ".") + 1 - v, patch := older[:i], older[i:] - - // Reassemble. - return v + incDecimal(patch) + "-0." + segment + build -} - -// ZeroPseudoVersion returns a pseudo-version with a zero timestamp and -// revision, which may be used as a placeholder. -func ZeroPseudoVersion(major string) string { - return PseudoVersion(major, "", time.Time{}, "000000000000") -} - -// incDecimal returns the decimal string incremented by 1. -func incDecimal(decimal string) string { - // Scan right to left turning 9s to 0s until you find a digit to increment. - digits := []byte(decimal) - i := len(digits) - 1 - for ; i >= 0 && digits[i] == '9'; i-- { - digits[i] = '0' - } - if i >= 0 { - digits[i]++ - } else { - // digits is all zeros - digits[0] = '1' - digits = append(digits, '0') - } - return string(digits) -} - -// decDecimal returns the decimal string decremented by 1, or the empty string -// if the decimal is all zeroes. -func decDecimal(decimal string) string { - // Scan right to left turning 0s to 9s until you find a digit to decrement. - digits := []byte(decimal) - i := len(digits) - 1 - for ; i >= 0 && digits[i] == '0'; i-- { - digits[i] = '9' - } - if i < 0 { - // decimal is all zeros - return "" - } - if i == 0 && digits[i] == '1' && len(digits) > 1 { - digits = digits[1:] - } else { - digits[i]-- - } - return string(digits) -} - -// IsPseudoVersion reports whether v is a pseudo-version. -func IsPseudoVersion(v string) bool { - return strings.Count(v, "-") >= 2 && semver.IsValid(v) && pseudoVersionRE.MatchString(v) -} - -// IsZeroPseudoVersion returns whether v is a pseudo-version with a zero base, -// timestamp, and revision, as returned by [ZeroPseudoVersion]. -func IsZeroPseudoVersion(v string) bool { - return v == ZeroPseudoVersion(semver.Major(v)) -} - -// PseudoVersionTime returns the time stamp of the pseudo-version v. -// It returns an error if v is not a pseudo-version or if the time stamp -// embedded in the pseudo-version is not a valid time. -func PseudoVersionTime(v string) (time.Time, error) { - _, timestamp, _, _, err := parsePseudoVersion(v) - if err != nil { - return time.Time{}, err - } - t, err := time.Parse("20060102150405", timestamp) - if err != nil { - return time.Time{}, &InvalidVersionError{ - Version: v, - Pseudo: true, - Err: fmt.Errorf("malformed time %q", timestamp), - } - } - return t, nil -} - -// PseudoVersionRev returns the revision identifier of the pseudo-version v. -// It returns an error if v is not a pseudo-version. -func PseudoVersionRev(v string) (rev string, err error) { - _, _, rev, _, err = parsePseudoVersion(v) - return -} - -// PseudoVersionBase returns the canonical parent version, if any, upon which -// the pseudo-version v is based. -// -// If v has no parent version (that is, if it is "vX.0.0-[…]"), -// PseudoVersionBase returns the empty string and a nil error. -func PseudoVersionBase(v string) (string, error) { - base, _, _, build, err := parsePseudoVersion(v) - if err != nil { - return "", err - } - - switch pre := semver.Prerelease(base); pre { - case "": - // vX.0.0-yyyymmddhhmmss-abcdef123456 → "" - if build != "" { - // Pseudo-versions of the form vX.0.0-yyyymmddhhmmss-abcdef123456+incompatible - // are nonsensical: the "vX.0.0-" prefix implies that there is no parent tag, - // but the "+incompatible" suffix implies that the major version of - // the parent tag is not compatible with the module's import path. - // - // There are a few such entries in the index generated by proxy.golang.org, - // but we believe those entries were generated by the proxy itself. - return "", &InvalidVersionError{ - Version: v, - Pseudo: true, - Err: fmt.Errorf("lacks base version, but has build metadata %q", build), - } - } - return "", nil - - case "-0": - // vX.Y.(Z+1)-0.yyyymmddhhmmss-abcdef123456 → vX.Y.Z - // vX.Y.(Z+1)-0.yyyymmddhhmmss-abcdef123456+incompatible → vX.Y.Z+incompatible - base = strings.TrimSuffix(base, pre) - i := strings.LastIndexByte(base, '.') - if i < 0 { - panic("base from parsePseudoVersion missing patch number: " + base) - } - patch := decDecimal(base[i+1:]) - if patch == "" { - // vX.0.0-0 is invalid, but has been observed in the wild in the index - // generated by requests to proxy.golang.org. - // - // NOTE(bcmills): I cannot find a historical bug that accounts for - // pseudo-versions of this form, nor have I seen such versions in any - // actual go.mod files. If we find actual examples of this form and a - // reasonable theory of how they came into existence, it seems fine to - // treat them as equivalent to vX.0.0 (especially since the invalid - // pseudo-versions have lower precedence than the real ones). For now, we - // reject them. - return "", &InvalidVersionError{ - Version: v, - Pseudo: true, - Err: fmt.Errorf("version before %s would have negative patch number", base), - } - } - return base[:i+1] + patch + build, nil - - default: - // vX.Y.Z-pre.0.yyyymmddhhmmss-abcdef123456 → vX.Y.Z-pre - // vX.Y.Z-pre.0.yyyymmddhhmmss-abcdef123456+incompatible → vX.Y.Z-pre+incompatible - if !strings.HasSuffix(base, ".0") { - panic(`base from parsePseudoVersion missing ".0" before date: ` + base) - } - return strings.TrimSuffix(base, ".0") + build, nil - } -} - -var errPseudoSyntax = errors.New("syntax error") - -func parsePseudoVersion(v string) (base, timestamp, rev, build string, err error) { - if !IsPseudoVersion(v) { - return "", "", "", "", &InvalidVersionError{ - Version: v, - Pseudo: true, - Err: errPseudoSyntax, - } - } - build = semver.Build(v) - v = strings.TrimSuffix(v, build) - j := strings.LastIndex(v, "-") - v, rev = v[:j], v[j+1:] - i := strings.LastIndex(v, "-") - if j := strings.LastIndex(v, "."); j > i { - base = v[:j] // "vX.Y.Z-pre.0" or "vX.Y.(Z+1)-0" - timestamp = v[j+1:] - } else { - base = v[:i] // "vX.0.0" - timestamp = v[i+1:] - } - return base, timestamp, rev, build, nil -} diff --git a/vendor/golang.org/x/tools/imports/forward.go b/vendor/golang.org/x/tools/imports/forward.go deleted file mode 100644 index d2547c7433..0000000000 --- a/vendor/golang.org/x/tools/imports/forward.go +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package imports implements a Go pretty-printer (like package "go/format") -// that also adds or removes import statements as necessary. -package imports // import "golang.org/x/tools/imports" - -import ( - "io/ioutil" - "log" - - "golang.org/x/tools/internal/gocommand" - intimp "golang.org/x/tools/internal/imports" -) - -// Options specifies options for processing files. -type Options struct { - Fragment bool // Accept fragment of a source file (no package statement) - AllErrors bool // Report all errors (not just the first 10 on different lines) - - Comments bool // Print comments (true if nil *Options provided) - TabIndent bool // Use tabs for indent (true if nil *Options provided) - TabWidth int // Tab width (8 if nil *Options provided) - - FormatOnly bool // Disable the insertion and deletion of imports -} - -// Debug controls verbose logging. -var Debug = false - -// LocalPrefix is a comma-separated string of import path prefixes, which, if -// set, instructs Process to sort the import paths with the given prefixes -// into another group after 3rd-party packages. -var LocalPrefix string - -// Process formats and adjusts imports for the provided file. -// If opt is nil the defaults are used, and if src is nil the source -// is read from the filesystem. -// -// Note that filename's directory influences which imports can be chosen, -// so it is important that filename be accurate. -// To process data “as if” it were in filename, pass the data as a non-nil src. -func Process(filename string, src []byte, opt *Options) ([]byte, error) { - var err error - if src == nil { - src, err = ioutil.ReadFile(filename) - if err != nil { - return nil, err - } - } - if opt == nil { - opt = &Options{Comments: true, TabIndent: true, TabWidth: 8} - } - intopt := &intimp.Options{ - Env: &intimp.ProcessEnv{ - GocmdRunner: &gocommand.Runner{}, - }, - LocalPrefix: LocalPrefix, - AllErrors: opt.AllErrors, - Comments: opt.Comments, - FormatOnly: opt.FormatOnly, - Fragment: opt.Fragment, - TabIndent: opt.TabIndent, - TabWidth: opt.TabWidth, - } - if Debug { - intopt.Env.Logf = log.Printf - } - return intimp.Process(filename, src, intopt) -} - -// VendorlessPath returns the devendorized version of the import path ipath. -// For example, VendorlessPath("foo/bar/vendor/a/b") returns "a/b". -func VendorlessPath(ipath string) string { - return intimp.VendorlessPath(ipath) -} diff --git a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk.go b/vendor/golang.org/x/tools/internal/fastwalk/fastwalk.go deleted file mode 100644 index c40c7e9310..0000000000 --- a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk.go +++ /dev/null @@ -1,196 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package fastwalk provides a faster version of [filepath.Walk] for file system -// scanning tools. -package fastwalk - -import ( - "errors" - "os" - "path/filepath" - "runtime" - "sync" -) - -// ErrTraverseLink is used as a return value from WalkFuncs to indicate that the -// symlink named in the call may be traversed. -var ErrTraverseLink = errors.New("fastwalk: traverse symlink, assuming target is a directory") - -// ErrSkipFiles is a used as a return value from WalkFuncs to indicate that the -// callback should not be called for any other files in the current directory. -// Child directories will still be traversed. -var ErrSkipFiles = errors.New("fastwalk: skip remaining files in directory") - -// Walk is a faster implementation of [filepath.Walk]. -// -// [filepath.Walk]'s design necessarily calls [os.Lstat] on each file, -// even if the caller needs less info. -// Many tools need only the type of each file. -// On some platforms, this information is provided directly by the readdir -// system call, avoiding the need to stat each file individually. -// fastwalk_unix.go contains a fork of the syscall routines. -// -// See golang.org/issue/16399. -// -// Walk walks the file tree rooted at root, calling walkFn for -// each file or directory in the tree, including root. -// -// If Walk returns [filepath.SkipDir], the directory is skipped. -// -// Unlike [filepath.Walk]: -// - file stat calls must be done by the user. -// The only provided metadata is the file type, which does not include -// any permission bits. -// - multiple goroutines stat the filesystem concurrently. The provided -// walkFn must be safe for concurrent use. -// - Walk can follow symlinks if walkFn returns the TraverseLink -// sentinel error. It is the walkFn's responsibility to prevent -// Walk from going into symlink cycles. -func Walk(root string, walkFn func(path string, typ os.FileMode) error) error { - // TODO(bradfitz): make numWorkers configurable? We used a - // minimum of 4 to give the kernel more info about multiple - // things we want, in hopes its I/O scheduling can take - // advantage of that. Hopefully most are in cache. Maybe 4 is - // even too low of a minimum. Profile more. - numWorkers := 4 - if n := runtime.NumCPU(); n > numWorkers { - numWorkers = n - } - - // Make sure to wait for all workers to finish, otherwise - // walkFn could still be called after returning. This Wait call - // runs after close(e.donec) below. - var wg sync.WaitGroup - defer wg.Wait() - - w := &walker{ - fn: walkFn, - enqueuec: make(chan walkItem, numWorkers), // buffered for performance - workc: make(chan walkItem, numWorkers), // buffered for performance - donec: make(chan struct{}), - - // buffered for correctness & not leaking goroutines: - resc: make(chan error, numWorkers), - } - defer close(w.donec) - - for i := 0; i < numWorkers; i++ { - wg.Add(1) - go w.doWork(&wg) - } - todo := []walkItem{{dir: root}} - out := 0 - for { - workc := w.workc - var workItem walkItem - if len(todo) == 0 { - workc = nil - } else { - workItem = todo[len(todo)-1] - } - select { - case workc <- workItem: - todo = todo[:len(todo)-1] - out++ - case it := <-w.enqueuec: - todo = append(todo, it) - case err := <-w.resc: - out-- - if err != nil { - return err - } - if out == 0 && len(todo) == 0 { - // It's safe to quit here, as long as the buffered - // enqueue channel isn't also readable, which might - // happen if the worker sends both another unit of - // work and its result before the other select was - // scheduled and both w.resc and w.enqueuec were - // readable. - select { - case it := <-w.enqueuec: - todo = append(todo, it) - default: - return nil - } - } - } - } -} - -// doWork reads directories as instructed (via workc) and runs the -// user's callback function. -func (w *walker) doWork(wg *sync.WaitGroup) { - defer wg.Done() - for { - select { - case <-w.donec: - return - case it := <-w.workc: - select { - case <-w.donec: - return - case w.resc <- w.walk(it.dir, !it.callbackDone): - } - } - } -} - -type walker struct { - fn func(path string, typ os.FileMode) error - - donec chan struct{} // closed on fastWalk's return - workc chan walkItem // to workers - enqueuec chan walkItem // from workers - resc chan error // from workers -} - -type walkItem struct { - dir string - callbackDone bool // callback already called; don't do it again -} - -func (w *walker) enqueue(it walkItem) { - select { - case w.enqueuec <- it: - case <-w.donec: - } -} - -func (w *walker) onDirEnt(dirName, baseName string, typ os.FileMode) error { - joined := dirName + string(os.PathSeparator) + baseName - if typ == os.ModeDir { - w.enqueue(walkItem{dir: joined}) - return nil - } - - err := w.fn(joined, typ) - if typ == os.ModeSymlink { - if err == ErrTraverseLink { - // Set callbackDone so we don't call it twice for both the - // symlink-as-symlink and the symlink-as-directory later: - w.enqueue(walkItem{dir: joined, callbackDone: true}) - return nil - } - if err == filepath.SkipDir { - // Permit SkipDir on symlinks too. - return nil - } - } - return err -} - -func (w *walker) walk(root string, runUserCallback bool) error { - if runUserCallback { - err := w.fn(root, os.ModeDir) - if err == filepath.SkipDir { - return nil - } - if err != nil { - return err - } - } - - return readDir(root, w.onDirEnt) -} diff --git a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_darwin.go b/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_darwin.go deleted file mode 100644 index 0ca55e0d56..0000000000 --- a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_darwin.go +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright 2022 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build darwin && cgo -// +build darwin,cgo - -package fastwalk - -/* -#include - -// fastwalk_readdir_r wraps readdir_r so that we don't have to pass a dirent** -// result pointer which triggers CGO's "Go pointer to Go pointer" check unless -// we allocat the result dirent* with malloc. -// -// fastwalk_readdir_r returns 0 on success, -1 upon reaching the end of the -// directory, or a positive error number to indicate failure. -static int fastwalk_readdir_r(DIR *fd, struct dirent *entry) { - struct dirent *result; - int ret = readdir_r(fd, entry, &result); - if (ret == 0 && result == NULL) { - ret = -1; // EOF - } - return ret; -} -*/ -import "C" - -import ( - "os" - "syscall" - "unsafe" -) - -func readDir(dirName string, fn func(dirName, entName string, typ os.FileMode) error) error { - fd, err := openDir(dirName) - if err != nil { - return &os.PathError{Op: "opendir", Path: dirName, Err: err} - } - defer C.closedir(fd) - - skipFiles := false - var dirent syscall.Dirent - for { - ret := int(C.fastwalk_readdir_r(fd, (*C.struct_dirent)(unsafe.Pointer(&dirent)))) - if ret != 0 { - if ret == -1 { - break // EOF - } - if ret == int(syscall.EINTR) { - continue - } - return &os.PathError{Op: "readdir", Path: dirName, Err: syscall.Errno(ret)} - } - if dirent.Ino == 0 { - continue - } - typ := dtToType(dirent.Type) - if skipFiles && typ.IsRegular() { - continue - } - name := (*[len(syscall.Dirent{}.Name)]byte)(unsafe.Pointer(&dirent.Name))[:] - name = name[:dirent.Namlen] - for i, c := range name { - if c == 0 { - name = name[:i] - break - } - } - // Check for useless names before allocating a string. - if string(name) == "." || string(name) == ".." { - continue - } - if err := fn(dirName, string(name), typ); err != nil { - if err != ErrSkipFiles { - return err - } - skipFiles = true - } - } - - return nil -} - -func dtToType(typ uint8) os.FileMode { - switch typ { - case syscall.DT_BLK: - return os.ModeDevice - case syscall.DT_CHR: - return os.ModeDevice | os.ModeCharDevice - case syscall.DT_DIR: - return os.ModeDir - case syscall.DT_FIFO: - return os.ModeNamedPipe - case syscall.DT_LNK: - return os.ModeSymlink - case syscall.DT_REG: - return 0 - case syscall.DT_SOCK: - return os.ModeSocket - } - return ^os.FileMode(0) -} - -// openDir wraps opendir(3) and handles any EINTR errors. The returned *DIR -// needs to be closed with closedir(3). -func openDir(path string) (*C.DIR, error) { - name, err := syscall.BytePtrFromString(path) - if err != nil { - return nil, err - } - for { - fd, err := C.opendir((*C.char)(unsafe.Pointer(name))) - if err != syscall.EINTR { - return fd, err - } - } -} diff --git a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_fileno.go b/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_fileno.go deleted file mode 100644 index d58595dbd3..0000000000 --- a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_fileno.go +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build freebsd || openbsd || netbsd -// +build freebsd openbsd netbsd - -package fastwalk - -import "syscall" - -func direntInode(dirent *syscall.Dirent) uint64 { - return uint64(dirent.Fileno) -} diff --git a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_ino.go b/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_ino.go deleted file mode 100644 index d3922890b0..0000000000 --- a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_ino.go +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build (linux || (darwin && !cgo)) && !appengine -// +build linux darwin,!cgo -// +build !appengine - -package fastwalk - -import "syscall" - -func direntInode(dirent *syscall.Dirent) uint64 { - return dirent.Ino -} diff --git a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_bsd.go b/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_bsd.go deleted file mode 100644 index 38a4db6af3..0000000000 --- a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_bsd.go +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build (darwin && !cgo) || freebsd || openbsd || netbsd -// +build darwin,!cgo freebsd openbsd netbsd - -package fastwalk - -import "syscall" - -func direntNamlen(dirent *syscall.Dirent) uint64 { - return uint64(dirent.Namlen) -} diff --git a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_linux.go b/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_linux.go deleted file mode 100644 index c82e57df85..0000000000 --- a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_linux.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build linux && !appengine -// +build linux,!appengine - -package fastwalk - -import ( - "bytes" - "syscall" - "unsafe" -) - -func direntNamlen(dirent *syscall.Dirent) uint64 { - const fixedHdr = uint16(unsafe.Offsetof(syscall.Dirent{}.Name)) - nameBuf := (*[unsafe.Sizeof(dirent.Name)]byte)(unsafe.Pointer(&dirent.Name[0])) - const nameBufLen = uint16(len(nameBuf)) - limit := dirent.Reclen - fixedHdr - if limit > nameBufLen { - limit = nameBufLen - } - nameLen := bytes.IndexByte(nameBuf[:limit], 0) - if nameLen < 0 { - panic("failed to find terminating 0 byte in dirent") - } - return uint64(nameLen) -} diff --git a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_portable.go b/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_portable.go deleted file mode 100644 index 085d311600..0000000000 --- a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_portable.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build appengine || (!linux && !darwin && !freebsd && !openbsd && !netbsd) -// +build appengine !linux,!darwin,!freebsd,!openbsd,!netbsd - -package fastwalk - -import ( - "io/ioutil" - "os" -) - -// readDir calls fn for each directory entry in dirName. -// It does not descend into directories or follow symlinks. -// If fn returns a non-nil error, readDir returns with that error -// immediately. -func readDir(dirName string, fn func(dirName, entName string, typ os.FileMode) error) error { - fis, err := ioutil.ReadDir(dirName) - if err != nil { - return err - } - skipFiles := false - for _, fi := range fis { - if fi.Mode().IsRegular() && skipFiles { - continue - } - if err := fn(dirName, fi.Name(), fi.Mode()&os.ModeType); err != nil { - if err == ErrSkipFiles { - skipFiles = true - continue - } - return err - } - } - return nil -} diff --git a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_unix.go b/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_unix.go deleted file mode 100644 index f12f1a734c..0000000000 --- a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_unix.go +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build (linux || freebsd || openbsd || netbsd || (darwin && !cgo)) && !appengine -// +build linux freebsd openbsd netbsd darwin,!cgo -// +build !appengine - -package fastwalk - -import ( - "fmt" - "os" - "syscall" - "unsafe" -) - -const blockSize = 8 << 10 - -// unknownFileMode is a sentinel (and bogus) os.FileMode -// value used to represent a syscall.DT_UNKNOWN Dirent.Type. -const unknownFileMode os.FileMode = os.ModeNamedPipe | os.ModeSocket | os.ModeDevice - -func readDir(dirName string, fn func(dirName, entName string, typ os.FileMode) error) error { - fd, err := open(dirName, 0, 0) - if err != nil { - return &os.PathError{Op: "open", Path: dirName, Err: err} - } - defer syscall.Close(fd) - - // The buffer must be at least a block long. - buf := make([]byte, blockSize) // stack-allocated; doesn't escape - bufp := 0 // starting read position in buf - nbuf := 0 // end valid data in buf - skipFiles := false - for { - if bufp >= nbuf { - bufp = 0 - nbuf, err = readDirent(fd, buf) - if err != nil { - return os.NewSyscallError("readdirent", err) - } - if nbuf <= 0 { - return nil - } - } - consumed, name, typ := parseDirEnt(buf[bufp:nbuf]) - bufp += consumed - if name == "" || name == "." || name == ".." { - continue - } - // Fallback for filesystems (like old XFS) that don't - // support Dirent.Type and have DT_UNKNOWN (0) there - // instead. - if typ == unknownFileMode { - fi, err := os.Lstat(dirName + "/" + name) - if err != nil { - // It got deleted in the meantime. - if os.IsNotExist(err) { - continue - } - return err - } - typ = fi.Mode() & os.ModeType - } - if skipFiles && typ.IsRegular() { - continue - } - if err := fn(dirName, name, typ); err != nil { - if err == ErrSkipFiles { - skipFiles = true - continue - } - return err - } - } -} - -func parseDirEnt(buf []byte) (consumed int, name string, typ os.FileMode) { - // golang.org/issue/37269 - dirent := &syscall.Dirent{} - copy((*[unsafe.Sizeof(syscall.Dirent{})]byte)(unsafe.Pointer(dirent))[:], buf) - if v := unsafe.Offsetof(dirent.Reclen) + unsafe.Sizeof(dirent.Reclen); uintptr(len(buf)) < v { - panic(fmt.Sprintf("buf size of %d smaller than dirent header size %d", len(buf), v)) - } - if len(buf) < int(dirent.Reclen) { - panic(fmt.Sprintf("buf size %d < record length %d", len(buf), dirent.Reclen)) - } - consumed = int(dirent.Reclen) - if direntInode(dirent) == 0 { // File absent in directory. - return - } - switch dirent.Type { - case syscall.DT_REG: - typ = 0 - case syscall.DT_DIR: - typ = os.ModeDir - case syscall.DT_LNK: - typ = os.ModeSymlink - case syscall.DT_BLK: - typ = os.ModeDevice - case syscall.DT_FIFO: - typ = os.ModeNamedPipe - case syscall.DT_SOCK: - typ = os.ModeSocket - case syscall.DT_UNKNOWN: - typ = unknownFileMode - default: - // Skip weird things. - // It's probably a DT_WHT (http://lwn.net/Articles/325369/) - // or something. Revisit if/when this package is moved outside - // of goimports. goimports only cares about regular files, - // symlinks, and directories. - return - } - - nameBuf := (*[unsafe.Sizeof(dirent.Name)]byte)(unsafe.Pointer(&dirent.Name[0])) - nameLen := direntNamlen(dirent) - - // Special cases for common things: - if nameLen == 1 && nameBuf[0] == '.' { - name = "." - } else if nameLen == 2 && nameBuf[0] == '.' && nameBuf[1] == '.' { - name = ".." - } else { - name = string(nameBuf[:nameLen]) - } - return -} - -// According to https://golang.org/doc/go1.14#runtime -// A consequence of the implementation of preemption is that on Unix systems, including Linux and macOS -// systems, programs built with Go 1.14 will receive more signals than programs built with earlier releases. -// -// This causes syscall.Open and syscall.ReadDirent sometimes fail with EINTR errors. -// We need to retry in this case. -func open(path string, mode int, perm uint32) (fd int, err error) { - for { - fd, err := syscall.Open(path, mode, perm) - if err != syscall.EINTR { - return fd, err - } - } -} - -func readDirent(fd int, buf []byte) (n int, err error) { - for { - nbuf, err := syscall.ReadDirent(fd, buf) - if err != syscall.EINTR { - return nbuf, err - } - } -} diff --git a/vendor/golang.org/x/tools/internal/gopathwalk/walk.go b/vendor/golang.org/x/tools/internal/gopathwalk/walk.go deleted file mode 100644 index 452e342c55..0000000000 --- a/vendor/golang.org/x/tools/internal/gopathwalk/walk.go +++ /dev/null @@ -1,260 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package gopathwalk is like filepath.Walk but specialized for finding Go -// packages, particularly in $GOPATH and $GOROOT. -package gopathwalk - -import ( - "bufio" - "bytes" - "log" - "os" - "path/filepath" - "strings" - "time" - - "golang.org/x/tools/internal/fastwalk" -) - -// Options controls the behavior of a Walk call. -type Options struct { - // If Logf is non-nil, debug logging is enabled through this function. - Logf func(format string, args ...interface{}) - // Search module caches. Also disables legacy goimports ignore rules. - ModulesEnabled bool -} - -// RootType indicates the type of a Root. -type RootType int - -const ( - RootUnknown RootType = iota - RootGOROOT - RootGOPATH - RootCurrentModule - RootModuleCache - RootOther -) - -// A Root is a starting point for a Walk. -type Root struct { - Path string - Type RootType -} - -// Walk walks Go source directories ($GOROOT, $GOPATH, etc) to find packages. -// For each package found, add will be called (concurrently) with the absolute -// paths of the containing source directory and the package directory. -// add will be called concurrently. -func Walk(roots []Root, add func(root Root, dir string), opts Options) { - WalkSkip(roots, add, func(Root, string) bool { return false }, opts) -} - -// WalkSkip walks Go source directories ($GOROOT, $GOPATH, etc) to find packages. -// For each package found, add will be called (concurrently) with the absolute -// paths of the containing source directory and the package directory. -// For each directory that will be scanned, skip will be called (concurrently) -// with the absolute paths of the containing source directory and the directory. -// If skip returns false on a directory it will be processed. -// add will be called concurrently. -// skip will be called concurrently. -func WalkSkip(roots []Root, add func(root Root, dir string), skip func(root Root, dir string) bool, opts Options) { - for _, root := range roots { - walkDir(root, add, skip, opts) - } -} - -// walkDir creates a walker and starts fastwalk with this walker. -func walkDir(root Root, add func(Root, string), skip func(root Root, dir string) bool, opts Options) { - if _, err := os.Stat(root.Path); os.IsNotExist(err) { - if opts.Logf != nil { - opts.Logf("skipping nonexistent directory: %v", root.Path) - } - return - } - start := time.Now() - if opts.Logf != nil { - opts.Logf("scanning %s", root.Path) - } - w := &walker{ - root: root, - add: add, - skip: skip, - opts: opts, - } - w.init() - if err := fastwalk.Walk(root.Path, w.walk); err != nil { - logf := opts.Logf - if logf == nil { - logf = log.Printf - } - logf("scanning directory %v: %v", root.Path, err) - } - - if opts.Logf != nil { - opts.Logf("scanned %s in %v", root.Path, time.Since(start)) - } -} - -// walker is the callback for fastwalk.Walk. -type walker struct { - root Root // The source directory to scan. - add func(Root, string) // The callback that will be invoked for every possible Go package dir. - skip func(Root, string) bool // The callback that will be invoked for every dir. dir is skipped if it returns true. - opts Options // Options passed to Walk by the user. - - ignoredDirs []os.FileInfo // The ignored directories, loaded from .goimportsignore files. -} - -// init initializes the walker based on its Options -func (w *walker) init() { - var ignoredPaths []string - if w.root.Type == RootModuleCache { - ignoredPaths = []string{"cache"} - } - if !w.opts.ModulesEnabled && w.root.Type == RootGOPATH { - ignoredPaths = w.getIgnoredDirs(w.root.Path) - ignoredPaths = append(ignoredPaths, "v", "mod") - } - - for _, p := range ignoredPaths { - full := filepath.Join(w.root.Path, p) - if fi, err := os.Stat(full); err == nil { - w.ignoredDirs = append(w.ignoredDirs, fi) - if w.opts.Logf != nil { - w.opts.Logf("Directory added to ignore list: %s", full) - } - } else if w.opts.Logf != nil { - w.opts.Logf("Error statting ignored directory: %v", err) - } - } -} - -// getIgnoredDirs reads an optional config file at /.goimportsignore -// of relative directories to ignore when scanning for go files. -// The provided path is one of the $GOPATH entries with "src" appended. -func (w *walker) getIgnoredDirs(path string) []string { - file := filepath.Join(path, ".goimportsignore") - slurp, err := os.ReadFile(file) - if w.opts.Logf != nil { - if err != nil { - w.opts.Logf("%v", err) - } else { - w.opts.Logf("Read %s", file) - } - } - if err != nil { - return nil - } - - var ignoredDirs []string - bs := bufio.NewScanner(bytes.NewReader(slurp)) - for bs.Scan() { - line := strings.TrimSpace(bs.Text()) - if line == "" || strings.HasPrefix(line, "#") { - continue - } - ignoredDirs = append(ignoredDirs, line) - } - return ignoredDirs -} - -// shouldSkipDir reports whether the file should be skipped or not. -func (w *walker) shouldSkipDir(fi os.FileInfo, dir string) bool { - for _, ignoredDir := range w.ignoredDirs { - if os.SameFile(fi, ignoredDir) { - return true - } - } - if w.skip != nil { - // Check with the user specified callback. - return w.skip(w.root, dir) - } - return false -} - -// walk walks through the given path. -func (w *walker) walk(path string, typ os.FileMode) error { - if typ.IsRegular() { - dir := filepath.Dir(path) - if dir == w.root.Path && (w.root.Type == RootGOROOT || w.root.Type == RootGOPATH) { - // Doesn't make sense to have regular files - // directly in your $GOPATH/src or $GOROOT/src. - return fastwalk.ErrSkipFiles - } - if !strings.HasSuffix(path, ".go") { - return nil - } - - w.add(w.root, dir) - return fastwalk.ErrSkipFiles - } - if typ == os.ModeDir { - base := filepath.Base(path) - if base == "" || base[0] == '.' || base[0] == '_' || - base == "testdata" || - (w.root.Type == RootGOROOT && w.opts.ModulesEnabled && base == "vendor") || - (!w.opts.ModulesEnabled && base == "node_modules") { - return filepath.SkipDir - } - fi, err := os.Lstat(path) - if err == nil && w.shouldSkipDir(fi, path) { - return filepath.SkipDir - } - return nil - } - if typ == os.ModeSymlink { - base := filepath.Base(path) - if strings.HasPrefix(base, ".#") { - // Emacs noise. - return nil - } - if w.shouldTraverse(path) { - return fastwalk.ErrTraverseLink - } - } - return nil -} - -// shouldTraverse reports whether the symlink fi, found in dir, -// should be followed. It makes sure symlinks were never visited -// before to avoid symlink loops. -func (w *walker) shouldTraverse(path string) bool { - ts, err := os.Stat(path) - if err != nil { - logf := w.opts.Logf - if logf == nil { - logf = log.Printf - } - logf("%v", err) - return false - } - if !ts.IsDir() { - return false - } - if w.shouldSkipDir(ts, filepath.Dir(path)) { - return false - } - // Check for symlink loops by statting each directory component - // and seeing if any are the same file as ts. - for { - parent := filepath.Dir(path) - if parent == path { - // Made it to the root without seeing a cycle. - // Use this symlink. - return true - } - parentInfo, err := os.Stat(parent) - if err != nil { - return false - } - if os.SameFile(ts, parentInfo) { - // Cycle. Don't traverse. - return false - } - path = parent - } - -} diff --git a/vendor/golang.org/x/tools/internal/imports/fix.go b/vendor/golang.org/x/tools/internal/imports/fix.go deleted file mode 100644 index d4f1b4e8a0..0000000000 --- a/vendor/golang.org/x/tools/internal/imports/fix.go +++ /dev/null @@ -1,1766 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package imports - -import ( - "bytes" - "context" - "encoding/json" - "fmt" - "go/ast" - "go/build" - "go/parser" - "go/token" - "io/ioutil" - "os" - "path" - "path/filepath" - "reflect" - "sort" - "strconv" - "strings" - "sync" - "unicode" - "unicode/utf8" - - "golang.org/x/tools/go/ast/astutil" - "golang.org/x/tools/internal/event" - "golang.org/x/tools/internal/gocommand" - "golang.org/x/tools/internal/gopathwalk" -) - -// importToGroup is a list of functions which map from an import path to -// a group number. -var importToGroup = []func(localPrefix, importPath string) (num int, ok bool){ - func(localPrefix, importPath string) (num int, ok bool) { - if localPrefix == "" { - return - } - for _, p := range strings.Split(localPrefix, ",") { - if strings.HasPrefix(importPath, p) || strings.TrimSuffix(p, "/") == importPath { - return 3, true - } - } - return - }, - func(_, importPath string) (num int, ok bool) { - if strings.HasPrefix(importPath, "appengine") { - return 2, true - } - return - }, - func(_, importPath string) (num int, ok bool) { - firstComponent := strings.Split(importPath, "/")[0] - if strings.Contains(firstComponent, ".") { - return 1, true - } - return - }, -} - -func importGroup(localPrefix, importPath string) int { - for _, fn := range importToGroup { - if n, ok := fn(localPrefix, importPath); ok { - return n - } - } - return 0 -} - -type ImportFixType int - -const ( - AddImport ImportFixType = iota - DeleteImport - SetImportName -) - -type ImportFix struct { - // StmtInfo represents the import statement this fix will add, remove, or change. - StmtInfo ImportInfo - // IdentName is the identifier that this fix will add or remove. - IdentName string - // FixType is the type of fix this is (AddImport, DeleteImport, SetImportName). - FixType ImportFixType - Relevance float64 // see pkg -} - -// An ImportInfo represents a single import statement. -type ImportInfo struct { - ImportPath string // import path, e.g. "crypto/rand". - Name string // import name, e.g. "crand", or "" if none. -} - -// A packageInfo represents what's known about a package. -type packageInfo struct { - name string // real package name, if known. - exports map[string]bool // known exports. -} - -// parseOtherFiles parses all the Go files in srcDir except filename, including -// test files if filename looks like a test. -func parseOtherFiles(fset *token.FileSet, srcDir, filename string) []*ast.File { - // This could use go/packages but it doesn't buy much, and it fails - // with https://golang.org/issue/26296 in LoadFiles mode in some cases. - considerTests := strings.HasSuffix(filename, "_test.go") - - fileBase := filepath.Base(filename) - packageFileInfos, err := ioutil.ReadDir(srcDir) - if err != nil { - return nil - } - - var files []*ast.File - for _, fi := range packageFileInfos { - if fi.Name() == fileBase || !strings.HasSuffix(fi.Name(), ".go") { - continue - } - if !considerTests && strings.HasSuffix(fi.Name(), "_test.go") { - continue - } - - f, err := parser.ParseFile(fset, filepath.Join(srcDir, fi.Name()), nil, 0) - if err != nil { - continue - } - - files = append(files, f) - } - - return files -} - -// addGlobals puts the names of package vars into the provided map. -func addGlobals(f *ast.File, globals map[string]bool) { - for _, decl := range f.Decls { - genDecl, ok := decl.(*ast.GenDecl) - if !ok { - continue - } - - for _, spec := range genDecl.Specs { - valueSpec, ok := spec.(*ast.ValueSpec) - if !ok { - continue - } - globals[valueSpec.Names[0].Name] = true - } - } -} - -// collectReferences builds a map of selector expressions, from -// left hand side (X) to a set of right hand sides (Sel). -func collectReferences(f *ast.File) references { - refs := references{} - - var visitor visitFn - visitor = func(node ast.Node) ast.Visitor { - if node == nil { - return visitor - } - switch v := node.(type) { - case *ast.SelectorExpr: - xident, ok := v.X.(*ast.Ident) - if !ok { - break - } - if xident.Obj != nil { - // If the parser can resolve it, it's not a package ref. - break - } - if !ast.IsExported(v.Sel.Name) { - // Whatever this is, it's not exported from a package. - break - } - pkgName := xident.Name - r := refs[pkgName] - if r == nil { - r = make(map[string]bool) - refs[pkgName] = r - } - r[v.Sel.Name] = true - } - return visitor - } - ast.Walk(visitor, f) - return refs -} - -// collectImports returns all the imports in f. -// Unnamed imports (., _) and "C" are ignored. -func collectImports(f *ast.File) []*ImportInfo { - var imports []*ImportInfo - for _, imp := range f.Imports { - var name string - if imp.Name != nil { - name = imp.Name.Name - } - if imp.Path.Value == `"C"` || name == "_" || name == "." { - continue - } - path := strings.Trim(imp.Path.Value, `"`) - imports = append(imports, &ImportInfo{ - Name: name, - ImportPath: path, - }) - } - return imports -} - -// findMissingImport searches pass's candidates for an import that provides -// pkg, containing all of syms. -func (p *pass) findMissingImport(pkg string, syms map[string]bool) *ImportInfo { - for _, candidate := range p.candidates { - pkgInfo, ok := p.knownPackages[candidate.ImportPath] - if !ok { - continue - } - if p.importIdentifier(candidate) != pkg { - continue - } - - allFound := true - for right := range syms { - if !pkgInfo.exports[right] { - allFound = false - break - } - } - - if allFound { - return candidate - } - } - return nil -} - -// references is set of references found in a Go file. The first map key is the -// left hand side of a selector expression, the second key is the right hand -// side, and the value should always be true. -type references map[string]map[string]bool - -// A pass contains all the inputs and state necessary to fix a file's imports. -// It can be modified in some ways during use; see comments below. -type pass struct { - // Inputs. These must be set before a call to load, and not modified after. - fset *token.FileSet // fset used to parse f and its siblings. - f *ast.File // the file being fixed. - srcDir string // the directory containing f. - env *ProcessEnv // the environment to use for go commands, etc. - loadRealPackageNames bool // if true, load package names from disk rather than guessing them. - otherFiles []*ast.File // sibling files. - - // Intermediate state, generated by load. - existingImports map[string]*ImportInfo - allRefs references - missingRefs references - - // Inputs to fix. These can be augmented between successive fix calls. - lastTry bool // indicates that this is the last call and fix should clean up as best it can. - candidates []*ImportInfo // candidate imports in priority order. - knownPackages map[string]*packageInfo // information about all known packages. -} - -// loadPackageNames saves the package names for everything referenced by imports. -func (p *pass) loadPackageNames(imports []*ImportInfo) error { - if p.env.Logf != nil { - p.env.Logf("loading package names for %v packages", len(imports)) - defer func() { - p.env.Logf("done loading package names for %v packages", len(imports)) - }() - } - var unknown []string - for _, imp := range imports { - if _, ok := p.knownPackages[imp.ImportPath]; ok { - continue - } - unknown = append(unknown, imp.ImportPath) - } - - resolver, err := p.env.GetResolver() - if err != nil { - return err - } - - names, err := resolver.loadPackageNames(unknown, p.srcDir) - if err != nil { - return err - } - - for path, name := range names { - p.knownPackages[path] = &packageInfo{ - name: name, - exports: map[string]bool{}, - } - } - return nil -} - -// importIdentifier returns the identifier that imp will introduce. It will -// guess if the package name has not been loaded, e.g. because the source -// is not available. -func (p *pass) importIdentifier(imp *ImportInfo) string { - if imp.Name != "" { - return imp.Name - } - known := p.knownPackages[imp.ImportPath] - if known != nil && known.name != "" { - return known.name - } - return ImportPathToAssumedName(imp.ImportPath) -} - -// load reads in everything necessary to run a pass, and reports whether the -// file already has all the imports it needs. It fills in p.missingRefs with the -// file's missing symbols, if any, or removes unused imports if not. -func (p *pass) load() ([]*ImportFix, bool) { - p.knownPackages = map[string]*packageInfo{} - p.missingRefs = references{} - p.existingImports = map[string]*ImportInfo{} - - // Load basic information about the file in question. - p.allRefs = collectReferences(p.f) - - // Load stuff from other files in the same package: - // global variables so we know they don't need resolving, and imports - // that we might want to mimic. - globals := map[string]bool{} - for _, otherFile := range p.otherFiles { - // Don't load globals from files that are in the same directory - // but a different package. Using them to suggest imports is OK. - if p.f.Name.Name == otherFile.Name.Name { - addGlobals(otherFile, globals) - } - p.candidates = append(p.candidates, collectImports(otherFile)...) - } - - // Resolve all the import paths we've seen to package names, and store - // f's imports by the identifier they introduce. - imports := collectImports(p.f) - if p.loadRealPackageNames { - err := p.loadPackageNames(append(imports, p.candidates...)) - if err != nil { - if p.env.Logf != nil { - p.env.Logf("loading package names: %v", err) - } - return nil, false - } - } - for _, imp := range imports { - p.existingImports[p.importIdentifier(imp)] = imp - } - - // Find missing references. - for left, rights := range p.allRefs { - if globals[left] { - continue - } - _, ok := p.existingImports[left] - if !ok { - p.missingRefs[left] = rights - continue - } - } - if len(p.missingRefs) != 0 { - return nil, false - } - - return p.fix() -} - -// fix attempts to satisfy missing imports using p.candidates. If it finds -// everything, or if p.lastTry is true, it updates fixes to add the imports it found, -// delete anything unused, and update import names, and returns true. -func (p *pass) fix() ([]*ImportFix, bool) { - // Find missing imports. - var selected []*ImportInfo - for left, rights := range p.missingRefs { - if imp := p.findMissingImport(left, rights); imp != nil { - selected = append(selected, imp) - } - } - - if !p.lastTry && len(selected) != len(p.missingRefs) { - return nil, false - } - - // Found everything, or giving up. Add the new imports and remove any unused. - var fixes []*ImportFix - for _, imp := range p.existingImports { - // We deliberately ignore globals here, because we can't be sure - // they're in the same package. People do things like put multiple - // main packages in the same directory, and we don't want to - // remove imports if they happen to have the same name as a var in - // a different package. - if _, ok := p.allRefs[p.importIdentifier(imp)]; !ok { - fixes = append(fixes, &ImportFix{ - StmtInfo: *imp, - IdentName: p.importIdentifier(imp), - FixType: DeleteImport, - }) - continue - } - - // An existing import may need to update its import name to be correct. - if name := p.importSpecName(imp); name != imp.Name { - fixes = append(fixes, &ImportFix{ - StmtInfo: ImportInfo{ - Name: name, - ImportPath: imp.ImportPath, - }, - IdentName: p.importIdentifier(imp), - FixType: SetImportName, - }) - } - } - // Collecting fixes involved map iteration, so sort for stability. See - // golang/go#59976. - sortFixes(fixes) - - // collect selected fixes in a separate slice, so that it can be sorted - // separately. Note that these fixes must occur after fixes to existing - // imports. TODO(rfindley): figure out why. - var selectedFixes []*ImportFix - for _, imp := range selected { - selectedFixes = append(selectedFixes, &ImportFix{ - StmtInfo: ImportInfo{ - Name: p.importSpecName(imp), - ImportPath: imp.ImportPath, - }, - IdentName: p.importIdentifier(imp), - FixType: AddImport, - }) - } - sortFixes(selectedFixes) - - return append(fixes, selectedFixes...), true -} - -func sortFixes(fixes []*ImportFix) { - sort.Slice(fixes, func(i, j int) bool { - fi, fj := fixes[i], fixes[j] - if fi.StmtInfo.ImportPath != fj.StmtInfo.ImportPath { - return fi.StmtInfo.ImportPath < fj.StmtInfo.ImportPath - } - if fi.StmtInfo.Name != fj.StmtInfo.Name { - return fi.StmtInfo.Name < fj.StmtInfo.Name - } - if fi.IdentName != fj.IdentName { - return fi.IdentName < fj.IdentName - } - return fi.FixType < fj.FixType - }) -} - -// importSpecName gets the import name of imp in the import spec. -// -// When the import identifier matches the assumed import name, the import name does -// not appear in the import spec. -func (p *pass) importSpecName(imp *ImportInfo) string { - // If we did not load the real package names, or the name is already set, - // we just return the existing name. - if !p.loadRealPackageNames || imp.Name != "" { - return imp.Name - } - - ident := p.importIdentifier(imp) - if ident == ImportPathToAssumedName(imp.ImportPath) { - return "" // ident not needed since the assumed and real names are the same. - } - return ident -} - -// apply will perform the fixes on f in order. -func apply(fset *token.FileSet, f *ast.File, fixes []*ImportFix) { - for _, fix := range fixes { - switch fix.FixType { - case DeleteImport: - astutil.DeleteNamedImport(fset, f, fix.StmtInfo.Name, fix.StmtInfo.ImportPath) - case AddImport: - astutil.AddNamedImport(fset, f, fix.StmtInfo.Name, fix.StmtInfo.ImportPath) - case SetImportName: - // Find the matching import path and change the name. - for _, spec := range f.Imports { - path := strings.Trim(spec.Path.Value, `"`) - if path == fix.StmtInfo.ImportPath { - spec.Name = &ast.Ident{ - Name: fix.StmtInfo.Name, - NamePos: spec.Pos(), - } - } - } - } - } -} - -// assumeSiblingImportsValid assumes that siblings' use of packages is valid, -// adding the exports they use. -func (p *pass) assumeSiblingImportsValid() { - for _, f := range p.otherFiles { - refs := collectReferences(f) - imports := collectImports(f) - importsByName := map[string]*ImportInfo{} - for _, imp := range imports { - importsByName[p.importIdentifier(imp)] = imp - } - for left, rights := range refs { - if imp, ok := importsByName[left]; ok { - if m, ok := stdlib[imp.ImportPath]; ok { - // We have the stdlib in memory; no need to guess. - rights = copyExports(m) - } - p.addCandidate(imp, &packageInfo{ - // no name; we already know it. - exports: rights, - }) - } - } - } -} - -// addCandidate adds a candidate import to p, and merges in the information -// in pkg. -func (p *pass) addCandidate(imp *ImportInfo, pkg *packageInfo) { - p.candidates = append(p.candidates, imp) - if existing, ok := p.knownPackages[imp.ImportPath]; ok { - if existing.name == "" { - existing.name = pkg.name - } - for export := range pkg.exports { - existing.exports[export] = true - } - } else { - p.knownPackages[imp.ImportPath] = pkg - } -} - -// fixImports adds and removes imports from f so that all its references are -// satisfied and there are no unused imports. -// -// This is declared as a variable rather than a function so goimports can -// easily be extended by adding a file with an init function. -var fixImports = fixImportsDefault - -func fixImportsDefault(fset *token.FileSet, f *ast.File, filename string, env *ProcessEnv) error { - fixes, err := getFixes(context.Background(), fset, f, filename, env) - if err != nil { - return err - } - apply(fset, f, fixes) - return err -} - -// getFixes gets the import fixes that need to be made to f in order to fix the imports. -// It does not modify the ast. -func getFixes(ctx context.Context, fset *token.FileSet, f *ast.File, filename string, env *ProcessEnv) ([]*ImportFix, error) { - abs, err := filepath.Abs(filename) - if err != nil { - return nil, err - } - srcDir := filepath.Dir(abs) - if env.Logf != nil { - env.Logf("fixImports(filename=%q), abs=%q, srcDir=%q ...", filename, abs, srcDir) - } - - // First pass: looking only at f, and using the naive algorithm to - // derive package names from import paths, see if the file is already - // complete. We can't add any imports yet, because we don't know - // if missing references are actually package vars. - p := &pass{fset: fset, f: f, srcDir: srcDir, env: env} - if fixes, done := p.load(); done { - return fixes, nil - } - - otherFiles := parseOtherFiles(fset, srcDir, filename) - - // Second pass: add information from other files in the same package, - // like their package vars and imports. - p.otherFiles = otherFiles - if fixes, done := p.load(); done { - return fixes, nil - } - - // Now we can try adding imports from the stdlib. - p.assumeSiblingImportsValid() - addStdlibCandidates(p, p.missingRefs) - if fixes, done := p.fix(); done { - return fixes, nil - } - - // Third pass: get real package names where we had previously used - // the naive algorithm. - p = &pass{fset: fset, f: f, srcDir: srcDir, env: env} - p.loadRealPackageNames = true - p.otherFiles = otherFiles - if fixes, done := p.load(); done { - return fixes, nil - } - - if err := addStdlibCandidates(p, p.missingRefs); err != nil { - return nil, err - } - p.assumeSiblingImportsValid() - if fixes, done := p.fix(); done { - return fixes, nil - } - - // Go look for candidates in $GOPATH, etc. We don't necessarily load - // the real exports of sibling imports, so keep assuming their contents. - if err := addExternalCandidates(ctx, p, p.missingRefs, filename); err != nil { - return nil, err - } - - p.lastTry = true - fixes, _ := p.fix() - return fixes, nil -} - -// MaxRelevance is the highest relevance, used for the standard library. -// Chosen arbitrarily to match pre-existing gopls code. -const MaxRelevance = 7.0 - -// getCandidatePkgs works with the passed callback to find all acceptable packages. -// It deduplicates by import path, and uses a cached stdlib rather than reading -// from disk. -func getCandidatePkgs(ctx context.Context, wrappedCallback *scanCallback, filename, filePkg string, env *ProcessEnv) error { - notSelf := func(p *pkg) bool { - return p.packageName != filePkg || p.dir != filepath.Dir(filename) - } - goenv, err := env.goEnv() - if err != nil { - return err - } - - var mu sync.Mutex // to guard asynchronous access to dupCheck - dupCheck := map[string]struct{}{} - - // Start off with the standard library. - for importPath, exports := range stdlib { - p := &pkg{ - dir: filepath.Join(goenv["GOROOT"], "src", importPath), - importPathShort: importPath, - packageName: path.Base(importPath), - relevance: MaxRelevance, - } - dupCheck[importPath] = struct{}{} - if notSelf(p) && wrappedCallback.dirFound(p) && wrappedCallback.packageNameLoaded(p) { - wrappedCallback.exportsLoaded(p, exports) - } - } - - scanFilter := &scanCallback{ - rootFound: func(root gopathwalk.Root) bool { - // Exclude goroot results -- getting them is relatively expensive, not cached, - // and generally redundant with the in-memory version. - return root.Type != gopathwalk.RootGOROOT && wrappedCallback.rootFound(root) - }, - dirFound: wrappedCallback.dirFound, - packageNameLoaded: func(pkg *pkg) bool { - mu.Lock() - defer mu.Unlock() - if _, ok := dupCheck[pkg.importPathShort]; ok { - return false - } - dupCheck[pkg.importPathShort] = struct{}{} - return notSelf(pkg) && wrappedCallback.packageNameLoaded(pkg) - }, - exportsLoaded: func(pkg *pkg, exports []string) { - // If we're an x_test, load the package under test's test variant. - if strings.HasSuffix(filePkg, "_test") && pkg.dir == filepath.Dir(filename) { - var err error - _, exports, err = loadExportsFromFiles(ctx, env, pkg.dir, true) - if err != nil { - return - } - } - wrappedCallback.exportsLoaded(pkg, exports) - }, - } - resolver, err := env.GetResolver() - if err != nil { - return err - } - return resolver.scan(ctx, scanFilter) -} - -func ScoreImportPaths(ctx context.Context, env *ProcessEnv, paths []string) (map[string]float64, error) { - result := make(map[string]float64) - resolver, err := env.GetResolver() - if err != nil { - return nil, err - } - for _, path := range paths { - result[path] = resolver.scoreImportPath(ctx, path) - } - return result, nil -} - -func PrimeCache(ctx context.Context, env *ProcessEnv) error { - // Fully scan the disk for directories, but don't actually read any Go files. - callback := &scanCallback{ - rootFound: func(gopathwalk.Root) bool { - return true - }, - dirFound: func(pkg *pkg) bool { - return false - }, - packageNameLoaded: func(pkg *pkg) bool { - return false - }, - } - return getCandidatePkgs(ctx, callback, "", "", env) -} - -func candidateImportName(pkg *pkg) string { - if ImportPathToAssumedName(pkg.importPathShort) != pkg.packageName { - return pkg.packageName - } - return "" -} - -// GetAllCandidates calls wrapped for each package whose name starts with -// searchPrefix, and can be imported from filename with the package name filePkg. -// -// Beware that the wrapped function may be called multiple times concurrently. -// TODO(adonovan): encapsulate the concurrency. -func GetAllCandidates(ctx context.Context, wrapped func(ImportFix), searchPrefix, filename, filePkg string, env *ProcessEnv) error { - callback := &scanCallback{ - rootFound: func(gopathwalk.Root) bool { - return true - }, - dirFound: func(pkg *pkg) bool { - if !canUse(filename, pkg.dir) { - return false - } - // Try the assumed package name first, then a simpler path match - // in case of packages named vN, which are not uncommon. - return strings.HasPrefix(ImportPathToAssumedName(pkg.importPathShort), searchPrefix) || - strings.HasPrefix(path.Base(pkg.importPathShort), searchPrefix) - }, - packageNameLoaded: func(pkg *pkg) bool { - if !strings.HasPrefix(pkg.packageName, searchPrefix) { - return false - } - wrapped(ImportFix{ - StmtInfo: ImportInfo{ - ImportPath: pkg.importPathShort, - Name: candidateImportName(pkg), - }, - IdentName: pkg.packageName, - FixType: AddImport, - Relevance: pkg.relevance, - }) - return false - }, - } - return getCandidatePkgs(ctx, callback, filename, filePkg, env) -} - -// GetImportPaths calls wrapped for each package whose import path starts with -// searchPrefix, and can be imported from filename with the package name filePkg. -func GetImportPaths(ctx context.Context, wrapped func(ImportFix), searchPrefix, filename, filePkg string, env *ProcessEnv) error { - callback := &scanCallback{ - rootFound: func(gopathwalk.Root) bool { - return true - }, - dirFound: func(pkg *pkg) bool { - if !canUse(filename, pkg.dir) { - return false - } - return strings.HasPrefix(pkg.importPathShort, searchPrefix) - }, - packageNameLoaded: func(pkg *pkg) bool { - wrapped(ImportFix{ - StmtInfo: ImportInfo{ - ImportPath: pkg.importPathShort, - Name: candidateImportName(pkg), - }, - IdentName: pkg.packageName, - FixType: AddImport, - Relevance: pkg.relevance, - }) - return false - }, - } - return getCandidatePkgs(ctx, callback, filename, filePkg, env) -} - -// A PackageExport is a package and its exports. -type PackageExport struct { - Fix *ImportFix - Exports []string -} - -// GetPackageExports returns all known packages with name pkg and their exports. -func GetPackageExports(ctx context.Context, wrapped func(PackageExport), searchPkg, filename, filePkg string, env *ProcessEnv) error { - callback := &scanCallback{ - rootFound: func(gopathwalk.Root) bool { - return true - }, - dirFound: func(pkg *pkg) bool { - return pkgIsCandidate(filename, references{searchPkg: nil}, pkg) - }, - packageNameLoaded: func(pkg *pkg) bool { - return pkg.packageName == searchPkg - }, - exportsLoaded: func(pkg *pkg, exports []string) { - sort.Strings(exports) - wrapped(PackageExport{ - Fix: &ImportFix{ - StmtInfo: ImportInfo{ - ImportPath: pkg.importPathShort, - Name: candidateImportName(pkg), - }, - IdentName: pkg.packageName, - FixType: AddImport, - Relevance: pkg.relevance, - }, - Exports: exports, - }) - }, - } - return getCandidatePkgs(ctx, callback, filename, filePkg, env) -} - -var requiredGoEnvVars = []string{"GO111MODULE", "GOFLAGS", "GOINSECURE", "GOMOD", "GOMODCACHE", "GONOPROXY", "GONOSUMDB", "GOPATH", "GOPROXY", "GOROOT", "GOSUMDB", "GOWORK"} - -// ProcessEnv contains environment variables and settings that affect the use of -// the go command, the go/build package, etc. -type ProcessEnv struct { - GocmdRunner *gocommand.Runner - - BuildFlags []string - ModFlag string - ModFile string - - // SkipPathInScan returns true if the path should be skipped from scans of - // the RootCurrentModule root type. The function argument is a clean, - // absolute path. - SkipPathInScan func(string) bool - - // Env overrides the OS environment, and can be used to specify - // GOPROXY, GO111MODULE, etc. PATH cannot be set here, because - // exec.Command will not honor it. - // Specifying all of RequiredGoEnvVars avoids a call to `go env`. - Env map[string]string - - WorkingDir string - - // If Logf is non-nil, debug logging is enabled through this function. - Logf func(format string, args ...interface{}) - - initialized bool - - resolver Resolver -} - -func (e *ProcessEnv) goEnv() (map[string]string, error) { - if err := e.init(); err != nil { - return nil, err - } - return e.Env, nil -} - -func (e *ProcessEnv) matchFile(dir, name string) (bool, error) { - bctx, err := e.buildContext() - if err != nil { - return false, err - } - return bctx.MatchFile(dir, name) -} - -// CopyConfig copies the env's configuration into a new env. -func (e *ProcessEnv) CopyConfig() *ProcessEnv { - copy := &ProcessEnv{ - GocmdRunner: e.GocmdRunner, - initialized: e.initialized, - BuildFlags: e.BuildFlags, - Logf: e.Logf, - WorkingDir: e.WorkingDir, - resolver: nil, - Env: map[string]string{}, - } - for k, v := range e.Env { - copy.Env[k] = v - } - return copy -} - -func (e *ProcessEnv) init() error { - if e.initialized { - return nil - } - - foundAllRequired := true - for _, k := range requiredGoEnvVars { - if _, ok := e.Env[k]; !ok { - foundAllRequired = false - break - } - } - if foundAllRequired { - e.initialized = true - return nil - } - - if e.Env == nil { - e.Env = map[string]string{} - } - - goEnv := map[string]string{} - stdout, err := e.invokeGo(context.TODO(), "env", append([]string{"-json"}, requiredGoEnvVars...)...) - if err != nil { - return err - } - if err := json.Unmarshal(stdout.Bytes(), &goEnv); err != nil { - return err - } - for k, v := range goEnv { - e.Env[k] = v - } - e.initialized = true - return nil -} - -func (e *ProcessEnv) env() []string { - var env []string // the gocommand package will prepend os.Environ. - for k, v := range e.Env { - env = append(env, k+"="+v) - } - return env -} - -func (e *ProcessEnv) GetResolver() (Resolver, error) { - if e.resolver != nil { - return e.resolver, nil - } - if err := e.init(); err != nil { - return nil, err - } - if len(e.Env["GOMOD"]) == 0 && len(e.Env["GOWORK"]) == 0 { - e.resolver = newGopathResolver(e) - return e.resolver, nil - } - e.resolver = newModuleResolver(e) - return e.resolver, nil -} - -func (e *ProcessEnv) buildContext() (*build.Context, error) { - ctx := build.Default - goenv, err := e.goEnv() - if err != nil { - return nil, err - } - ctx.GOROOT = goenv["GOROOT"] - ctx.GOPATH = goenv["GOPATH"] - - // As of Go 1.14, build.Context has a Dir field - // (see golang.org/issue/34860). - // Populate it only if present. - rc := reflect.ValueOf(&ctx).Elem() - dir := rc.FieldByName("Dir") - if dir.IsValid() && dir.Kind() == reflect.String { - dir.SetString(e.WorkingDir) - } - - // Since Go 1.11, go/build.Context.Import may invoke 'go list' depending on - // the value in GO111MODULE in the process's environment. We always want to - // run in GOPATH mode when calling Import, so we need to prevent this from - // happening. In Go 1.16, GO111MODULE defaults to "on", so this problem comes - // up more frequently. - // - // HACK: setting any of the Context I/O hooks prevents Import from invoking - // 'go list', regardless of GO111MODULE. This is undocumented, but it's - // unlikely to change before GOPATH support is removed. - ctx.ReadDir = ioutil.ReadDir - - return &ctx, nil -} - -func (e *ProcessEnv) invokeGo(ctx context.Context, verb string, args ...string) (*bytes.Buffer, error) { - inv := gocommand.Invocation{ - Verb: verb, - Args: args, - BuildFlags: e.BuildFlags, - Env: e.env(), - Logf: e.Logf, - WorkingDir: e.WorkingDir, - } - return e.GocmdRunner.Run(ctx, inv) -} - -func addStdlibCandidates(pass *pass, refs references) error { - goenv, err := pass.env.goEnv() - if err != nil { - return err - } - add := func(pkg string) { - // Prevent self-imports. - if path.Base(pkg) == pass.f.Name.Name && filepath.Join(goenv["GOROOT"], "src", pkg) == pass.srcDir { - return - } - exports := copyExports(stdlib[pkg]) - pass.addCandidate( - &ImportInfo{ImportPath: pkg}, - &packageInfo{name: path.Base(pkg), exports: exports}) - } - for left := range refs { - if left == "rand" { - // Make sure we try crypto/rand before math/rand. - add("crypto/rand") - add("math/rand") - continue - } - for importPath := range stdlib { - if path.Base(importPath) == left { - add(importPath) - } - } - } - return nil -} - -// A Resolver does the build-system-specific parts of goimports. -type Resolver interface { - // loadPackageNames loads the package names in importPaths. - loadPackageNames(importPaths []string, srcDir string) (map[string]string, error) - // scan works with callback to search for packages. See scanCallback for details. - scan(ctx context.Context, callback *scanCallback) error - // loadExports returns the set of exported symbols in the package at dir. - // loadExports may be called concurrently. - loadExports(ctx context.Context, pkg *pkg, includeTest bool) (string, []string, error) - // scoreImportPath returns the relevance for an import path. - scoreImportPath(ctx context.Context, path string) float64 - - ClearForNewScan() -} - -// A scanCallback controls a call to scan and receives its results. -// In general, minor errors will be silently discarded; a user should not -// expect to receive a full series of calls for everything. -type scanCallback struct { - // rootFound is called before scanning a new root dir. If it returns true, - // the root will be scanned. Returning false will not necessarily prevent - // directories from that root making it to dirFound. - rootFound func(gopathwalk.Root) bool - // dirFound is called when a directory is found that is possibly a Go package. - // pkg will be populated with everything except packageName. - // If it returns true, the package's name will be loaded. - dirFound func(pkg *pkg) bool - // packageNameLoaded is called when a package is found and its name is loaded. - // If it returns true, the package's exports will be loaded. - packageNameLoaded func(pkg *pkg) bool - // exportsLoaded is called when a package's exports have been loaded. - exportsLoaded func(pkg *pkg, exports []string) -} - -func addExternalCandidates(ctx context.Context, pass *pass, refs references, filename string) error { - ctx, done := event.Start(ctx, "imports.addExternalCandidates") - defer done() - - var mu sync.Mutex - found := make(map[string][]pkgDistance) - callback := &scanCallback{ - rootFound: func(gopathwalk.Root) bool { - return true // We want everything. - }, - dirFound: func(pkg *pkg) bool { - return pkgIsCandidate(filename, refs, pkg) - }, - packageNameLoaded: func(pkg *pkg) bool { - if _, want := refs[pkg.packageName]; !want { - return false - } - if pkg.dir == pass.srcDir && pass.f.Name.Name == pkg.packageName { - // The candidate is in the same directory and has the - // same package name. Don't try to import ourselves. - return false - } - if !canUse(filename, pkg.dir) { - return false - } - mu.Lock() - defer mu.Unlock() - found[pkg.packageName] = append(found[pkg.packageName], pkgDistance{pkg, distance(pass.srcDir, pkg.dir)}) - return false // We'll do our own loading after we sort. - }, - } - resolver, err := pass.env.GetResolver() - if err != nil { - return err - } - if err = resolver.scan(context.Background(), callback); err != nil { - return err - } - - // Search for imports matching potential package references. - type result struct { - imp *ImportInfo - pkg *packageInfo - } - results := make(chan result, len(refs)) - - ctx, cancel := context.WithCancel(context.TODO()) - var wg sync.WaitGroup - defer func() { - cancel() - wg.Wait() - }() - var ( - firstErr error - firstErrOnce sync.Once - ) - for pkgName, symbols := range refs { - wg.Add(1) - go func(pkgName string, symbols map[string]bool) { - defer wg.Done() - - found, err := findImport(ctx, pass, found[pkgName], pkgName, symbols, filename) - - if err != nil { - firstErrOnce.Do(func() { - firstErr = err - cancel() - }) - return - } - - if found == nil { - return // No matching package. - } - - imp := &ImportInfo{ - ImportPath: found.importPathShort, - } - - pkg := &packageInfo{ - name: pkgName, - exports: symbols, - } - results <- result{imp, pkg} - }(pkgName, symbols) - } - go func() { - wg.Wait() - close(results) - }() - - for result := range results { - pass.addCandidate(result.imp, result.pkg) - } - return firstErr -} - -// notIdentifier reports whether ch is an invalid identifier character. -func notIdentifier(ch rune) bool { - return !('a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || - '0' <= ch && ch <= '9' || - ch == '_' || - ch >= utf8.RuneSelf && (unicode.IsLetter(ch) || unicode.IsDigit(ch))) -} - -// ImportPathToAssumedName returns the assumed package name of an import path. -// It does this using only string parsing of the import path. -// It picks the last element of the path that does not look like a major -// version, and then picks the valid identifier off the start of that element. -// It is used to determine if a local rename should be added to an import for -// clarity. -// This function could be moved to a standard package and exported if we want -// for use in other tools. -func ImportPathToAssumedName(importPath string) string { - base := path.Base(importPath) - if strings.HasPrefix(base, "v") { - if _, err := strconv.Atoi(base[1:]); err == nil { - dir := path.Dir(importPath) - if dir != "." { - base = path.Base(dir) - } - } - } - base = strings.TrimPrefix(base, "go-") - if i := strings.IndexFunc(base, notIdentifier); i >= 0 { - base = base[:i] - } - return base -} - -// gopathResolver implements resolver for GOPATH workspaces. -type gopathResolver struct { - env *ProcessEnv - walked bool - cache *dirInfoCache - scanSema chan struct{} // scanSema prevents concurrent scans. -} - -func newGopathResolver(env *ProcessEnv) *gopathResolver { - r := &gopathResolver{ - env: env, - cache: &dirInfoCache{ - dirs: map[string]*directoryPackageInfo{}, - listeners: map[*int]cacheListener{}, - }, - scanSema: make(chan struct{}, 1), - } - r.scanSema <- struct{}{} - return r -} - -func (r *gopathResolver) ClearForNewScan() { - <-r.scanSema - r.cache = &dirInfoCache{ - dirs: map[string]*directoryPackageInfo{}, - listeners: map[*int]cacheListener{}, - } - r.walked = false - r.scanSema <- struct{}{} -} - -func (r *gopathResolver) loadPackageNames(importPaths []string, srcDir string) (map[string]string, error) { - names := map[string]string{} - bctx, err := r.env.buildContext() - if err != nil { - return nil, err - } - for _, path := range importPaths { - names[path] = importPathToName(bctx, path, srcDir) - } - return names, nil -} - -// importPathToName finds out the actual package name, as declared in its .go files. -func importPathToName(bctx *build.Context, importPath, srcDir string) string { - // Fast path for standard library without going to disk. - if _, ok := stdlib[importPath]; ok { - return path.Base(importPath) // stdlib packages always match their paths. - } - - buildPkg, err := bctx.Import(importPath, srcDir, build.FindOnly) - if err != nil { - return "" - } - pkgName, err := packageDirToName(buildPkg.Dir) - if err != nil { - return "" - } - return pkgName -} - -// packageDirToName is a faster version of build.Import if -// the only thing desired is the package name. Given a directory, -// packageDirToName then only parses one file in the package, -// trusting that the files in the directory are consistent. -func packageDirToName(dir string) (packageName string, err error) { - d, err := os.Open(dir) - if err != nil { - return "", err - } - names, err := d.Readdirnames(-1) - d.Close() - if err != nil { - return "", err - } - sort.Strings(names) // to have predictable behavior - var lastErr error - var nfile int - for _, name := range names { - if !strings.HasSuffix(name, ".go") { - continue - } - if strings.HasSuffix(name, "_test.go") { - continue - } - nfile++ - fullFile := filepath.Join(dir, name) - - fset := token.NewFileSet() - f, err := parser.ParseFile(fset, fullFile, nil, parser.PackageClauseOnly) - if err != nil { - lastErr = err - continue - } - pkgName := f.Name.Name - if pkgName == "documentation" { - // Special case from go/build.ImportDir, not - // handled by ctx.MatchFile. - continue - } - if pkgName == "main" { - // Also skip package main, assuming it's a +build ignore generator or example. - // Since you can't import a package main anyway, there's no harm here. - continue - } - return pkgName, nil - } - if lastErr != nil { - return "", lastErr - } - return "", fmt.Errorf("no importable package found in %d Go files", nfile) -} - -type pkg struct { - dir string // absolute file path to pkg directory ("/usr/lib/go/src/net/http") - importPathShort string // vendorless import path ("net/http", "a/b") - packageName string // package name loaded from source if requested - relevance float64 // a weakly-defined score of how relevant a package is. 0 is most relevant. -} - -type pkgDistance struct { - pkg *pkg - distance int // relative distance to target -} - -// byDistanceOrImportPathShortLength sorts by relative distance breaking ties -// on the short import path length and then the import string itself. -type byDistanceOrImportPathShortLength []pkgDistance - -func (s byDistanceOrImportPathShortLength) Len() int { return len(s) } -func (s byDistanceOrImportPathShortLength) Less(i, j int) bool { - di, dj := s[i].distance, s[j].distance - if di == -1 { - return false - } - if dj == -1 { - return true - } - if di != dj { - return di < dj - } - - vi, vj := s[i].pkg.importPathShort, s[j].pkg.importPathShort - if len(vi) != len(vj) { - return len(vi) < len(vj) - } - return vi < vj -} -func (s byDistanceOrImportPathShortLength) Swap(i, j int) { s[i], s[j] = s[j], s[i] } - -func distance(basepath, targetpath string) int { - p, err := filepath.Rel(basepath, targetpath) - if err != nil { - return -1 - } - if p == "." { - return 0 - } - return strings.Count(p, string(filepath.Separator)) + 1 -} - -func (r *gopathResolver) scan(ctx context.Context, callback *scanCallback) error { - add := func(root gopathwalk.Root, dir string) { - // We assume cached directories have not changed. We can skip them and their - // children. - if _, ok := r.cache.Load(dir); ok { - return - } - - importpath := filepath.ToSlash(dir[len(root.Path)+len("/"):]) - info := directoryPackageInfo{ - status: directoryScanned, - dir: dir, - rootType: root.Type, - nonCanonicalImportPath: VendorlessPath(importpath), - } - r.cache.Store(dir, info) - } - processDir := func(info directoryPackageInfo) { - // Skip this directory if we were not able to get the package information successfully. - if scanned, err := info.reachedStatus(directoryScanned); !scanned || err != nil { - return - } - - p := &pkg{ - importPathShort: info.nonCanonicalImportPath, - dir: info.dir, - relevance: MaxRelevance - 1, - } - if info.rootType == gopathwalk.RootGOROOT { - p.relevance = MaxRelevance - } - - if !callback.dirFound(p) { - return - } - var err error - p.packageName, err = r.cache.CachePackageName(info) - if err != nil { - return - } - - if !callback.packageNameLoaded(p) { - return - } - if _, exports, err := r.loadExports(ctx, p, false); err == nil { - callback.exportsLoaded(p, exports) - } - } - stop := r.cache.ScanAndListen(ctx, processDir) - defer stop() - - goenv, err := r.env.goEnv() - if err != nil { - return err - } - var roots []gopathwalk.Root - roots = append(roots, gopathwalk.Root{Path: filepath.Join(goenv["GOROOT"], "src"), Type: gopathwalk.RootGOROOT}) - for _, p := range filepath.SplitList(goenv["GOPATH"]) { - roots = append(roots, gopathwalk.Root{Path: filepath.Join(p, "src"), Type: gopathwalk.RootGOPATH}) - } - // The callback is not necessarily safe to use in the goroutine below. Process roots eagerly. - roots = filterRoots(roots, callback.rootFound) - // We can't cancel walks, because we need them to finish to have a usable - // cache. Instead, run them in a separate goroutine and detach. - scanDone := make(chan struct{}) - go func() { - select { - case <-ctx.Done(): - return - case <-r.scanSema: - } - defer func() { r.scanSema <- struct{}{} }() - gopathwalk.Walk(roots, add, gopathwalk.Options{Logf: r.env.Logf, ModulesEnabled: false}) - close(scanDone) - }() - select { - case <-ctx.Done(): - case <-scanDone: - } - return nil -} - -func (r *gopathResolver) scoreImportPath(ctx context.Context, path string) float64 { - if _, ok := stdlib[path]; ok { - return MaxRelevance - } - return MaxRelevance - 1 -} - -func filterRoots(roots []gopathwalk.Root, include func(gopathwalk.Root) bool) []gopathwalk.Root { - var result []gopathwalk.Root - for _, root := range roots { - if !include(root) { - continue - } - result = append(result, root) - } - return result -} - -func (r *gopathResolver) loadExports(ctx context.Context, pkg *pkg, includeTest bool) (string, []string, error) { - if info, ok := r.cache.Load(pkg.dir); ok && !includeTest { - return r.cache.CacheExports(ctx, r.env, info) - } - return loadExportsFromFiles(ctx, r.env, pkg.dir, includeTest) -} - -// VendorlessPath returns the devendorized version of the import path ipath. -// For example, VendorlessPath("foo/bar/vendor/a/b") returns "a/b". -func VendorlessPath(ipath string) string { - // Devendorize for use in import statement. - if i := strings.LastIndex(ipath, "/vendor/"); i >= 0 { - return ipath[i+len("/vendor/"):] - } - if strings.HasPrefix(ipath, "vendor/") { - return ipath[len("vendor/"):] - } - return ipath -} - -func loadExportsFromFiles(ctx context.Context, env *ProcessEnv, dir string, includeTest bool) (string, []string, error) { - // Look for non-test, buildable .go files which could provide exports. - all, err := ioutil.ReadDir(dir) - if err != nil { - return "", nil, err - } - var files []os.FileInfo - for _, fi := range all { - name := fi.Name() - if !strings.HasSuffix(name, ".go") || (!includeTest && strings.HasSuffix(name, "_test.go")) { - continue - } - match, err := env.matchFile(dir, fi.Name()) - if err != nil || !match { - continue - } - files = append(files, fi) - } - - if len(files) == 0 { - return "", nil, fmt.Errorf("dir %v contains no buildable, non-test .go files", dir) - } - - var pkgName string - var exports []string - fset := token.NewFileSet() - for _, fi := range files { - select { - case <-ctx.Done(): - return "", nil, ctx.Err() - default: - } - - fullFile := filepath.Join(dir, fi.Name()) - f, err := parser.ParseFile(fset, fullFile, nil, 0) - if err != nil { - if env.Logf != nil { - env.Logf("error parsing %v: %v", fullFile, err) - } - continue - } - if f.Name.Name == "documentation" { - // Special case from go/build.ImportDir, not - // handled by MatchFile above. - continue - } - if includeTest && strings.HasSuffix(f.Name.Name, "_test") { - // x_test package. We want internal test files only. - continue - } - pkgName = f.Name.Name - for name := range f.Scope.Objects { - if ast.IsExported(name) { - exports = append(exports, name) - } - } - } - - if env.Logf != nil { - sortedExports := append([]string(nil), exports...) - sort.Strings(sortedExports) - env.Logf("loaded exports in dir %v (package %v): %v", dir, pkgName, strings.Join(sortedExports, ", ")) - } - return pkgName, exports, nil -} - -// findImport searches for a package with the given symbols. -// If no package is found, findImport returns ("", false, nil) -func findImport(ctx context.Context, pass *pass, candidates []pkgDistance, pkgName string, symbols map[string]bool, filename string) (*pkg, error) { - // Sort the candidates by their import package length, - // assuming that shorter package names are better than long - // ones. Note that this sorts by the de-vendored name, so - // there's no "penalty" for vendoring. - sort.Sort(byDistanceOrImportPathShortLength(candidates)) - if pass.env.Logf != nil { - for i, c := range candidates { - pass.env.Logf("%s candidate %d/%d: %v in %v", pkgName, i+1, len(candidates), c.pkg.importPathShort, c.pkg.dir) - } - } - resolver, err := pass.env.GetResolver() - if err != nil { - return nil, err - } - - // Collect exports for packages with matching names. - rescv := make([]chan *pkg, len(candidates)) - for i := range candidates { - rescv[i] = make(chan *pkg, 1) - } - const maxConcurrentPackageImport = 4 - loadExportsSem := make(chan struct{}, maxConcurrentPackageImport) - - ctx, cancel := context.WithCancel(ctx) - var wg sync.WaitGroup - defer func() { - cancel() - wg.Wait() - }() - - wg.Add(1) - go func() { - defer wg.Done() - for i, c := range candidates { - select { - case loadExportsSem <- struct{}{}: - case <-ctx.Done(): - return - } - - wg.Add(1) - go func(c pkgDistance, resc chan<- *pkg) { - defer func() { - <-loadExportsSem - wg.Done() - }() - - if pass.env.Logf != nil { - pass.env.Logf("loading exports in dir %s (seeking package %s)", c.pkg.dir, pkgName) - } - // If we're an x_test, load the package under test's test variant. - includeTest := strings.HasSuffix(pass.f.Name.Name, "_test") && c.pkg.dir == pass.srcDir - _, exports, err := resolver.loadExports(ctx, c.pkg, includeTest) - if err != nil { - if pass.env.Logf != nil { - pass.env.Logf("loading exports in dir %s (seeking package %s): %v", c.pkg.dir, pkgName, err) - } - resc <- nil - return - } - - exportsMap := make(map[string]bool, len(exports)) - for _, sym := range exports { - exportsMap[sym] = true - } - - // If it doesn't have the right - // symbols, send nil to mean no match. - for symbol := range symbols { - if !exportsMap[symbol] { - resc <- nil - return - } - } - resc <- c.pkg - }(c, rescv[i]) - } - }() - - for _, resc := range rescv { - pkg := <-resc - if pkg == nil { - continue - } - return pkg, nil - } - return nil, nil -} - -// pkgIsCandidate reports whether pkg is a candidate for satisfying the -// finding which package pkgIdent in the file named by filename is trying -// to refer to. -// -// This check is purely lexical and is meant to be as fast as possible -// because it's run over all $GOPATH directories to filter out poor -// candidates in order to limit the CPU and I/O later parsing the -// exports in candidate packages. -// -// filename is the file being formatted. -// pkgIdent is the package being searched for, like "client" (if -// searching for "client.New") -func pkgIsCandidate(filename string, refs references, pkg *pkg) bool { - // Check "internal" and "vendor" visibility: - if !canUse(filename, pkg.dir) { - return false - } - - // Speed optimization to minimize disk I/O: - // the last two components on disk must contain the - // package name somewhere. - // - // This permits mismatch naming like directory - // "go-foo" being package "foo", or "pkg.v3" being "pkg", - // or directory "google.golang.org/api/cloudbilling/v1" - // being package "cloudbilling", but doesn't - // permit a directory "foo" to be package - // "bar", which is strongly discouraged - // anyway. There's no reason goimports needs - // to be slow just to accommodate that. - for pkgIdent := range refs { - lastTwo := lastTwoComponents(pkg.importPathShort) - if strings.Contains(lastTwo, pkgIdent) { - return true - } - if hasHyphenOrUpperASCII(lastTwo) && !hasHyphenOrUpperASCII(pkgIdent) { - lastTwo = lowerASCIIAndRemoveHyphen(lastTwo) - if strings.Contains(lastTwo, pkgIdent) { - return true - } - } - } - return false -} - -func hasHyphenOrUpperASCII(s string) bool { - for i := 0; i < len(s); i++ { - b := s[i] - if b == '-' || ('A' <= b && b <= 'Z') { - return true - } - } - return false -} - -func lowerASCIIAndRemoveHyphen(s string) (ret string) { - buf := make([]byte, 0, len(s)) - for i := 0; i < len(s); i++ { - b := s[i] - switch { - case b == '-': - continue - case 'A' <= b && b <= 'Z': - buf = append(buf, b+('a'-'A')) - default: - buf = append(buf, b) - } - } - return string(buf) -} - -// canUse reports whether the package in dir is usable from filename, -// respecting the Go "internal" and "vendor" visibility rules. -func canUse(filename, dir string) bool { - // Fast path check, before any allocations. If it doesn't contain vendor - // or internal, it's not tricky: - // Note that this can false-negative on directories like "notinternal", - // but we check it correctly below. This is just a fast path. - if !strings.Contains(dir, "vendor") && !strings.Contains(dir, "internal") { - return true - } - - dirSlash := filepath.ToSlash(dir) - if !strings.Contains(dirSlash, "/vendor/") && !strings.Contains(dirSlash, "/internal/") && !strings.HasSuffix(dirSlash, "/internal") { - return true - } - // Vendor or internal directory only visible from children of parent. - // That means the path from the current directory to the target directory - // can contain ../vendor or ../internal but not ../foo/vendor or ../foo/internal - // or bar/vendor or bar/internal. - // After stripping all the leading ../, the only okay place to see vendor or internal - // is at the very beginning of the path. - absfile, err := filepath.Abs(filename) - if err != nil { - return false - } - absdir, err := filepath.Abs(dir) - if err != nil { - return false - } - rel, err := filepath.Rel(absfile, absdir) - if err != nil { - return false - } - relSlash := filepath.ToSlash(rel) - if i := strings.LastIndex(relSlash, "../"); i >= 0 { - relSlash = relSlash[i+len("../"):] - } - return !strings.Contains(relSlash, "/vendor/") && !strings.Contains(relSlash, "/internal/") && !strings.HasSuffix(relSlash, "/internal") -} - -// lastTwoComponents returns at most the last two path components -// of v, using either / or \ as the path separator. -func lastTwoComponents(v string) string { - nslash := 0 - for i := len(v) - 1; i >= 0; i-- { - if v[i] == '/' || v[i] == '\\' { - nslash++ - if nslash == 2 { - return v[i:] - } - } - } - return v -} - -type visitFn func(node ast.Node) ast.Visitor - -func (fn visitFn) Visit(node ast.Node) ast.Visitor { - return fn(node) -} - -func copyExports(pkg []string) map[string]bool { - m := make(map[string]bool, len(pkg)) - for _, v := range pkg { - m[v] = true - } - return m -} diff --git a/vendor/golang.org/x/tools/internal/imports/imports.go b/vendor/golang.org/x/tools/internal/imports/imports.go deleted file mode 100644 index 58e637b90f..0000000000 --- a/vendor/golang.org/x/tools/internal/imports/imports.go +++ /dev/null @@ -1,356 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:generate go run mkstdlib.go - -// Package imports implements a Go pretty-printer (like package "go/format") -// that also adds or removes import statements as necessary. -package imports - -import ( - "bufio" - "bytes" - "context" - "fmt" - "go/ast" - "go/format" - "go/parser" - "go/printer" - "go/token" - "io" - "regexp" - "strconv" - "strings" - - "golang.org/x/tools/go/ast/astutil" - "golang.org/x/tools/internal/event" -) - -// Options is golang.org/x/tools/imports.Options with extra internal-only options. -type Options struct { - Env *ProcessEnv // The environment to use. Note: this contains the cached module and filesystem state. - - // LocalPrefix is a comma-separated string of import path prefixes, which, if - // set, instructs Process to sort the import paths with the given prefixes - // into another group after 3rd-party packages. - LocalPrefix string - - Fragment bool // Accept fragment of a source file (no package statement) - AllErrors bool // Report all errors (not just the first 10 on different lines) - - Comments bool // Print comments (true if nil *Options provided) - TabIndent bool // Use tabs for indent (true if nil *Options provided) - TabWidth int // Tab width (8 if nil *Options provided) - - FormatOnly bool // Disable the insertion and deletion of imports -} - -// Process implements golang.org/x/tools/imports.Process with explicit context in opt.Env. -func Process(filename string, src []byte, opt *Options) (formatted []byte, err error) { - fileSet := token.NewFileSet() - file, adjust, err := parse(fileSet, filename, src, opt) - if err != nil { - return nil, err - } - - if !opt.FormatOnly { - if err := fixImports(fileSet, file, filename, opt.Env); err != nil { - return nil, err - } - } - return formatFile(fileSet, file, src, adjust, opt) -} - -// FixImports returns a list of fixes to the imports that, when applied, -// will leave the imports in the same state as Process. src and opt must -// be specified. -// -// Note that filename's directory influences which imports can be chosen, -// so it is important that filename be accurate. -func FixImports(ctx context.Context, filename string, src []byte, opt *Options) (fixes []*ImportFix, err error) { - ctx, done := event.Start(ctx, "imports.FixImports") - defer done() - - fileSet := token.NewFileSet() - file, _, err := parse(fileSet, filename, src, opt) - if err != nil { - return nil, err - } - - return getFixes(ctx, fileSet, file, filename, opt.Env) -} - -// ApplyFixes applies all of the fixes to the file and formats it. extraMode -// is added in when parsing the file. src and opts must be specified, but no -// env is needed. -func ApplyFixes(fixes []*ImportFix, filename string, src []byte, opt *Options, extraMode parser.Mode) (formatted []byte, err error) { - // Don't use parse() -- we don't care about fragments or statement lists - // here, and we need to work with unparseable files. - fileSet := token.NewFileSet() - parserMode := parser.Mode(0) - if opt.Comments { - parserMode |= parser.ParseComments - } - if opt.AllErrors { - parserMode |= parser.AllErrors - } - parserMode |= extraMode - - file, err := parser.ParseFile(fileSet, filename, src, parserMode) - if file == nil { - return nil, err - } - - // Apply the fixes to the file. - apply(fileSet, file, fixes) - - return formatFile(fileSet, file, src, nil, opt) -} - -// formatFile formats the file syntax tree. -// It may mutate the token.FileSet. -// -// If an adjust function is provided, it is called after formatting -// with the original source (formatFile's src parameter) and the -// formatted file, and returns the postpocessed result. -func formatFile(fset *token.FileSet, file *ast.File, src []byte, adjust func(orig []byte, src []byte) []byte, opt *Options) ([]byte, error) { - mergeImports(file) - sortImports(opt.LocalPrefix, fset.File(file.Pos()), file) - var spacesBefore []string // import paths we need spaces before - for _, impSection := range astutil.Imports(fset, file) { - // Within each block of contiguous imports, see if any - // import lines are in different group numbers. If so, - // we'll need to put a space between them so it's - // compatible with gofmt. - lastGroup := -1 - for _, importSpec := range impSection { - importPath, _ := strconv.Unquote(importSpec.Path.Value) - groupNum := importGroup(opt.LocalPrefix, importPath) - if groupNum != lastGroup && lastGroup != -1 { - spacesBefore = append(spacesBefore, importPath) - } - lastGroup = groupNum - } - - } - - printerMode := printer.UseSpaces - if opt.TabIndent { - printerMode |= printer.TabIndent - } - printConfig := &printer.Config{Mode: printerMode, Tabwidth: opt.TabWidth} - - var buf bytes.Buffer - err := printConfig.Fprint(&buf, fset, file) - if err != nil { - return nil, err - } - out := buf.Bytes() - if adjust != nil { - out = adjust(src, out) - } - if len(spacesBefore) > 0 { - out, err = addImportSpaces(bytes.NewReader(out), spacesBefore) - if err != nil { - return nil, err - } - } - - out, err = format.Source(out) - if err != nil { - return nil, err - } - return out, nil -} - -// parse parses src, which was read from filename, -// as a Go source file or statement list. -func parse(fset *token.FileSet, filename string, src []byte, opt *Options) (*ast.File, func(orig, src []byte) []byte, error) { - parserMode := parser.Mode(0) - if opt.Comments { - parserMode |= parser.ParseComments - } - if opt.AllErrors { - parserMode |= parser.AllErrors - } - - // Try as whole source file. - file, err := parser.ParseFile(fset, filename, src, parserMode) - if err == nil { - return file, nil, nil - } - // If the error is that the source file didn't begin with a - // package line and we accept fragmented input, fall through to - // try as a source fragment. Stop and return on any other error. - if !opt.Fragment || !strings.Contains(err.Error(), "expected 'package'") { - return nil, nil, err - } - - // If this is a declaration list, make it a source file - // by inserting a package clause. - // Insert using a ;, not a newline, so that parse errors are on - // the correct line. - const prefix = "package main;" - psrc := append([]byte(prefix), src...) - file, err = parser.ParseFile(fset, filename, psrc, parserMode) - if err == nil { - // Gofmt will turn the ; into a \n. - // Do that ourselves now and update the file contents, - // so that positions and line numbers are correct going forward. - psrc[len(prefix)-1] = '\n' - fset.File(file.Package).SetLinesForContent(psrc) - - // If a main function exists, we will assume this is a main - // package and leave the file. - if containsMainFunc(file) { - return file, nil, nil - } - - adjust := func(orig, src []byte) []byte { - // Remove the package clause. - src = src[len(prefix):] - return matchSpace(orig, src) - } - return file, adjust, nil - } - // If the error is that the source file didn't begin with a - // declaration, fall through to try as a statement list. - // Stop and return on any other error. - if !strings.Contains(err.Error(), "expected declaration") { - return nil, nil, err - } - - // If this is a statement list, make it a source file - // by inserting a package clause and turning the list - // into a function body. This handles expressions too. - // Insert using a ;, not a newline, so that the line numbers - // in fsrc match the ones in src. - fsrc := append(append([]byte("package p; func _() {"), src...), '}') - file, err = parser.ParseFile(fset, filename, fsrc, parserMode) - if err == nil { - adjust := func(orig, src []byte) []byte { - // Remove the wrapping. - // Gofmt has turned the ; into a \n\n. - src = src[len("package p\n\nfunc _() {"):] - src = src[:len(src)-len("}\n")] - // Gofmt has also indented the function body one level. - // Remove that indent. - src = bytes.Replace(src, []byte("\n\t"), []byte("\n"), -1) - return matchSpace(orig, src) - } - return file, adjust, nil - } - - // Failed, and out of options. - return nil, nil, err -} - -// containsMainFunc checks if a file contains a function declaration with the -// function signature 'func main()' -func containsMainFunc(file *ast.File) bool { - for _, decl := range file.Decls { - if f, ok := decl.(*ast.FuncDecl); ok { - if f.Name.Name != "main" { - continue - } - - if len(f.Type.Params.List) != 0 { - continue - } - - if f.Type.Results != nil && len(f.Type.Results.List) != 0 { - continue - } - - return true - } - } - - return false -} - -func cutSpace(b []byte) (before, middle, after []byte) { - i := 0 - for i < len(b) && (b[i] == ' ' || b[i] == '\t' || b[i] == '\n') { - i++ - } - j := len(b) - for j > 0 && (b[j-1] == ' ' || b[j-1] == '\t' || b[j-1] == '\n') { - j-- - } - if i <= j { - return b[:i], b[i:j], b[j:] - } - return nil, nil, b[j:] -} - -// matchSpace reformats src to use the same space context as orig. -// 1. If orig begins with blank lines, matchSpace inserts them at the beginning of src. -// 2. matchSpace copies the indentation of the first non-blank line in orig -// to every non-blank line in src. -// 3. matchSpace copies the trailing space from orig and uses it in place -// of src's trailing space. -func matchSpace(orig []byte, src []byte) []byte { - before, _, after := cutSpace(orig) - i := bytes.LastIndex(before, []byte{'\n'}) - before, indent := before[:i+1], before[i+1:] - - _, src, _ = cutSpace(src) - - var b bytes.Buffer - b.Write(before) - for len(src) > 0 { - line := src - if i := bytes.IndexByte(line, '\n'); i >= 0 { - line, src = line[:i+1], line[i+1:] - } else { - src = nil - } - if len(line) > 0 && line[0] != '\n' { // not blank - b.Write(indent) - } - b.Write(line) - } - b.Write(after) - return b.Bytes() -} - -var impLine = regexp.MustCompile(`^\s+(?:[\w\.]+\s+)?"(.+?)"`) - -func addImportSpaces(r io.Reader, breaks []string) ([]byte, error) { - var out bytes.Buffer - in := bufio.NewReader(r) - inImports := false - done := false - for { - s, err := in.ReadString('\n') - if err == io.EOF { - break - } else if err != nil { - return nil, err - } - - if !inImports && !done && strings.HasPrefix(s, "import") { - inImports = true - } - if inImports && (strings.HasPrefix(s, "var") || - strings.HasPrefix(s, "func") || - strings.HasPrefix(s, "const") || - strings.HasPrefix(s, "type")) { - done = true - inImports = false - } - if inImports && len(breaks) > 0 { - if m := impLine.FindStringSubmatch(s); m != nil { - if m[1] == breaks[0] { - out.WriteByte('\n') - breaks = breaks[1:] - } - } - } - - fmt.Fprint(&out, s) - } - return out.Bytes(), nil -} diff --git a/vendor/golang.org/x/tools/internal/imports/mod.go b/vendor/golang.org/x/tools/internal/imports/mod.go deleted file mode 100644 index 977d2389da..0000000000 --- a/vendor/golang.org/x/tools/internal/imports/mod.go +++ /dev/null @@ -1,724 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package imports - -import ( - "bytes" - "context" - "encoding/json" - "fmt" - "io/ioutil" - "os" - "path" - "path/filepath" - "regexp" - "sort" - "strconv" - "strings" - - "golang.org/x/mod/module" - "golang.org/x/tools/internal/event" - "golang.org/x/tools/internal/gocommand" - "golang.org/x/tools/internal/gopathwalk" -) - -// ModuleResolver implements resolver for modules using the go command as little -// as feasible. -type ModuleResolver struct { - env *ProcessEnv - moduleCacheDir string - dummyVendorMod *gocommand.ModuleJSON // If vendoring is enabled, the pseudo-module that represents the /vendor directory. - roots []gopathwalk.Root - scanSema chan struct{} // scanSema prevents concurrent scans and guards scannedRoots. - scannedRoots map[gopathwalk.Root]bool - - initialized bool - mains []*gocommand.ModuleJSON - mainByDir map[string]*gocommand.ModuleJSON - modsByModPath []*gocommand.ModuleJSON // All modules, ordered by # of path components in module Path... - modsByDir []*gocommand.ModuleJSON // ...or number of path components in their Dir. - - // moduleCacheCache stores information about the module cache. - moduleCacheCache *dirInfoCache - otherCache *dirInfoCache -} - -func newModuleResolver(e *ProcessEnv) *ModuleResolver { - r := &ModuleResolver{ - env: e, - scanSema: make(chan struct{}, 1), - } - r.scanSema <- struct{}{} - return r -} - -func (r *ModuleResolver) init() error { - if r.initialized { - return nil - } - - goenv, err := r.env.goEnv() - if err != nil { - return err - } - inv := gocommand.Invocation{ - BuildFlags: r.env.BuildFlags, - ModFlag: r.env.ModFlag, - ModFile: r.env.ModFile, - Env: r.env.env(), - Logf: r.env.Logf, - WorkingDir: r.env.WorkingDir, - } - - vendorEnabled := false - var mainModVendor *gocommand.ModuleJSON - - // Module vendor directories are ignored in workspace mode: - // https://go.googlesource.com/proposal/+/master/design/45713-workspace.md - if len(r.env.Env["GOWORK"]) == 0 { - vendorEnabled, mainModVendor, err = gocommand.VendorEnabled(context.TODO(), inv, r.env.GocmdRunner) - if err != nil { - return err - } - } - - if mainModVendor != nil && vendorEnabled { - // Vendor mode is on, so all the non-Main modules are irrelevant, - // and we need to search /vendor for everything. - r.mains = []*gocommand.ModuleJSON{mainModVendor} - r.dummyVendorMod = &gocommand.ModuleJSON{ - Path: "", - Dir: filepath.Join(mainModVendor.Dir, "vendor"), - } - r.modsByModPath = []*gocommand.ModuleJSON{mainModVendor, r.dummyVendorMod} - r.modsByDir = []*gocommand.ModuleJSON{mainModVendor, r.dummyVendorMod} - } else { - // Vendor mode is off, so run go list -m ... to find everything. - err := r.initAllMods() - // We expect an error when running outside of a module with - // GO111MODULE=on. Other errors are fatal. - if err != nil { - if errMsg := err.Error(); !strings.Contains(errMsg, "working directory is not part of a module") && !strings.Contains(errMsg, "go.mod file not found") { - return err - } - } - } - - if gmc := r.env.Env["GOMODCACHE"]; gmc != "" { - r.moduleCacheDir = gmc - } else { - gopaths := filepath.SplitList(goenv["GOPATH"]) - if len(gopaths) == 0 { - return fmt.Errorf("empty GOPATH") - } - r.moduleCacheDir = filepath.Join(gopaths[0], "/pkg/mod") - } - - sort.Slice(r.modsByModPath, func(i, j int) bool { - count := func(x int) int { - return strings.Count(r.modsByModPath[x].Path, "/") - } - return count(j) < count(i) // descending order - }) - sort.Slice(r.modsByDir, func(i, j int) bool { - count := func(x int) int { - return strings.Count(r.modsByDir[x].Dir, string(filepath.Separator)) - } - return count(j) < count(i) // descending order - }) - - r.roots = []gopathwalk.Root{ - {Path: filepath.Join(goenv["GOROOT"], "/src"), Type: gopathwalk.RootGOROOT}, - } - r.mainByDir = make(map[string]*gocommand.ModuleJSON) - for _, main := range r.mains { - r.roots = append(r.roots, gopathwalk.Root{Path: main.Dir, Type: gopathwalk.RootCurrentModule}) - r.mainByDir[main.Dir] = main - } - if vendorEnabled { - r.roots = append(r.roots, gopathwalk.Root{Path: r.dummyVendorMod.Dir, Type: gopathwalk.RootOther}) - } else { - addDep := func(mod *gocommand.ModuleJSON) { - if mod.Replace == nil { - // This is redundant with the cache, but we'll skip it cheaply enough. - r.roots = append(r.roots, gopathwalk.Root{Path: mod.Dir, Type: gopathwalk.RootModuleCache}) - } else { - r.roots = append(r.roots, gopathwalk.Root{Path: mod.Dir, Type: gopathwalk.RootOther}) - } - } - // Walk dependent modules before scanning the full mod cache, direct deps first. - for _, mod := range r.modsByModPath { - if !mod.Indirect && !mod.Main { - addDep(mod) - } - } - for _, mod := range r.modsByModPath { - if mod.Indirect && !mod.Main { - addDep(mod) - } - } - r.roots = append(r.roots, gopathwalk.Root{Path: r.moduleCacheDir, Type: gopathwalk.RootModuleCache}) - } - - r.scannedRoots = map[gopathwalk.Root]bool{} - if r.moduleCacheCache == nil { - r.moduleCacheCache = &dirInfoCache{ - dirs: map[string]*directoryPackageInfo{}, - listeners: map[*int]cacheListener{}, - } - } - if r.otherCache == nil { - r.otherCache = &dirInfoCache{ - dirs: map[string]*directoryPackageInfo{}, - listeners: map[*int]cacheListener{}, - } - } - r.initialized = true - return nil -} - -func (r *ModuleResolver) initAllMods() error { - stdout, err := r.env.invokeGo(context.TODO(), "list", "-m", "-e", "-json", "...") - if err != nil { - return err - } - for dec := json.NewDecoder(stdout); dec.More(); { - mod := &gocommand.ModuleJSON{} - if err := dec.Decode(mod); err != nil { - return err - } - if mod.Dir == "" { - if r.env.Logf != nil { - r.env.Logf("module %v has not been downloaded and will be ignored", mod.Path) - } - // Can't do anything with a module that's not downloaded. - continue - } - // golang/go#36193: the go command doesn't always clean paths. - mod.Dir = filepath.Clean(mod.Dir) - r.modsByModPath = append(r.modsByModPath, mod) - r.modsByDir = append(r.modsByDir, mod) - if mod.Main { - r.mains = append(r.mains, mod) - } - } - return nil -} - -func (r *ModuleResolver) ClearForNewScan() { - <-r.scanSema - r.scannedRoots = map[gopathwalk.Root]bool{} - r.otherCache = &dirInfoCache{ - dirs: map[string]*directoryPackageInfo{}, - listeners: map[*int]cacheListener{}, - } - r.scanSema <- struct{}{} -} - -func (r *ModuleResolver) ClearForNewMod() { - <-r.scanSema - *r = ModuleResolver{ - env: r.env, - moduleCacheCache: r.moduleCacheCache, - otherCache: r.otherCache, - scanSema: r.scanSema, - } - r.init() - r.scanSema <- struct{}{} -} - -// findPackage returns the module and directory that contains the package at -// the given import path, or returns nil, "" if no module is in scope. -func (r *ModuleResolver) findPackage(importPath string) (*gocommand.ModuleJSON, string) { - // This can't find packages in the stdlib, but that's harmless for all - // the existing code paths. - for _, m := range r.modsByModPath { - if !strings.HasPrefix(importPath, m.Path) { - continue - } - pathInModule := importPath[len(m.Path):] - pkgDir := filepath.Join(m.Dir, pathInModule) - if r.dirIsNestedModule(pkgDir, m) { - continue - } - - if info, ok := r.cacheLoad(pkgDir); ok { - if loaded, err := info.reachedStatus(nameLoaded); loaded { - if err != nil { - continue // No package in this dir. - } - return m, pkgDir - } - if scanned, err := info.reachedStatus(directoryScanned); scanned && err != nil { - continue // Dir is unreadable, etc. - } - // This is slightly wrong: a directory doesn't have to have an - // importable package to count as a package for package-to-module - // resolution. package main or _test files should count but - // don't. - // TODO(heschi): fix this. - if _, err := r.cachePackageName(info); err == nil { - return m, pkgDir - } - } - - // Not cached. Read the filesystem. - pkgFiles, err := ioutil.ReadDir(pkgDir) - if err != nil { - continue - } - // A module only contains a package if it has buildable go - // files in that directory. If not, it could be provided by an - // outer module. See #29736. - for _, fi := range pkgFiles { - if ok, _ := r.env.matchFile(pkgDir, fi.Name()); ok { - return m, pkgDir - } - } - } - return nil, "" -} - -func (r *ModuleResolver) cacheLoad(dir string) (directoryPackageInfo, bool) { - if info, ok := r.moduleCacheCache.Load(dir); ok { - return info, ok - } - return r.otherCache.Load(dir) -} - -func (r *ModuleResolver) cacheStore(info directoryPackageInfo) { - if info.rootType == gopathwalk.RootModuleCache { - r.moduleCacheCache.Store(info.dir, info) - } else { - r.otherCache.Store(info.dir, info) - } -} - -func (r *ModuleResolver) cacheKeys() []string { - return append(r.moduleCacheCache.Keys(), r.otherCache.Keys()...) -} - -// cachePackageName caches the package name for a dir already in the cache. -func (r *ModuleResolver) cachePackageName(info directoryPackageInfo) (string, error) { - if info.rootType == gopathwalk.RootModuleCache { - return r.moduleCacheCache.CachePackageName(info) - } - return r.otherCache.CachePackageName(info) -} - -func (r *ModuleResolver) cacheExports(ctx context.Context, env *ProcessEnv, info directoryPackageInfo) (string, []string, error) { - if info.rootType == gopathwalk.RootModuleCache { - return r.moduleCacheCache.CacheExports(ctx, env, info) - } - return r.otherCache.CacheExports(ctx, env, info) -} - -// findModuleByDir returns the module that contains dir, or nil if no such -// module is in scope. -func (r *ModuleResolver) findModuleByDir(dir string) *gocommand.ModuleJSON { - // This is quite tricky and may not be correct. dir could be: - // - a package in the main module. - // - a replace target underneath the main module's directory. - // - a nested module in the above. - // - a replace target somewhere totally random. - // - a nested module in the above. - // - in the mod cache. - // - in /vendor/ in -mod=vendor mode. - // - nested module? Dunno. - // Rumor has it that replace targets cannot contain other replace targets. - // - // Note that it is critical here that modsByDir is sorted to have deeper dirs - // first. This ensures that findModuleByDir finds the innermost module. - // See also golang/go#56291. - for _, m := range r.modsByDir { - if !strings.HasPrefix(dir, m.Dir) { - continue - } - - if r.dirIsNestedModule(dir, m) { - continue - } - - return m - } - return nil -} - -// dirIsNestedModule reports if dir is contained in a nested module underneath -// mod, not actually in mod. -func (r *ModuleResolver) dirIsNestedModule(dir string, mod *gocommand.ModuleJSON) bool { - if !strings.HasPrefix(dir, mod.Dir) { - return false - } - if r.dirInModuleCache(dir) { - // Nested modules in the module cache are pruned, - // so it cannot be a nested module. - return false - } - if mod != nil && mod == r.dummyVendorMod { - // The /vendor pseudomodule is flattened and doesn't actually count. - return false - } - modDir, _ := r.modInfo(dir) - if modDir == "" { - return false - } - return modDir != mod.Dir -} - -func (r *ModuleResolver) modInfo(dir string) (modDir string, modName string) { - readModName := func(modFile string) string { - modBytes, err := ioutil.ReadFile(modFile) - if err != nil { - return "" - } - return modulePath(modBytes) - } - - if r.dirInModuleCache(dir) { - if matches := modCacheRegexp.FindStringSubmatch(dir); len(matches) == 3 { - index := strings.Index(dir, matches[1]+"@"+matches[2]) - modDir := filepath.Join(dir[:index], matches[1]+"@"+matches[2]) - return modDir, readModName(filepath.Join(modDir, "go.mod")) - } - } - for { - if info, ok := r.cacheLoad(dir); ok { - return info.moduleDir, info.moduleName - } - f := filepath.Join(dir, "go.mod") - info, err := os.Stat(f) - if err == nil && !info.IsDir() { - return dir, readModName(f) - } - - d := filepath.Dir(dir) - if len(d) >= len(dir) { - return "", "" // reached top of file system, no go.mod - } - dir = d - } -} - -func (r *ModuleResolver) dirInModuleCache(dir string) bool { - if r.moduleCacheDir == "" { - return false - } - return strings.HasPrefix(dir, r.moduleCacheDir) -} - -func (r *ModuleResolver) loadPackageNames(importPaths []string, srcDir string) (map[string]string, error) { - if err := r.init(); err != nil { - return nil, err - } - names := map[string]string{} - for _, path := range importPaths { - _, packageDir := r.findPackage(path) - if packageDir == "" { - continue - } - name, err := packageDirToName(packageDir) - if err != nil { - continue - } - names[path] = name - } - return names, nil -} - -func (r *ModuleResolver) scan(ctx context.Context, callback *scanCallback) error { - ctx, done := event.Start(ctx, "imports.ModuleResolver.scan") - defer done() - - if err := r.init(); err != nil { - return err - } - - processDir := func(info directoryPackageInfo) { - // Skip this directory if we were not able to get the package information successfully. - if scanned, err := info.reachedStatus(directoryScanned); !scanned || err != nil { - return - } - pkg, err := r.canonicalize(info) - if err != nil { - return - } - - if !callback.dirFound(pkg) { - return - } - pkg.packageName, err = r.cachePackageName(info) - if err != nil { - return - } - - if !callback.packageNameLoaded(pkg) { - return - } - _, exports, err := r.loadExports(ctx, pkg, false) - if err != nil { - return - } - callback.exportsLoaded(pkg, exports) - } - - // Start processing everything in the cache, and listen for the new stuff - // we discover in the walk below. - stop1 := r.moduleCacheCache.ScanAndListen(ctx, processDir) - defer stop1() - stop2 := r.otherCache.ScanAndListen(ctx, processDir) - defer stop2() - - // We assume cached directories are fully cached, including all their - // children, and have not changed. We can skip them. - skip := func(root gopathwalk.Root, dir string) bool { - if r.env.SkipPathInScan != nil && root.Type == gopathwalk.RootCurrentModule { - if root.Path == dir { - return false - } - - if r.env.SkipPathInScan(filepath.Clean(dir)) { - return true - } - } - - info, ok := r.cacheLoad(dir) - if !ok { - return false - } - // This directory can be skipped as long as we have already scanned it. - // Packages with errors will continue to have errors, so there is no need - // to rescan them. - packageScanned, _ := info.reachedStatus(directoryScanned) - return packageScanned - } - - // Add anything new to the cache, and process it if we're still listening. - add := func(root gopathwalk.Root, dir string) { - r.cacheStore(r.scanDirForPackage(root, dir)) - } - - // r.roots and the callback are not necessarily safe to use in the - // goroutine below. Process them eagerly. - roots := filterRoots(r.roots, callback.rootFound) - // We can't cancel walks, because we need them to finish to have a usable - // cache. Instead, run them in a separate goroutine and detach. - scanDone := make(chan struct{}) - go func() { - select { - case <-ctx.Done(): - return - case <-r.scanSema: - } - defer func() { r.scanSema <- struct{}{} }() - // We have the lock on r.scannedRoots, and no other scans can run. - for _, root := range roots { - if ctx.Err() != nil { - return - } - - if r.scannedRoots[root] { - continue - } - gopathwalk.WalkSkip([]gopathwalk.Root{root}, add, skip, gopathwalk.Options{Logf: r.env.Logf, ModulesEnabled: true}) - r.scannedRoots[root] = true - } - close(scanDone) - }() - select { - case <-ctx.Done(): - case <-scanDone: - } - return nil -} - -func (r *ModuleResolver) scoreImportPath(ctx context.Context, path string) float64 { - if _, ok := stdlib[path]; ok { - return MaxRelevance - } - mod, _ := r.findPackage(path) - return modRelevance(mod) -} - -func modRelevance(mod *gocommand.ModuleJSON) float64 { - var relevance float64 - switch { - case mod == nil: // out of scope - return MaxRelevance - 4 - case mod.Indirect: - relevance = MaxRelevance - 3 - case !mod.Main: - relevance = MaxRelevance - 2 - default: - relevance = MaxRelevance - 1 // main module ties with stdlib - } - - _, versionString, ok := module.SplitPathVersion(mod.Path) - if ok { - index := strings.Index(versionString, "v") - if index == -1 { - return relevance - } - if versionNumber, err := strconv.ParseFloat(versionString[index+1:], 64); err == nil { - relevance += versionNumber / 1000 - } - } - - return relevance -} - -// canonicalize gets the result of canonicalizing the packages using the results -// of initializing the resolver from 'go list -m'. -func (r *ModuleResolver) canonicalize(info directoryPackageInfo) (*pkg, error) { - // Packages in GOROOT are already canonical, regardless of the std/cmd modules. - if info.rootType == gopathwalk.RootGOROOT { - return &pkg{ - importPathShort: info.nonCanonicalImportPath, - dir: info.dir, - packageName: path.Base(info.nonCanonicalImportPath), - relevance: MaxRelevance, - }, nil - } - - importPath := info.nonCanonicalImportPath - mod := r.findModuleByDir(info.dir) - // Check if the directory is underneath a module that's in scope. - if mod != nil { - // It is. If dir is the target of a replace directive, - // our guessed import path is wrong. Use the real one. - if mod.Dir == info.dir { - importPath = mod.Path - } else { - dirInMod := info.dir[len(mod.Dir)+len("/"):] - importPath = path.Join(mod.Path, filepath.ToSlash(dirInMod)) - } - } else if !strings.HasPrefix(importPath, info.moduleName) { - // The module's name doesn't match the package's import path. It - // probably needs a replace directive we don't have. - return nil, fmt.Errorf("package in %q is not valid without a replace statement", info.dir) - } - - res := &pkg{ - importPathShort: importPath, - dir: info.dir, - relevance: modRelevance(mod), - } - // We may have discovered a package that has a different version - // in scope already. Canonicalize to that one if possible. - if _, canonicalDir := r.findPackage(importPath); canonicalDir != "" { - res.dir = canonicalDir - } - return res, nil -} - -func (r *ModuleResolver) loadExports(ctx context.Context, pkg *pkg, includeTest bool) (string, []string, error) { - if err := r.init(); err != nil { - return "", nil, err - } - if info, ok := r.cacheLoad(pkg.dir); ok && !includeTest { - return r.cacheExports(ctx, r.env, info) - } - return loadExportsFromFiles(ctx, r.env, pkg.dir, includeTest) -} - -func (r *ModuleResolver) scanDirForPackage(root gopathwalk.Root, dir string) directoryPackageInfo { - subdir := "" - if dir != root.Path { - subdir = dir[len(root.Path)+len("/"):] - } - importPath := filepath.ToSlash(subdir) - if strings.HasPrefix(importPath, "vendor/") { - // Only enter vendor directories if they're explicitly requested as a root. - return directoryPackageInfo{ - status: directoryScanned, - err: fmt.Errorf("unwanted vendor directory"), - } - } - switch root.Type { - case gopathwalk.RootCurrentModule: - importPath = path.Join(r.mainByDir[root.Path].Path, filepath.ToSlash(subdir)) - case gopathwalk.RootModuleCache: - matches := modCacheRegexp.FindStringSubmatch(subdir) - if len(matches) == 0 { - return directoryPackageInfo{ - status: directoryScanned, - err: fmt.Errorf("invalid module cache path: %v", subdir), - } - } - modPath, err := module.UnescapePath(filepath.ToSlash(matches[1])) - if err != nil { - if r.env.Logf != nil { - r.env.Logf("decoding module cache path %q: %v", subdir, err) - } - return directoryPackageInfo{ - status: directoryScanned, - err: fmt.Errorf("decoding module cache path %q: %v", subdir, err), - } - } - importPath = path.Join(modPath, filepath.ToSlash(matches[3])) - } - - modDir, modName := r.modInfo(dir) - result := directoryPackageInfo{ - status: directoryScanned, - dir: dir, - rootType: root.Type, - nonCanonicalImportPath: importPath, - moduleDir: modDir, - moduleName: modName, - } - if root.Type == gopathwalk.RootGOROOT { - // stdlib packages are always in scope, despite the confusing go.mod - return result - } - return result -} - -// modCacheRegexp splits a path in a module cache into module, module version, and package. -var modCacheRegexp = regexp.MustCompile(`(.*)@([^/\\]*)(.*)`) - -var ( - slashSlash = []byte("//") - moduleStr = []byte("module") -) - -// modulePath returns the module path from the gomod file text. -// If it cannot find a module path, it returns an empty string. -// It is tolerant of unrelated problems in the go.mod file. -// -// Copied from cmd/go/internal/modfile. -func modulePath(mod []byte) string { - for len(mod) > 0 { - line := mod - mod = nil - if i := bytes.IndexByte(line, '\n'); i >= 0 { - line, mod = line[:i], line[i+1:] - } - if i := bytes.Index(line, slashSlash); i >= 0 { - line = line[:i] - } - line = bytes.TrimSpace(line) - if !bytes.HasPrefix(line, moduleStr) { - continue - } - line = line[len(moduleStr):] - n := len(line) - line = bytes.TrimSpace(line) - if len(line) == n || len(line) == 0 { - continue - } - - if line[0] == '"' || line[0] == '`' { - p, err := strconv.Unquote(string(line)) - if err != nil { - return "" // malformed quoted string or multiline module path - } - return p - } - - return string(line) - } - return "" // missing module path -} diff --git a/vendor/golang.org/x/tools/internal/imports/mod_cache.go b/vendor/golang.org/x/tools/internal/imports/mod_cache.go deleted file mode 100644 index 45690abbb4..0000000000 --- a/vendor/golang.org/x/tools/internal/imports/mod_cache.go +++ /dev/null @@ -1,236 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package imports - -import ( - "context" - "fmt" - "sync" - - "golang.org/x/tools/internal/gopathwalk" -) - -// To find packages to import, the resolver needs to know about all of -// the packages that could be imported. This includes packages that are -// already in modules that are in (1) the current module, (2) replace targets, -// and (3) packages in the module cache. Packages in (1) and (2) may change over -// time, as the client may edit the current module and locally replaced modules. -// The module cache (which includes all of the packages in (3)) can only -// ever be added to. -// -// The resolver can thus save state about packages in the module cache -// and guarantee that this will not change over time. To obtain information -// about new modules added to the module cache, the module cache should be -// rescanned. -// -// It is OK to serve information about modules that have been deleted, -// as they do still exist. -// TODO(suzmue): can we share information with the caller about -// what module needs to be downloaded to import this package? - -type directoryPackageStatus int - -const ( - _ directoryPackageStatus = iota - directoryScanned - nameLoaded - exportsLoaded -) - -type directoryPackageInfo struct { - // status indicates the extent to which this struct has been filled in. - status directoryPackageStatus - // err is non-nil when there was an error trying to reach status. - err error - - // Set when status >= directoryScanned. - - // dir is the absolute directory of this package. - dir string - rootType gopathwalk.RootType - // nonCanonicalImportPath is the package's expected import path. It may - // not actually be importable at that path. - nonCanonicalImportPath string - - // Module-related information. - moduleDir string // The directory that is the module root of this dir. - moduleName string // The module name that contains this dir. - - // Set when status >= nameLoaded. - - packageName string // the package name, as declared in the source. - - // Set when status >= exportsLoaded. - - exports []string -} - -// reachedStatus returns true when info has a status at least target and any error associated with -// an attempt to reach target. -func (info *directoryPackageInfo) reachedStatus(target directoryPackageStatus) (bool, error) { - if info.err == nil { - return info.status >= target, nil - } - if info.status == target { - return true, info.err - } - return true, nil -} - -// dirInfoCache is a concurrency safe map for storing information about -// directories that may contain packages. -// -// The information in this cache is built incrementally. Entries are initialized in scan. -// No new keys should be added in any other functions, as all directories containing -// packages are identified in scan. -// -// Other functions, including loadExports and findPackage, may update entries in this cache -// as they discover new things about the directory. -// -// The information in the cache is not expected to change for the cache's -// lifetime, so there is no protection against competing writes. Users should -// take care not to hold the cache across changes to the underlying files. -// -// TODO(suzmue): consider other concurrency strategies and data structures (RWLocks, sync.Map, etc) -type dirInfoCache struct { - mu sync.Mutex - // dirs stores information about packages in directories, keyed by absolute path. - dirs map[string]*directoryPackageInfo - listeners map[*int]cacheListener -} - -type cacheListener func(directoryPackageInfo) - -// ScanAndListen calls listener on all the items in the cache, and on anything -// newly added. The returned stop function waits for all in-flight callbacks to -// finish and blocks new ones. -func (d *dirInfoCache) ScanAndListen(ctx context.Context, listener cacheListener) func() { - ctx, cancel := context.WithCancel(ctx) - - // Flushing out all the callbacks is tricky without knowing how many there - // are going to be. Setting an arbitrary limit makes it much easier. - const maxInFlight = 10 - sema := make(chan struct{}, maxInFlight) - for i := 0; i < maxInFlight; i++ { - sema <- struct{}{} - } - - cookie := new(int) // A unique ID we can use for the listener. - - // We can't hold mu while calling the listener. - d.mu.Lock() - var keys []string - for key := range d.dirs { - keys = append(keys, key) - } - d.listeners[cookie] = func(info directoryPackageInfo) { - select { - case <-ctx.Done(): - return - case <-sema: - } - listener(info) - sema <- struct{}{} - } - d.mu.Unlock() - - stop := func() { - cancel() - d.mu.Lock() - delete(d.listeners, cookie) - d.mu.Unlock() - for i := 0; i < maxInFlight; i++ { - <-sema - } - } - - // Process the pre-existing keys. - for _, k := range keys { - select { - case <-ctx.Done(): - return stop - default: - } - if v, ok := d.Load(k); ok { - listener(v) - } - } - - return stop -} - -// Store stores the package info for dir. -func (d *dirInfoCache) Store(dir string, info directoryPackageInfo) { - d.mu.Lock() - _, old := d.dirs[dir] - d.dirs[dir] = &info - var listeners []cacheListener - for _, l := range d.listeners { - listeners = append(listeners, l) - } - d.mu.Unlock() - - if !old { - for _, l := range listeners { - l(info) - } - } -} - -// Load returns a copy of the directoryPackageInfo for absolute directory dir. -func (d *dirInfoCache) Load(dir string) (directoryPackageInfo, bool) { - d.mu.Lock() - defer d.mu.Unlock() - info, ok := d.dirs[dir] - if !ok { - return directoryPackageInfo{}, false - } - return *info, true -} - -// Keys returns the keys currently present in d. -func (d *dirInfoCache) Keys() (keys []string) { - d.mu.Lock() - defer d.mu.Unlock() - for key := range d.dirs { - keys = append(keys, key) - } - return keys -} - -func (d *dirInfoCache) CachePackageName(info directoryPackageInfo) (string, error) { - if loaded, err := info.reachedStatus(nameLoaded); loaded { - return info.packageName, err - } - if scanned, err := info.reachedStatus(directoryScanned); !scanned || err != nil { - return "", fmt.Errorf("cannot read package name, scan error: %v", err) - } - info.packageName, info.err = packageDirToName(info.dir) - info.status = nameLoaded - d.Store(info.dir, info) - return info.packageName, info.err -} - -func (d *dirInfoCache) CacheExports(ctx context.Context, env *ProcessEnv, info directoryPackageInfo) (string, []string, error) { - if reached, _ := info.reachedStatus(exportsLoaded); reached { - return info.packageName, info.exports, info.err - } - if reached, err := info.reachedStatus(nameLoaded); reached && err != nil { - return "", nil, err - } - info.packageName, info.exports, info.err = loadExportsFromFiles(ctx, env, info.dir, false) - if info.err == context.Canceled || info.err == context.DeadlineExceeded { - return info.packageName, info.exports, info.err - } - // The cache structure wants things to proceed linearly. We can skip a - // step here, but only if we succeed. - if info.status == nameLoaded || info.err == nil { - info.status = exportsLoaded - } else { - info.status = nameLoaded - } - d.Store(info.dir, info) - return info.packageName, info.exports, info.err -} diff --git a/vendor/golang.org/x/tools/internal/imports/sortimports.go b/vendor/golang.org/x/tools/internal/imports/sortimports.go deleted file mode 100644 index 1a0a7ebd9e..0000000000 --- a/vendor/golang.org/x/tools/internal/imports/sortimports.go +++ /dev/null @@ -1,297 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Hacked up copy of go/ast/import.go -// Modified to use a single token.File in preference to a FileSet. - -package imports - -import ( - "go/ast" - "go/token" - "log" - "sort" - "strconv" -) - -// sortImports sorts runs of consecutive import lines in import blocks in f. -// It also removes duplicate imports when it is possible to do so without data loss. -// -// It may mutate the token.File. -func sortImports(localPrefix string, tokFile *token.File, f *ast.File) { - for i, d := range f.Decls { - d, ok := d.(*ast.GenDecl) - if !ok || d.Tok != token.IMPORT { - // Not an import declaration, so we're done. - // Imports are always first. - break - } - - if len(d.Specs) == 0 { - // Empty import block, remove it. - f.Decls = append(f.Decls[:i], f.Decls[i+1:]...) - } - - if !d.Lparen.IsValid() { - // Not a block: sorted by default. - continue - } - - // Identify and sort runs of specs on successive lines. - i := 0 - specs := d.Specs[:0] - for j, s := range d.Specs { - if j > i && tokFile.Line(s.Pos()) > 1+tokFile.Line(d.Specs[j-1].End()) { - // j begins a new run. End this one. - specs = append(specs, sortSpecs(localPrefix, tokFile, f, d.Specs[i:j])...) - i = j - } - } - specs = append(specs, sortSpecs(localPrefix, tokFile, f, d.Specs[i:])...) - d.Specs = specs - - // Deduping can leave a blank line before the rparen; clean that up. - // Ignore line directives. - if len(d.Specs) > 0 { - lastSpec := d.Specs[len(d.Specs)-1] - lastLine := tokFile.PositionFor(lastSpec.Pos(), false).Line - if rParenLine := tokFile.PositionFor(d.Rparen, false).Line; rParenLine > lastLine+1 { - tokFile.MergeLine(rParenLine - 1) // has side effects! - } - } - } -} - -// mergeImports merges all the import declarations into the first one. -// Taken from golang.org/x/tools/ast/astutil. -// This does not adjust line numbers properly -func mergeImports(f *ast.File) { - if len(f.Decls) <= 1 { - return - } - - // Merge all the import declarations into the first one. - var first *ast.GenDecl - for i := 0; i < len(f.Decls); i++ { - decl := f.Decls[i] - gen, ok := decl.(*ast.GenDecl) - if !ok || gen.Tok != token.IMPORT || declImports(gen, "C") { - continue - } - if first == nil { - first = gen - continue // Don't touch the first one. - } - // We now know there is more than one package in this import - // declaration. Ensure that it ends up parenthesized. - first.Lparen = first.Pos() - // Move the imports of the other import declaration to the first one. - for _, spec := range gen.Specs { - spec.(*ast.ImportSpec).Path.ValuePos = first.Pos() - first.Specs = append(first.Specs, spec) - } - f.Decls = append(f.Decls[:i], f.Decls[i+1:]...) - i-- - } -} - -// declImports reports whether gen contains an import of path. -// Taken from golang.org/x/tools/ast/astutil. -func declImports(gen *ast.GenDecl, path string) bool { - if gen.Tok != token.IMPORT { - return false - } - for _, spec := range gen.Specs { - impspec := spec.(*ast.ImportSpec) - if importPath(impspec) == path { - return true - } - } - return false -} - -func importPath(s ast.Spec) string { - t, err := strconv.Unquote(s.(*ast.ImportSpec).Path.Value) - if err == nil { - return t - } - return "" -} - -func importName(s ast.Spec) string { - n := s.(*ast.ImportSpec).Name - if n == nil { - return "" - } - return n.Name -} - -func importComment(s ast.Spec) string { - c := s.(*ast.ImportSpec).Comment - if c == nil { - return "" - } - return c.Text() -} - -// collapse indicates whether prev may be removed, leaving only next. -func collapse(prev, next ast.Spec) bool { - if importPath(next) != importPath(prev) || importName(next) != importName(prev) { - return false - } - return prev.(*ast.ImportSpec).Comment == nil -} - -type posSpan struct { - Start token.Pos - End token.Pos -} - -// sortSpecs sorts the import specs within each import decl. -// It may mutate the token.File. -func sortSpecs(localPrefix string, tokFile *token.File, f *ast.File, specs []ast.Spec) []ast.Spec { - // Can't short-circuit here even if specs are already sorted, - // since they might yet need deduplication. - // A lone import, however, may be safely ignored. - if len(specs) <= 1 { - return specs - } - - // Record positions for specs. - pos := make([]posSpan, len(specs)) - for i, s := range specs { - pos[i] = posSpan{s.Pos(), s.End()} - } - - // Identify comments in this range. - // Any comment from pos[0].Start to the final line counts. - lastLine := tokFile.Line(pos[len(pos)-1].End) - cstart := len(f.Comments) - cend := len(f.Comments) - for i, g := range f.Comments { - if g.Pos() < pos[0].Start { - continue - } - if i < cstart { - cstart = i - } - if tokFile.Line(g.End()) > lastLine { - cend = i - break - } - } - comments := f.Comments[cstart:cend] - - // Assign each comment to the import spec preceding it. - importComment := map[*ast.ImportSpec][]*ast.CommentGroup{} - specIndex := 0 - for _, g := range comments { - for specIndex+1 < len(specs) && pos[specIndex+1].Start <= g.Pos() { - specIndex++ - } - s := specs[specIndex].(*ast.ImportSpec) - importComment[s] = append(importComment[s], g) - } - - // Sort the import specs by import path. - // Remove duplicates, when possible without data loss. - // Reassign the import paths to have the same position sequence. - // Reassign each comment to abut the end of its spec. - // Sort the comments by new position. - sort.Sort(byImportSpec{localPrefix, specs}) - - // Dedup. Thanks to our sorting, we can just consider - // adjacent pairs of imports. - deduped := specs[:0] - for i, s := range specs { - if i == len(specs)-1 || !collapse(s, specs[i+1]) { - deduped = append(deduped, s) - } else { - p := s.Pos() - tokFile.MergeLine(tokFile.Line(p)) // has side effects! - } - } - specs = deduped - - // Fix up comment positions - for i, s := range specs { - s := s.(*ast.ImportSpec) - if s.Name != nil { - s.Name.NamePos = pos[i].Start - } - s.Path.ValuePos = pos[i].Start - s.EndPos = pos[i].End - nextSpecPos := pos[i].End - - for _, g := range importComment[s] { - for _, c := range g.List { - c.Slash = pos[i].End - nextSpecPos = c.End() - } - } - if i < len(specs)-1 { - pos[i+1].Start = nextSpecPos - pos[i+1].End = nextSpecPos - } - } - - sort.Sort(byCommentPos(comments)) - - // Fixup comments can insert blank lines, because import specs are on different lines. - // We remove those blank lines here by merging import spec to the first import spec line. - firstSpecLine := tokFile.Line(specs[0].Pos()) - for _, s := range specs[1:] { - p := s.Pos() - line := tokFile.Line(p) - for previousLine := line - 1; previousLine >= firstSpecLine; { - // MergeLine can panic. Avoid the panic at the cost of not removing the blank line - // golang/go#50329 - if previousLine > 0 && previousLine < tokFile.LineCount() { - tokFile.MergeLine(previousLine) // has side effects! - previousLine-- - } else { - // try to gather some data to diagnose how this could happen - req := "Please report what the imports section of your go file looked like." - log.Printf("panic avoided: first:%d line:%d previous:%d max:%d. %s", - firstSpecLine, line, previousLine, tokFile.LineCount(), req) - } - } - } - return specs -} - -type byImportSpec struct { - localPrefix string - specs []ast.Spec // slice of *ast.ImportSpec -} - -func (x byImportSpec) Len() int { return len(x.specs) } -func (x byImportSpec) Swap(i, j int) { x.specs[i], x.specs[j] = x.specs[j], x.specs[i] } -func (x byImportSpec) Less(i, j int) bool { - ipath := importPath(x.specs[i]) - jpath := importPath(x.specs[j]) - - igroup := importGroup(x.localPrefix, ipath) - jgroup := importGroup(x.localPrefix, jpath) - if igroup != jgroup { - return igroup < jgroup - } - - if ipath != jpath { - return ipath < jpath - } - iname := importName(x.specs[i]) - jname := importName(x.specs[j]) - - if iname != jname { - return iname < jname - } - return importComment(x.specs[i]) < importComment(x.specs[j]) -} - -type byCommentPos []*ast.CommentGroup - -func (x byCommentPos) Len() int { return len(x) } -func (x byCommentPos) Swap(i, j int) { x[i], x[j] = x[j], x[i] } -func (x byCommentPos) Less(i, j int) bool { return x[i].Pos() < x[j].Pos() } diff --git a/vendor/golang.org/x/tools/internal/imports/zstdlib.go b/vendor/golang.org/x/tools/internal/imports/zstdlib.go deleted file mode 100644 index 9f992c2bec..0000000000 --- a/vendor/golang.org/x/tools/internal/imports/zstdlib.go +++ /dev/null @@ -1,11345 +0,0 @@ -// Copyright 2022 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Code generated by mkstdlib.go. DO NOT EDIT. - -package imports - -var stdlib = map[string][]string{ - "archive/tar": { - "ErrFieldTooLong", - "ErrHeader", - "ErrInsecurePath", - "ErrWriteAfterClose", - "ErrWriteTooLong", - "FileInfoHeader", - "Format", - "FormatGNU", - "FormatPAX", - "FormatUSTAR", - "FormatUnknown", - "Header", - "NewReader", - "NewWriter", - "Reader", - "TypeBlock", - "TypeChar", - "TypeCont", - "TypeDir", - "TypeFifo", - "TypeGNULongLink", - "TypeGNULongName", - "TypeGNUSparse", - "TypeLink", - "TypeReg", - "TypeRegA", - "TypeSymlink", - "TypeXGlobalHeader", - "TypeXHeader", - "Writer", - }, - "archive/zip": { - "Compressor", - "Decompressor", - "Deflate", - "ErrAlgorithm", - "ErrChecksum", - "ErrFormat", - "ErrInsecurePath", - "File", - "FileHeader", - "FileInfoHeader", - "NewReader", - "NewWriter", - "OpenReader", - "ReadCloser", - "Reader", - "RegisterCompressor", - "RegisterDecompressor", - "Store", - "Writer", - }, - "bufio": { - "ErrAdvanceTooFar", - "ErrBadReadCount", - "ErrBufferFull", - "ErrFinalToken", - "ErrInvalidUnreadByte", - "ErrInvalidUnreadRune", - "ErrNegativeAdvance", - "ErrNegativeCount", - "ErrTooLong", - "MaxScanTokenSize", - "NewReadWriter", - "NewReader", - "NewReaderSize", - "NewScanner", - "NewWriter", - "NewWriterSize", - "ReadWriter", - "Reader", - "ScanBytes", - "ScanLines", - "ScanRunes", - "ScanWords", - "Scanner", - "SplitFunc", - "Writer", - }, - "bytes": { - "Buffer", - "Clone", - "Compare", - "Contains", - "ContainsAny", - "ContainsFunc", - "ContainsRune", - "Count", - "Cut", - "CutPrefix", - "CutSuffix", - "Equal", - "EqualFold", - "ErrTooLarge", - "Fields", - "FieldsFunc", - "HasPrefix", - "HasSuffix", - "Index", - "IndexAny", - "IndexByte", - "IndexFunc", - "IndexRune", - "Join", - "LastIndex", - "LastIndexAny", - "LastIndexByte", - "LastIndexFunc", - "Map", - "MinRead", - "NewBuffer", - "NewBufferString", - "NewReader", - "Reader", - "Repeat", - "Replace", - "ReplaceAll", - "Runes", - "Split", - "SplitAfter", - "SplitAfterN", - "SplitN", - "Title", - "ToLower", - "ToLowerSpecial", - "ToTitle", - "ToTitleSpecial", - "ToUpper", - "ToUpperSpecial", - "ToValidUTF8", - "Trim", - "TrimFunc", - "TrimLeft", - "TrimLeftFunc", - "TrimPrefix", - "TrimRight", - "TrimRightFunc", - "TrimSpace", - "TrimSuffix", - }, - "cmp": { - "Compare", - "Less", - "Ordered", - }, - "compress/bzip2": { - "NewReader", - "StructuralError", - }, - "compress/flate": { - "BestCompression", - "BestSpeed", - "CorruptInputError", - "DefaultCompression", - "HuffmanOnly", - "InternalError", - "NewReader", - "NewReaderDict", - "NewWriter", - "NewWriterDict", - "NoCompression", - "ReadError", - "Reader", - "Resetter", - "WriteError", - "Writer", - }, - "compress/gzip": { - "BestCompression", - "BestSpeed", - "DefaultCompression", - "ErrChecksum", - "ErrHeader", - "Header", - "HuffmanOnly", - "NewReader", - "NewWriter", - "NewWriterLevel", - "NoCompression", - "Reader", - "Writer", - }, - "compress/lzw": { - "LSB", - "MSB", - "NewReader", - "NewWriter", - "Order", - "Reader", - "Writer", - }, - "compress/zlib": { - "BestCompression", - "BestSpeed", - "DefaultCompression", - "ErrChecksum", - "ErrDictionary", - "ErrHeader", - "HuffmanOnly", - "NewReader", - "NewReaderDict", - "NewWriter", - "NewWriterLevel", - "NewWriterLevelDict", - "NoCompression", - "Resetter", - "Writer", - }, - "container/heap": { - "Fix", - "Init", - "Interface", - "Pop", - "Push", - "Remove", - }, - "container/list": { - "Element", - "List", - "New", - }, - "container/ring": { - "New", - "Ring", - }, - "context": { - "AfterFunc", - "Background", - "CancelCauseFunc", - "CancelFunc", - "Canceled", - "Cause", - "Context", - "DeadlineExceeded", - "TODO", - "WithCancel", - "WithCancelCause", - "WithDeadline", - "WithDeadlineCause", - "WithTimeout", - "WithTimeoutCause", - "WithValue", - "WithoutCancel", - }, - "crypto": { - "BLAKE2b_256", - "BLAKE2b_384", - "BLAKE2b_512", - "BLAKE2s_256", - "Decrypter", - "DecrypterOpts", - "Hash", - "MD4", - "MD5", - "MD5SHA1", - "PrivateKey", - "PublicKey", - "RIPEMD160", - "RegisterHash", - "SHA1", - "SHA224", - "SHA256", - "SHA384", - "SHA3_224", - "SHA3_256", - "SHA3_384", - "SHA3_512", - "SHA512", - "SHA512_224", - "SHA512_256", - "Signer", - "SignerOpts", - }, - "crypto/aes": { - "BlockSize", - "KeySizeError", - "NewCipher", - }, - "crypto/cipher": { - "AEAD", - "Block", - "BlockMode", - "NewCBCDecrypter", - "NewCBCEncrypter", - "NewCFBDecrypter", - "NewCFBEncrypter", - "NewCTR", - "NewGCM", - "NewGCMWithNonceSize", - "NewGCMWithTagSize", - "NewOFB", - "Stream", - "StreamReader", - "StreamWriter", - }, - "crypto/des": { - "BlockSize", - "KeySizeError", - "NewCipher", - "NewTripleDESCipher", - }, - "crypto/dsa": { - "ErrInvalidPublicKey", - "GenerateKey", - "GenerateParameters", - "L1024N160", - "L2048N224", - "L2048N256", - "L3072N256", - "ParameterSizes", - "Parameters", - "PrivateKey", - "PublicKey", - "Sign", - "Verify", - }, - "crypto/ecdh": { - "Curve", - "P256", - "P384", - "P521", - "PrivateKey", - "PublicKey", - "X25519", - }, - "crypto/ecdsa": { - "GenerateKey", - "PrivateKey", - "PublicKey", - "Sign", - "SignASN1", - "Verify", - "VerifyASN1", - }, - "crypto/ed25519": { - "GenerateKey", - "NewKeyFromSeed", - "Options", - "PrivateKey", - "PrivateKeySize", - "PublicKey", - "PublicKeySize", - "SeedSize", - "Sign", - "SignatureSize", - "Verify", - "VerifyWithOptions", - }, - "crypto/elliptic": { - "Curve", - "CurveParams", - "GenerateKey", - "Marshal", - "MarshalCompressed", - "P224", - "P256", - "P384", - "P521", - "Unmarshal", - "UnmarshalCompressed", - }, - "crypto/hmac": { - "Equal", - "New", - }, - "crypto/md5": { - "BlockSize", - "New", - "Size", - "Sum", - }, - "crypto/rand": { - "Int", - "Prime", - "Read", - "Reader", - }, - "crypto/rc4": { - "Cipher", - "KeySizeError", - "NewCipher", - }, - "crypto/rsa": { - "CRTValue", - "DecryptOAEP", - "DecryptPKCS1v15", - "DecryptPKCS1v15SessionKey", - "EncryptOAEP", - "EncryptPKCS1v15", - "ErrDecryption", - "ErrMessageTooLong", - "ErrVerification", - "GenerateKey", - "GenerateMultiPrimeKey", - "OAEPOptions", - "PKCS1v15DecryptOptions", - "PSSOptions", - "PSSSaltLengthAuto", - "PSSSaltLengthEqualsHash", - "PrecomputedValues", - "PrivateKey", - "PublicKey", - "SignPKCS1v15", - "SignPSS", - "VerifyPKCS1v15", - "VerifyPSS", - }, - "crypto/sha1": { - "BlockSize", - "New", - "Size", - "Sum", - }, - "crypto/sha256": { - "BlockSize", - "New", - "New224", - "Size", - "Size224", - "Sum224", - "Sum256", - }, - "crypto/sha512": { - "BlockSize", - "New", - "New384", - "New512_224", - "New512_256", - "Size", - "Size224", - "Size256", - "Size384", - "Sum384", - "Sum512", - "Sum512_224", - "Sum512_256", - }, - "crypto/subtle": { - "ConstantTimeByteEq", - "ConstantTimeCompare", - "ConstantTimeCopy", - "ConstantTimeEq", - "ConstantTimeLessOrEq", - "ConstantTimeSelect", - "XORBytes", - }, - "crypto/tls": { - "AlertError", - "Certificate", - "CertificateRequestInfo", - "CertificateVerificationError", - "CipherSuite", - "CipherSuiteName", - "CipherSuites", - "Client", - "ClientAuthType", - "ClientHelloInfo", - "ClientSessionCache", - "ClientSessionState", - "Config", - "Conn", - "ConnectionState", - "CurveID", - "CurveP256", - "CurveP384", - "CurveP521", - "Dial", - "DialWithDialer", - "Dialer", - "ECDSAWithP256AndSHA256", - "ECDSAWithP384AndSHA384", - "ECDSAWithP521AndSHA512", - "ECDSAWithSHA1", - "Ed25519", - "InsecureCipherSuites", - "Listen", - "LoadX509KeyPair", - "NewLRUClientSessionCache", - "NewListener", - "NewResumptionState", - "NoClientCert", - "PKCS1WithSHA1", - "PKCS1WithSHA256", - "PKCS1WithSHA384", - "PKCS1WithSHA512", - "PSSWithSHA256", - "PSSWithSHA384", - "PSSWithSHA512", - "ParseSessionState", - "QUICClient", - "QUICConfig", - "QUICConn", - "QUICEncryptionLevel", - "QUICEncryptionLevelApplication", - "QUICEncryptionLevelEarly", - "QUICEncryptionLevelHandshake", - "QUICEncryptionLevelInitial", - "QUICEvent", - "QUICEventKind", - "QUICHandshakeDone", - "QUICNoEvent", - "QUICRejectedEarlyData", - "QUICServer", - "QUICSessionTicketOptions", - "QUICSetReadSecret", - "QUICSetWriteSecret", - "QUICTransportParameters", - "QUICTransportParametersRequired", - "QUICWriteData", - "RecordHeaderError", - "RenegotiateFreelyAsClient", - "RenegotiateNever", - "RenegotiateOnceAsClient", - "RenegotiationSupport", - "RequestClientCert", - "RequireAndVerifyClientCert", - "RequireAnyClientCert", - "Server", - "SessionState", - "SignatureScheme", - "TLS_AES_128_GCM_SHA256", - "TLS_AES_256_GCM_SHA384", - "TLS_CHACHA20_POLY1305_SHA256", - "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA", - "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256", - "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256", - "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA", - "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384", - "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305", - "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256", - "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA", - "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA", - "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA", - "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256", - "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", - "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA", - "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384", - "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305", - "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256", - "TLS_ECDHE_RSA_WITH_RC4_128_SHA", - "TLS_FALLBACK_SCSV", - "TLS_RSA_WITH_3DES_EDE_CBC_SHA", - "TLS_RSA_WITH_AES_128_CBC_SHA", - "TLS_RSA_WITH_AES_128_CBC_SHA256", - "TLS_RSA_WITH_AES_128_GCM_SHA256", - "TLS_RSA_WITH_AES_256_CBC_SHA", - "TLS_RSA_WITH_AES_256_GCM_SHA384", - "TLS_RSA_WITH_RC4_128_SHA", - "VerifyClientCertIfGiven", - "VersionName", - "VersionSSL30", - "VersionTLS10", - "VersionTLS11", - "VersionTLS12", - "VersionTLS13", - "X25519", - "X509KeyPair", - }, - "crypto/x509": { - "CANotAuthorizedForExtKeyUsage", - "CANotAuthorizedForThisName", - "CertPool", - "Certificate", - "CertificateInvalidError", - "CertificateRequest", - "ConstraintViolationError", - "CreateCertificate", - "CreateCertificateRequest", - "CreateRevocationList", - "DSA", - "DSAWithSHA1", - "DSAWithSHA256", - "DecryptPEMBlock", - "ECDSA", - "ECDSAWithSHA1", - "ECDSAWithSHA256", - "ECDSAWithSHA384", - "ECDSAWithSHA512", - "Ed25519", - "EncryptPEMBlock", - "ErrUnsupportedAlgorithm", - "Expired", - "ExtKeyUsage", - "ExtKeyUsageAny", - "ExtKeyUsageClientAuth", - "ExtKeyUsageCodeSigning", - "ExtKeyUsageEmailProtection", - "ExtKeyUsageIPSECEndSystem", - "ExtKeyUsageIPSECTunnel", - "ExtKeyUsageIPSECUser", - "ExtKeyUsageMicrosoftCommercialCodeSigning", - "ExtKeyUsageMicrosoftKernelCodeSigning", - "ExtKeyUsageMicrosoftServerGatedCrypto", - "ExtKeyUsageNetscapeServerGatedCrypto", - "ExtKeyUsageOCSPSigning", - "ExtKeyUsageServerAuth", - "ExtKeyUsageTimeStamping", - "HostnameError", - "IncompatibleUsage", - "IncorrectPasswordError", - "InsecureAlgorithmError", - "InvalidReason", - "IsEncryptedPEMBlock", - "KeyUsage", - "KeyUsageCRLSign", - "KeyUsageCertSign", - "KeyUsageContentCommitment", - "KeyUsageDataEncipherment", - "KeyUsageDecipherOnly", - "KeyUsageDigitalSignature", - "KeyUsageEncipherOnly", - "KeyUsageKeyAgreement", - "KeyUsageKeyEncipherment", - "MD2WithRSA", - "MD5WithRSA", - "MarshalECPrivateKey", - "MarshalPKCS1PrivateKey", - "MarshalPKCS1PublicKey", - "MarshalPKCS8PrivateKey", - "MarshalPKIXPublicKey", - "NameConstraintsWithoutSANs", - "NameMismatch", - "NewCertPool", - "NotAuthorizedToSign", - "PEMCipher", - "PEMCipher3DES", - "PEMCipherAES128", - "PEMCipherAES192", - "PEMCipherAES256", - "PEMCipherDES", - "ParseCRL", - "ParseCertificate", - "ParseCertificateRequest", - "ParseCertificates", - "ParseDERCRL", - "ParseECPrivateKey", - "ParsePKCS1PrivateKey", - "ParsePKCS1PublicKey", - "ParsePKCS8PrivateKey", - "ParsePKIXPublicKey", - "ParseRevocationList", - "PublicKeyAlgorithm", - "PureEd25519", - "RSA", - "RevocationList", - "RevocationListEntry", - "SHA1WithRSA", - "SHA256WithRSA", - "SHA256WithRSAPSS", - "SHA384WithRSA", - "SHA384WithRSAPSS", - "SHA512WithRSA", - "SHA512WithRSAPSS", - "SetFallbackRoots", - "SignatureAlgorithm", - "SystemCertPool", - "SystemRootsError", - "TooManyConstraints", - "TooManyIntermediates", - "UnconstrainedName", - "UnhandledCriticalExtension", - "UnknownAuthorityError", - "UnknownPublicKeyAlgorithm", - "UnknownSignatureAlgorithm", - "VerifyOptions", - }, - "crypto/x509/pkix": { - "AlgorithmIdentifier", - "AttributeTypeAndValue", - "AttributeTypeAndValueSET", - "CertificateList", - "Extension", - "Name", - "RDNSequence", - "RelativeDistinguishedNameSET", - "RevokedCertificate", - "TBSCertificateList", - }, - "database/sql": { - "ColumnType", - "Conn", - "DB", - "DBStats", - "Drivers", - "ErrConnDone", - "ErrNoRows", - "ErrTxDone", - "IsolationLevel", - "LevelDefault", - "LevelLinearizable", - "LevelReadCommitted", - "LevelReadUncommitted", - "LevelRepeatableRead", - "LevelSerializable", - "LevelSnapshot", - "LevelWriteCommitted", - "Named", - "NamedArg", - "NullBool", - "NullByte", - "NullFloat64", - "NullInt16", - "NullInt32", - "NullInt64", - "NullString", - "NullTime", - "Open", - "OpenDB", - "Out", - "RawBytes", - "Register", - "Result", - "Row", - "Rows", - "Scanner", - "Stmt", - "Tx", - "TxOptions", - }, - "database/sql/driver": { - "Bool", - "ColumnConverter", - "Conn", - "ConnBeginTx", - "ConnPrepareContext", - "Connector", - "DefaultParameterConverter", - "Driver", - "DriverContext", - "ErrBadConn", - "ErrRemoveArgument", - "ErrSkip", - "Execer", - "ExecerContext", - "Int32", - "IsScanValue", - "IsValue", - "IsolationLevel", - "NamedValue", - "NamedValueChecker", - "NotNull", - "Null", - "Pinger", - "Queryer", - "QueryerContext", - "Result", - "ResultNoRows", - "Rows", - "RowsAffected", - "RowsColumnTypeDatabaseTypeName", - "RowsColumnTypeLength", - "RowsColumnTypeNullable", - "RowsColumnTypePrecisionScale", - "RowsColumnTypeScanType", - "RowsNextResultSet", - "SessionResetter", - "Stmt", - "StmtExecContext", - "StmtQueryContext", - "String", - "Tx", - "TxOptions", - "Validator", - "Value", - "ValueConverter", - "Valuer", - }, - "debug/buildinfo": { - "BuildInfo", - "Read", - "ReadFile", - }, - "debug/dwarf": { - "AddrType", - "ArrayType", - "Attr", - "AttrAbstractOrigin", - "AttrAccessibility", - "AttrAddrBase", - "AttrAddrClass", - "AttrAlignment", - "AttrAllocated", - "AttrArtificial", - "AttrAssociated", - "AttrBaseTypes", - "AttrBinaryScale", - "AttrBitOffset", - "AttrBitSize", - "AttrByteSize", - "AttrCallAllCalls", - "AttrCallAllSourceCalls", - "AttrCallAllTailCalls", - "AttrCallColumn", - "AttrCallDataLocation", - "AttrCallDataValue", - "AttrCallFile", - "AttrCallLine", - "AttrCallOrigin", - "AttrCallPC", - "AttrCallParameter", - "AttrCallReturnPC", - "AttrCallTailCall", - "AttrCallTarget", - "AttrCallTargetClobbered", - "AttrCallValue", - "AttrCalling", - "AttrCommonRef", - "AttrCompDir", - "AttrConstExpr", - "AttrConstValue", - "AttrContainingType", - "AttrCount", - "AttrDataBitOffset", - "AttrDataLocation", - "AttrDataMemberLoc", - "AttrDecimalScale", - "AttrDecimalSign", - "AttrDeclColumn", - "AttrDeclFile", - "AttrDeclLine", - "AttrDeclaration", - "AttrDefaultValue", - "AttrDefaulted", - "AttrDeleted", - "AttrDescription", - "AttrDigitCount", - "AttrDiscr", - "AttrDiscrList", - "AttrDiscrValue", - "AttrDwoName", - "AttrElemental", - "AttrEncoding", - "AttrEndianity", - "AttrEntrypc", - "AttrEnumClass", - "AttrExplicit", - "AttrExportSymbols", - "AttrExtension", - "AttrExternal", - "AttrFrameBase", - "AttrFriend", - "AttrHighpc", - "AttrIdentifierCase", - "AttrImport", - "AttrInline", - "AttrIsOptional", - "AttrLanguage", - "AttrLinkageName", - "AttrLocation", - "AttrLoclistsBase", - "AttrLowerBound", - "AttrLowpc", - "AttrMacroInfo", - "AttrMacros", - "AttrMainSubprogram", - "AttrMutable", - "AttrName", - "AttrNamelistItem", - "AttrNoreturn", - "AttrObjectPointer", - "AttrOrdering", - "AttrPictureString", - "AttrPriority", - "AttrProducer", - "AttrPrototyped", - "AttrPure", - "AttrRanges", - "AttrRank", - "AttrRecursive", - "AttrReference", - "AttrReturnAddr", - "AttrRnglistsBase", - "AttrRvalueReference", - "AttrSegment", - "AttrSibling", - "AttrSignature", - "AttrSmall", - "AttrSpecification", - "AttrStartScope", - "AttrStaticLink", - "AttrStmtList", - "AttrStrOffsetsBase", - "AttrStride", - "AttrStrideSize", - "AttrStringLength", - "AttrStringLengthBitSize", - "AttrStringLengthByteSize", - "AttrThreadsScaled", - "AttrTrampoline", - "AttrType", - "AttrUpperBound", - "AttrUseLocation", - "AttrUseUTF8", - "AttrVarParam", - "AttrVirtuality", - "AttrVisibility", - "AttrVtableElemLoc", - "BasicType", - "BoolType", - "CharType", - "Class", - "ClassAddrPtr", - "ClassAddress", - "ClassBlock", - "ClassConstant", - "ClassExprLoc", - "ClassFlag", - "ClassLinePtr", - "ClassLocList", - "ClassLocListPtr", - "ClassMacPtr", - "ClassRangeListPtr", - "ClassReference", - "ClassReferenceAlt", - "ClassReferenceSig", - "ClassRngList", - "ClassRngListsPtr", - "ClassStrOffsetsPtr", - "ClassString", - "ClassStringAlt", - "ClassUnknown", - "CommonType", - "ComplexType", - "Data", - "DecodeError", - "DotDotDotType", - "Entry", - "EnumType", - "EnumValue", - "ErrUnknownPC", - "Field", - "FloatType", - "FuncType", - "IntType", - "LineEntry", - "LineFile", - "LineReader", - "LineReaderPos", - "New", - "Offset", - "PtrType", - "QualType", - "Reader", - "StructField", - "StructType", - "Tag", - "TagAccessDeclaration", - "TagArrayType", - "TagAtomicType", - "TagBaseType", - "TagCallSite", - "TagCallSiteParameter", - "TagCatchDwarfBlock", - "TagClassType", - "TagCoarrayType", - "TagCommonDwarfBlock", - "TagCommonInclusion", - "TagCompileUnit", - "TagCondition", - "TagConstType", - "TagConstant", - "TagDwarfProcedure", - "TagDynamicType", - "TagEntryPoint", - "TagEnumerationType", - "TagEnumerator", - "TagFileType", - "TagFormalParameter", - "TagFriend", - "TagGenericSubrange", - "TagImmutableType", - "TagImportedDeclaration", - "TagImportedModule", - "TagImportedUnit", - "TagInheritance", - "TagInlinedSubroutine", - "TagInterfaceType", - "TagLabel", - "TagLexDwarfBlock", - "TagMember", - "TagModule", - "TagMutableType", - "TagNamelist", - "TagNamelistItem", - "TagNamespace", - "TagPackedType", - "TagPartialUnit", - "TagPointerType", - "TagPtrToMemberType", - "TagReferenceType", - "TagRestrictType", - "TagRvalueReferenceType", - "TagSetType", - "TagSharedType", - "TagSkeletonUnit", - "TagStringType", - "TagStructType", - "TagSubprogram", - "TagSubrangeType", - "TagSubroutineType", - "TagTemplateAlias", - "TagTemplateTypeParameter", - "TagTemplateValueParameter", - "TagThrownType", - "TagTryDwarfBlock", - "TagTypeUnit", - "TagTypedef", - "TagUnionType", - "TagUnspecifiedParameters", - "TagUnspecifiedType", - "TagVariable", - "TagVariant", - "TagVariantPart", - "TagVolatileType", - "TagWithStmt", - "Type", - "TypedefType", - "UcharType", - "UintType", - "UnspecifiedType", - "UnsupportedType", - "VoidType", - }, - "debug/elf": { - "ARM_MAGIC_TRAMP_NUMBER", - "COMPRESS_HIOS", - "COMPRESS_HIPROC", - "COMPRESS_LOOS", - "COMPRESS_LOPROC", - "COMPRESS_ZLIB", - "COMPRESS_ZSTD", - "Chdr32", - "Chdr64", - "Class", - "CompressionType", - "DF_1_CONFALT", - "DF_1_DIRECT", - "DF_1_DISPRELDNE", - "DF_1_DISPRELPND", - "DF_1_EDITED", - "DF_1_ENDFILTEE", - "DF_1_GLOBAL", - "DF_1_GLOBAUDIT", - "DF_1_GROUP", - "DF_1_IGNMULDEF", - "DF_1_INITFIRST", - "DF_1_INTERPOSE", - "DF_1_KMOD", - "DF_1_LOADFLTR", - "DF_1_NOCOMMON", - "DF_1_NODEFLIB", - "DF_1_NODELETE", - "DF_1_NODIRECT", - "DF_1_NODUMP", - "DF_1_NOHDR", - "DF_1_NOKSYMS", - "DF_1_NOOPEN", - "DF_1_NORELOC", - "DF_1_NOW", - "DF_1_ORIGIN", - "DF_1_PIE", - "DF_1_SINGLETON", - "DF_1_STUB", - "DF_1_SYMINTPOSE", - "DF_1_TRANS", - "DF_1_WEAKFILTER", - "DF_BIND_NOW", - "DF_ORIGIN", - "DF_STATIC_TLS", - "DF_SYMBOLIC", - "DF_TEXTREL", - "DT_ADDRRNGHI", - "DT_ADDRRNGLO", - "DT_AUDIT", - "DT_AUXILIARY", - "DT_BIND_NOW", - "DT_CHECKSUM", - "DT_CONFIG", - "DT_DEBUG", - "DT_DEPAUDIT", - "DT_ENCODING", - "DT_FEATURE", - "DT_FILTER", - "DT_FINI", - "DT_FINI_ARRAY", - "DT_FINI_ARRAYSZ", - "DT_FLAGS", - "DT_FLAGS_1", - "DT_GNU_CONFLICT", - "DT_GNU_CONFLICTSZ", - "DT_GNU_HASH", - "DT_GNU_LIBLIST", - "DT_GNU_LIBLISTSZ", - "DT_GNU_PRELINKED", - "DT_HASH", - "DT_HIOS", - "DT_HIPROC", - "DT_INIT", - "DT_INIT_ARRAY", - "DT_INIT_ARRAYSZ", - "DT_JMPREL", - "DT_LOOS", - "DT_LOPROC", - "DT_MIPS_AUX_DYNAMIC", - "DT_MIPS_BASE_ADDRESS", - "DT_MIPS_COMPACT_SIZE", - "DT_MIPS_CONFLICT", - "DT_MIPS_CONFLICTNO", - "DT_MIPS_CXX_FLAGS", - "DT_MIPS_DELTA_CLASS", - "DT_MIPS_DELTA_CLASSSYM", - "DT_MIPS_DELTA_CLASSSYM_NO", - "DT_MIPS_DELTA_CLASS_NO", - "DT_MIPS_DELTA_INSTANCE", - "DT_MIPS_DELTA_INSTANCE_NO", - "DT_MIPS_DELTA_RELOC", - "DT_MIPS_DELTA_RELOC_NO", - "DT_MIPS_DELTA_SYM", - "DT_MIPS_DELTA_SYM_NO", - "DT_MIPS_DYNSTR_ALIGN", - "DT_MIPS_FLAGS", - "DT_MIPS_GOTSYM", - "DT_MIPS_GP_VALUE", - "DT_MIPS_HIDDEN_GOTIDX", - "DT_MIPS_HIPAGENO", - "DT_MIPS_ICHECKSUM", - "DT_MIPS_INTERFACE", - "DT_MIPS_INTERFACE_SIZE", - "DT_MIPS_IVERSION", - "DT_MIPS_LIBLIST", - "DT_MIPS_LIBLISTNO", - "DT_MIPS_LOCALPAGE_GOTIDX", - "DT_MIPS_LOCAL_GOTIDX", - "DT_MIPS_LOCAL_GOTNO", - "DT_MIPS_MSYM", - "DT_MIPS_OPTIONS", - "DT_MIPS_PERF_SUFFIX", - "DT_MIPS_PIXIE_INIT", - "DT_MIPS_PLTGOT", - "DT_MIPS_PROTECTED_GOTIDX", - "DT_MIPS_RLD_MAP", - "DT_MIPS_RLD_MAP_REL", - "DT_MIPS_RLD_TEXT_RESOLVE_ADDR", - "DT_MIPS_RLD_VERSION", - "DT_MIPS_RWPLT", - "DT_MIPS_SYMBOL_LIB", - "DT_MIPS_SYMTABNO", - "DT_MIPS_TIME_STAMP", - "DT_MIPS_UNREFEXTNO", - "DT_MOVEENT", - "DT_MOVESZ", - "DT_MOVETAB", - "DT_NEEDED", - "DT_NULL", - "DT_PLTGOT", - "DT_PLTPAD", - "DT_PLTPADSZ", - "DT_PLTREL", - "DT_PLTRELSZ", - "DT_POSFLAG_1", - "DT_PPC64_GLINK", - "DT_PPC64_OPD", - "DT_PPC64_OPDSZ", - "DT_PPC64_OPT", - "DT_PPC_GOT", - "DT_PPC_OPT", - "DT_PREINIT_ARRAY", - "DT_PREINIT_ARRAYSZ", - "DT_REL", - "DT_RELA", - "DT_RELACOUNT", - "DT_RELAENT", - "DT_RELASZ", - "DT_RELCOUNT", - "DT_RELENT", - "DT_RELSZ", - "DT_RPATH", - "DT_RUNPATH", - "DT_SONAME", - "DT_SPARC_REGISTER", - "DT_STRSZ", - "DT_STRTAB", - "DT_SYMBOLIC", - "DT_SYMENT", - "DT_SYMINENT", - "DT_SYMINFO", - "DT_SYMINSZ", - "DT_SYMTAB", - "DT_SYMTAB_SHNDX", - "DT_TEXTREL", - "DT_TLSDESC_GOT", - "DT_TLSDESC_PLT", - "DT_USED", - "DT_VALRNGHI", - "DT_VALRNGLO", - "DT_VERDEF", - "DT_VERDEFNUM", - "DT_VERNEED", - "DT_VERNEEDNUM", - "DT_VERSYM", - "Data", - "Dyn32", - "Dyn64", - "DynFlag", - "DynFlag1", - "DynTag", - "EI_ABIVERSION", - "EI_CLASS", - "EI_DATA", - "EI_NIDENT", - "EI_OSABI", - "EI_PAD", - "EI_VERSION", - "ELFCLASS32", - "ELFCLASS64", - "ELFCLASSNONE", - "ELFDATA2LSB", - "ELFDATA2MSB", - "ELFDATANONE", - "ELFMAG", - "ELFOSABI_86OPEN", - "ELFOSABI_AIX", - "ELFOSABI_ARM", - "ELFOSABI_AROS", - "ELFOSABI_CLOUDABI", - "ELFOSABI_FENIXOS", - "ELFOSABI_FREEBSD", - "ELFOSABI_HPUX", - "ELFOSABI_HURD", - "ELFOSABI_IRIX", - "ELFOSABI_LINUX", - "ELFOSABI_MODESTO", - "ELFOSABI_NETBSD", - "ELFOSABI_NONE", - "ELFOSABI_NSK", - "ELFOSABI_OPENBSD", - "ELFOSABI_OPENVMS", - "ELFOSABI_SOLARIS", - "ELFOSABI_STANDALONE", - "ELFOSABI_TRU64", - "EM_386", - "EM_486", - "EM_56800EX", - "EM_68HC05", - "EM_68HC08", - "EM_68HC11", - "EM_68HC12", - "EM_68HC16", - "EM_68K", - "EM_78KOR", - "EM_8051", - "EM_860", - "EM_88K", - "EM_960", - "EM_AARCH64", - "EM_ALPHA", - "EM_ALPHA_STD", - "EM_ALTERA_NIOS2", - "EM_AMDGPU", - "EM_ARC", - "EM_ARCA", - "EM_ARC_COMPACT", - "EM_ARC_COMPACT2", - "EM_ARM", - "EM_AVR", - "EM_AVR32", - "EM_BA1", - "EM_BA2", - "EM_BLACKFIN", - "EM_BPF", - "EM_C166", - "EM_CDP", - "EM_CE", - "EM_CLOUDSHIELD", - "EM_COGE", - "EM_COLDFIRE", - "EM_COOL", - "EM_COREA_1ST", - "EM_COREA_2ND", - "EM_CR", - "EM_CR16", - "EM_CRAYNV2", - "EM_CRIS", - "EM_CRX", - "EM_CSR_KALIMBA", - "EM_CUDA", - "EM_CYPRESS_M8C", - "EM_D10V", - "EM_D30V", - "EM_DSP24", - "EM_DSPIC30F", - "EM_DXP", - "EM_ECOG1", - "EM_ECOG16", - "EM_ECOG1X", - "EM_ECOG2", - "EM_ETPU", - "EM_EXCESS", - "EM_F2MC16", - "EM_FIREPATH", - "EM_FR20", - "EM_FR30", - "EM_FT32", - "EM_FX66", - "EM_H8S", - "EM_H8_300", - "EM_H8_300H", - "EM_H8_500", - "EM_HUANY", - "EM_IA_64", - "EM_INTEL205", - "EM_INTEL206", - "EM_INTEL207", - "EM_INTEL208", - "EM_INTEL209", - "EM_IP2K", - "EM_JAVELIN", - "EM_K10M", - "EM_KM32", - "EM_KMX16", - "EM_KMX32", - "EM_KMX8", - "EM_KVARC", - "EM_L10M", - "EM_LANAI", - "EM_LATTICEMICO32", - "EM_LOONGARCH", - "EM_M16C", - "EM_M32", - "EM_M32C", - "EM_M32R", - "EM_MANIK", - "EM_MAX", - "EM_MAXQ30", - "EM_MCHP_PIC", - "EM_MCST_ELBRUS", - "EM_ME16", - "EM_METAG", - "EM_MICROBLAZE", - "EM_MIPS", - "EM_MIPS_RS3_LE", - "EM_MIPS_RS4_BE", - "EM_MIPS_X", - "EM_MMA", - "EM_MMDSP_PLUS", - "EM_MMIX", - "EM_MN10200", - "EM_MN10300", - "EM_MOXIE", - "EM_MSP430", - "EM_NCPU", - "EM_NDR1", - "EM_NDS32", - "EM_NONE", - "EM_NORC", - "EM_NS32K", - "EM_OPEN8", - "EM_OPENRISC", - "EM_PARISC", - "EM_PCP", - "EM_PDP10", - "EM_PDP11", - "EM_PDSP", - "EM_PJ", - "EM_PPC", - "EM_PPC64", - "EM_PRISM", - "EM_QDSP6", - "EM_R32C", - "EM_RCE", - "EM_RH32", - "EM_RISCV", - "EM_RL78", - "EM_RS08", - "EM_RX", - "EM_S370", - "EM_S390", - "EM_SCORE7", - "EM_SEP", - "EM_SE_C17", - "EM_SE_C33", - "EM_SH", - "EM_SHARC", - "EM_SLE9X", - "EM_SNP1K", - "EM_SPARC", - "EM_SPARC32PLUS", - "EM_SPARCV9", - "EM_ST100", - "EM_ST19", - "EM_ST200", - "EM_ST7", - "EM_ST9PLUS", - "EM_STARCORE", - "EM_STM8", - "EM_STXP7X", - "EM_SVX", - "EM_TILE64", - "EM_TILEGX", - "EM_TILEPRO", - "EM_TINYJ", - "EM_TI_ARP32", - "EM_TI_C2000", - "EM_TI_C5500", - "EM_TI_C6000", - "EM_TI_PRU", - "EM_TMM_GPP", - "EM_TPC", - "EM_TRICORE", - "EM_TRIMEDIA", - "EM_TSK3000", - "EM_UNICORE", - "EM_V800", - "EM_V850", - "EM_VAX", - "EM_VIDEOCORE", - "EM_VIDEOCORE3", - "EM_VIDEOCORE5", - "EM_VISIUM", - "EM_VPP500", - "EM_X86_64", - "EM_XCORE", - "EM_XGATE", - "EM_XIMO16", - "EM_XTENSA", - "EM_Z80", - "EM_ZSP", - "ET_CORE", - "ET_DYN", - "ET_EXEC", - "ET_HIOS", - "ET_HIPROC", - "ET_LOOS", - "ET_LOPROC", - "ET_NONE", - "ET_REL", - "EV_CURRENT", - "EV_NONE", - "ErrNoSymbols", - "File", - "FileHeader", - "FormatError", - "Header32", - "Header64", - "ImportedSymbol", - "Machine", - "NT_FPREGSET", - "NT_PRPSINFO", - "NT_PRSTATUS", - "NType", - "NewFile", - "OSABI", - "Open", - "PF_MASKOS", - "PF_MASKPROC", - "PF_R", - "PF_W", - "PF_X", - "PT_AARCH64_ARCHEXT", - "PT_AARCH64_UNWIND", - "PT_ARM_ARCHEXT", - "PT_ARM_EXIDX", - "PT_DYNAMIC", - "PT_GNU_EH_FRAME", - "PT_GNU_MBIND_HI", - "PT_GNU_MBIND_LO", - "PT_GNU_PROPERTY", - "PT_GNU_RELRO", - "PT_GNU_STACK", - "PT_HIOS", - "PT_HIPROC", - "PT_INTERP", - "PT_LOAD", - "PT_LOOS", - "PT_LOPROC", - "PT_MIPS_ABIFLAGS", - "PT_MIPS_OPTIONS", - "PT_MIPS_REGINFO", - "PT_MIPS_RTPROC", - "PT_NOTE", - "PT_NULL", - "PT_OPENBSD_BOOTDATA", - "PT_OPENBSD_RANDOMIZE", - "PT_OPENBSD_WXNEEDED", - "PT_PAX_FLAGS", - "PT_PHDR", - "PT_S390_PGSTE", - "PT_SHLIB", - "PT_SUNWSTACK", - "PT_SUNW_EH_FRAME", - "PT_TLS", - "Prog", - "Prog32", - "Prog64", - "ProgFlag", - "ProgHeader", - "ProgType", - "R_386", - "R_386_16", - "R_386_32", - "R_386_32PLT", - "R_386_8", - "R_386_COPY", - "R_386_GLOB_DAT", - "R_386_GOT32", - "R_386_GOT32X", - "R_386_GOTOFF", - "R_386_GOTPC", - "R_386_IRELATIVE", - "R_386_JMP_SLOT", - "R_386_NONE", - "R_386_PC16", - "R_386_PC32", - "R_386_PC8", - "R_386_PLT32", - "R_386_RELATIVE", - "R_386_SIZE32", - "R_386_TLS_DESC", - "R_386_TLS_DESC_CALL", - "R_386_TLS_DTPMOD32", - "R_386_TLS_DTPOFF32", - "R_386_TLS_GD", - "R_386_TLS_GD_32", - "R_386_TLS_GD_CALL", - "R_386_TLS_GD_POP", - "R_386_TLS_GD_PUSH", - "R_386_TLS_GOTDESC", - "R_386_TLS_GOTIE", - "R_386_TLS_IE", - "R_386_TLS_IE_32", - "R_386_TLS_LDM", - "R_386_TLS_LDM_32", - "R_386_TLS_LDM_CALL", - "R_386_TLS_LDM_POP", - "R_386_TLS_LDM_PUSH", - "R_386_TLS_LDO_32", - "R_386_TLS_LE", - "R_386_TLS_LE_32", - "R_386_TLS_TPOFF", - "R_386_TLS_TPOFF32", - "R_390", - "R_390_12", - "R_390_16", - "R_390_20", - "R_390_32", - "R_390_64", - "R_390_8", - "R_390_COPY", - "R_390_GLOB_DAT", - "R_390_GOT12", - "R_390_GOT16", - "R_390_GOT20", - "R_390_GOT32", - "R_390_GOT64", - "R_390_GOTENT", - "R_390_GOTOFF", - "R_390_GOTOFF16", - "R_390_GOTOFF64", - "R_390_GOTPC", - "R_390_GOTPCDBL", - "R_390_GOTPLT12", - "R_390_GOTPLT16", - "R_390_GOTPLT20", - "R_390_GOTPLT32", - "R_390_GOTPLT64", - "R_390_GOTPLTENT", - "R_390_GOTPLTOFF16", - "R_390_GOTPLTOFF32", - "R_390_GOTPLTOFF64", - "R_390_JMP_SLOT", - "R_390_NONE", - "R_390_PC16", - "R_390_PC16DBL", - "R_390_PC32", - "R_390_PC32DBL", - "R_390_PC64", - "R_390_PLT16DBL", - "R_390_PLT32", - "R_390_PLT32DBL", - "R_390_PLT64", - "R_390_RELATIVE", - "R_390_TLS_DTPMOD", - "R_390_TLS_DTPOFF", - "R_390_TLS_GD32", - "R_390_TLS_GD64", - "R_390_TLS_GDCALL", - "R_390_TLS_GOTIE12", - "R_390_TLS_GOTIE20", - "R_390_TLS_GOTIE32", - "R_390_TLS_GOTIE64", - "R_390_TLS_IE32", - "R_390_TLS_IE64", - "R_390_TLS_IEENT", - "R_390_TLS_LDCALL", - "R_390_TLS_LDM32", - "R_390_TLS_LDM64", - "R_390_TLS_LDO32", - "R_390_TLS_LDO64", - "R_390_TLS_LE32", - "R_390_TLS_LE64", - "R_390_TLS_LOAD", - "R_390_TLS_TPOFF", - "R_AARCH64", - "R_AARCH64_ABS16", - "R_AARCH64_ABS32", - "R_AARCH64_ABS64", - "R_AARCH64_ADD_ABS_LO12_NC", - "R_AARCH64_ADR_GOT_PAGE", - "R_AARCH64_ADR_PREL_LO21", - "R_AARCH64_ADR_PREL_PG_HI21", - "R_AARCH64_ADR_PREL_PG_HI21_NC", - "R_AARCH64_CALL26", - "R_AARCH64_CONDBR19", - "R_AARCH64_COPY", - "R_AARCH64_GLOB_DAT", - "R_AARCH64_GOT_LD_PREL19", - "R_AARCH64_IRELATIVE", - "R_AARCH64_JUMP26", - "R_AARCH64_JUMP_SLOT", - "R_AARCH64_LD64_GOTOFF_LO15", - "R_AARCH64_LD64_GOTPAGE_LO15", - "R_AARCH64_LD64_GOT_LO12_NC", - "R_AARCH64_LDST128_ABS_LO12_NC", - "R_AARCH64_LDST16_ABS_LO12_NC", - "R_AARCH64_LDST32_ABS_LO12_NC", - "R_AARCH64_LDST64_ABS_LO12_NC", - "R_AARCH64_LDST8_ABS_LO12_NC", - "R_AARCH64_LD_PREL_LO19", - "R_AARCH64_MOVW_SABS_G0", - "R_AARCH64_MOVW_SABS_G1", - "R_AARCH64_MOVW_SABS_G2", - "R_AARCH64_MOVW_UABS_G0", - "R_AARCH64_MOVW_UABS_G0_NC", - "R_AARCH64_MOVW_UABS_G1", - "R_AARCH64_MOVW_UABS_G1_NC", - "R_AARCH64_MOVW_UABS_G2", - "R_AARCH64_MOVW_UABS_G2_NC", - "R_AARCH64_MOVW_UABS_G3", - "R_AARCH64_NONE", - "R_AARCH64_NULL", - "R_AARCH64_P32_ABS16", - "R_AARCH64_P32_ABS32", - "R_AARCH64_P32_ADD_ABS_LO12_NC", - "R_AARCH64_P32_ADR_GOT_PAGE", - "R_AARCH64_P32_ADR_PREL_LO21", - "R_AARCH64_P32_ADR_PREL_PG_HI21", - "R_AARCH64_P32_CALL26", - "R_AARCH64_P32_CONDBR19", - "R_AARCH64_P32_COPY", - "R_AARCH64_P32_GLOB_DAT", - "R_AARCH64_P32_GOT_LD_PREL19", - "R_AARCH64_P32_IRELATIVE", - "R_AARCH64_P32_JUMP26", - "R_AARCH64_P32_JUMP_SLOT", - "R_AARCH64_P32_LD32_GOT_LO12_NC", - "R_AARCH64_P32_LDST128_ABS_LO12_NC", - "R_AARCH64_P32_LDST16_ABS_LO12_NC", - "R_AARCH64_P32_LDST32_ABS_LO12_NC", - "R_AARCH64_P32_LDST64_ABS_LO12_NC", - "R_AARCH64_P32_LDST8_ABS_LO12_NC", - "R_AARCH64_P32_LD_PREL_LO19", - "R_AARCH64_P32_MOVW_SABS_G0", - "R_AARCH64_P32_MOVW_UABS_G0", - "R_AARCH64_P32_MOVW_UABS_G0_NC", - "R_AARCH64_P32_MOVW_UABS_G1", - "R_AARCH64_P32_PREL16", - "R_AARCH64_P32_PREL32", - "R_AARCH64_P32_RELATIVE", - "R_AARCH64_P32_TLSDESC", - "R_AARCH64_P32_TLSDESC_ADD_LO12_NC", - "R_AARCH64_P32_TLSDESC_ADR_PAGE21", - "R_AARCH64_P32_TLSDESC_ADR_PREL21", - "R_AARCH64_P32_TLSDESC_CALL", - "R_AARCH64_P32_TLSDESC_LD32_LO12_NC", - "R_AARCH64_P32_TLSDESC_LD_PREL19", - "R_AARCH64_P32_TLSGD_ADD_LO12_NC", - "R_AARCH64_P32_TLSGD_ADR_PAGE21", - "R_AARCH64_P32_TLSIE_ADR_GOTTPREL_PAGE21", - "R_AARCH64_P32_TLSIE_LD32_GOTTPREL_LO12_NC", - "R_AARCH64_P32_TLSIE_LD_GOTTPREL_PREL19", - "R_AARCH64_P32_TLSLE_ADD_TPREL_HI12", - "R_AARCH64_P32_TLSLE_ADD_TPREL_LO12", - "R_AARCH64_P32_TLSLE_ADD_TPREL_LO12_NC", - "R_AARCH64_P32_TLSLE_MOVW_TPREL_G0", - "R_AARCH64_P32_TLSLE_MOVW_TPREL_G0_NC", - "R_AARCH64_P32_TLSLE_MOVW_TPREL_G1", - "R_AARCH64_P32_TLS_DTPMOD", - "R_AARCH64_P32_TLS_DTPREL", - "R_AARCH64_P32_TLS_TPREL", - "R_AARCH64_P32_TSTBR14", - "R_AARCH64_PREL16", - "R_AARCH64_PREL32", - "R_AARCH64_PREL64", - "R_AARCH64_RELATIVE", - "R_AARCH64_TLSDESC", - "R_AARCH64_TLSDESC_ADD", - "R_AARCH64_TLSDESC_ADD_LO12_NC", - "R_AARCH64_TLSDESC_ADR_PAGE21", - "R_AARCH64_TLSDESC_ADR_PREL21", - "R_AARCH64_TLSDESC_CALL", - "R_AARCH64_TLSDESC_LD64_LO12_NC", - "R_AARCH64_TLSDESC_LDR", - "R_AARCH64_TLSDESC_LD_PREL19", - "R_AARCH64_TLSDESC_OFF_G0_NC", - "R_AARCH64_TLSDESC_OFF_G1", - "R_AARCH64_TLSGD_ADD_LO12_NC", - "R_AARCH64_TLSGD_ADR_PAGE21", - "R_AARCH64_TLSGD_ADR_PREL21", - "R_AARCH64_TLSGD_MOVW_G0_NC", - "R_AARCH64_TLSGD_MOVW_G1", - "R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21", - "R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC", - "R_AARCH64_TLSIE_LD_GOTTPREL_PREL19", - "R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC", - "R_AARCH64_TLSIE_MOVW_GOTTPREL_G1", - "R_AARCH64_TLSLD_ADR_PAGE21", - "R_AARCH64_TLSLD_ADR_PREL21", - "R_AARCH64_TLSLD_LDST128_DTPREL_LO12", - "R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC", - "R_AARCH64_TLSLE_ADD_TPREL_HI12", - "R_AARCH64_TLSLE_ADD_TPREL_LO12", - "R_AARCH64_TLSLE_ADD_TPREL_LO12_NC", - "R_AARCH64_TLSLE_LDST128_TPREL_LO12", - "R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC", - "R_AARCH64_TLSLE_MOVW_TPREL_G0", - "R_AARCH64_TLSLE_MOVW_TPREL_G0_NC", - "R_AARCH64_TLSLE_MOVW_TPREL_G1", - "R_AARCH64_TLSLE_MOVW_TPREL_G1_NC", - "R_AARCH64_TLSLE_MOVW_TPREL_G2", - "R_AARCH64_TLS_DTPMOD64", - "R_AARCH64_TLS_DTPREL64", - "R_AARCH64_TLS_TPREL64", - "R_AARCH64_TSTBR14", - "R_ALPHA", - "R_ALPHA_BRADDR", - "R_ALPHA_COPY", - "R_ALPHA_GLOB_DAT", - "R_ALPHA_GPDISP", - "R_ALPHA_GPREL32", - "R_ALPHA_GPRELHIGH", - "R_ALPHA_GPRELLOW", - "R_ALPHA_GPVALUE", - "R_ALPHA_HINT", - "R_ALPHA_IMMED_BR_HI32", - "R_ALPHA_IMMED_GP_16", - "R_ALPHA_IMMED_GP_HI32", - "R_ALPHA_IMMED_LO32", - "R_ALPHA_IMMED_SCN_HI32", - "R_ALPHA_JMP_SLOT", - "R_ALPHA_LITERAL", - "R_ALPHA_LITUSE", - "R_ALPHA_NONE", - "R_ALPHA_OP_PRSHIFT", - "R_ALPHA_OP_PSUB", - "R_ALPHA_OP_PUSH", - "R_ALPHA_OP_STORE", - "R_ALPHA_REFLONG", - "R_ALPHA_REFQUAD", - "R_ALPHA_RELATIVE", - "R_ALPHA_SREL16", - "R_ALPHA_SREL32", - "R_ALPHA_SREL64", - "R_ARM", - "R_ARM_ABS12", - "R_ARM_ABS16", - "R_ARM_ABS32", - "R_ARM_ABS32_NOI", - "R_ARM_ABS8", - "R_ARM_ALU_PCREL_15_8", - "R_ARM_ALU_PCREL_23_15", - "R_ARM_ALU_PCREL_7_0", - "R_ARM_ALU_PC_G0", - "R_ARM_ALU_PC_G0_NC", - "R_ARM_ALU_PC_G1", - "R_ARM_ALU_PC_G1_NC", - "R_ARM_ALU_PC_G2", - "R_ARM_ALU_SBREL_19_12_NC", - "R_ARM_ALU_SBREL_27_20_CK", - "R_ARM_ALU_SB_G0", - "R_ARM_ALU_SB_G0_NC", - "R_ARM_ALU_SB_G1", - "R_ARM_ALU_SB_G1_NC", - "R_ARM_ALU_SB_G2", - "R_ARM_AMP_VCALL9", - "R_ARM_BASE_ABS", - "R_ARM_CALL", - "R_ARM_COPY", - "R_ARM_GLOB_DAT", - "R_ARM_GNU_VTENTRY", - "R_ARM_GNU_VTINHERIT", - "R_ARM_GOT32", - "R_ARM_GOTOFF", - "R_ARM_GOTOFF12", - "R_ARM_GOTPC", - "R_ARM_GOTRELAX", - "R_ARM_GOT_ABS", - "R_ARM_GOT_BREL12", - "R_ARM_GOT_PREL", - "R_ARM_IRELATIVE", - "R_ARM_JUMP24", - "R_ARM_JUMP_SLOT", - "R_ARM_LDC_PC_G0", - "R_ARM_LDC_PC_G1", - "R_ARM_LDC_PC_G2", - "R_ARM_LDC_SB_G0", - "R_ARM_LDC_SB_G1", - "R_ARM_LDC_SB_G2", - "R_ARM_LDRS_PC_G0", - "R_ARM_LDRS_PC_G1", - "R_ARM_LDRS_PC_G2", - "R_ARM_LDRS_SB_G0", - "R_ARM_LDRS_SB_G1", - "R_ARM_LDRS_SB_G2", - "R_ARM_LDR_PC_G1", - "R_ARM_LDR_PC_G2", - "R_ARM_LDR_SBREL_11_10_NC", - "R_ARM_LDR_SB_G0", - "R_ARM_LDR_SB_G1", - "R_ARM_LDR_SB_G2", - "R_ARM_ME_TOO", - "R_ARM_MOVT_ABS", - "R_ARM_MOVT_BREL", - "R_ARM_MOVT_PREL", - "R_ARM_MOVW_ABS_NC", - "R_ARM_MOVW_BREL", - "R_ARM_MOVW_BREL_NC", - "R_ARM_MOVW_PREL_NC", - "R_ARM_NONE", - "R_ARM_PC13", - "R_ARM_PC24", - "R_ARM_PLT32", - "R_ARM_PLT32_ABS", - "R_ARM_PREL31", - "R_ARM_PRIVATE_0", - "R_ARM_PRIVATE_1", - "R_ARM_PRIVATE_10", - "R_ARM_PRIVATE_11", - "R_ARM_PRIVATE_12", - "R_ARM_PRIVATE_13", - "R_ARM_PRIVATE_14", - "R_ARM_PRIVATE_15", - "R_ARM_PRIVATE_2", - "R_ARM_PRIVATE_3", - "R_ARM_PRIVATE_4", - "R_ARM_PRIVATE_5", - "R_ARM_PRIVATE_6", - "R_ARM_PRIVATE_7", - "R_ARM_PRIVATE_8", - "R_ARM_PRIVATE_9", - "R_ARM_RABS32", - "R_ARM_RBASE", - "R_ARM_REL32", - "R_ARM_REL32_NOI", - "R_ARM_RELATIVE", - "R_ARM_RPC24", - "R_ARM_RREL32", - "R_ARM_RSBREL32", - "R_ARM_RXPC25", - "R_ARM_SBREL31", - "R_ARM_SBREL32", - "R_ARM_SWI24", - "R_ARM_TARGET1", - "R_ARM_TARGET2", - "R_ARM_THM_ABS5", - "R_ARM_THM_ALU_ABS_G0_NC", - "R_ARM_THM_ALU_ABS_G1_NC", - "R_ARM_THM_ALU_ABS_G2_NC", - "R_ARM_THM_ALU_ABS_G3", - "R_ARM_THM_ALU_PREL_11_0", - "R_ARM_THM_GOT_BREL12", - "R_ARM_THM_JUMP11", - "R_ARM_THM_JUMP19", - "R_ARM_THM_JUMP24", - "R_ARM_THM_JUMP6", - "R_ARM_THM_JUMP8", - "R_ARM_THM_MOVT_ABS", - "R_ARM_THM_MOVT_BREL", - "R_ARM_THM_MOVT_PREL", - "R_ARM_THM_MOVW_ABS_NC", - "R_ARM_THM_MOVW_BREL", - "R_ARM_THM_MOVW_BREL_NC", - "R_ARM_THM_MOVW_PREL_NC", - "R_ARM_THM_PC12", - "R_ARM_THM_PC22", - "R_ARM_THM_PC8", - "R_ARM_THM_RPC22", - "R_ARM_THM_SWI8", - "R_ARM_THM_TLS_CALL", - "R_ARM_THM_TLS_DESCSEQ16", - "R_ARM_THM_TLS_DESCSEQ32", - "R_ARM_THM_XPC22", - "R_ARM_TLS_CALL", - "R_ARM_TLS_DESCSEQ", - "R_ARM_TLS_DTPMOD32", - "R_ARM_TLS_DTPOFF32", - "R_ARM_TLS_GD32", - "R_ARM_TLS_GOTDESC", - "R_ARM_TLS_IE12GP", - "R_ARM_TLS_IE32", - "R_ARM_TLS_LDM32", - "R_ARM_TLS_LDO12", - "R_ARM_TLS_LDO32", - "R_ARM_TLS_LE12", - "R_ARM_TLS_LE32", - "R_ARM_TLS_TPOFF32", - "R_ARM_V4BX", - "R_ARM_XPC25", - "R_INFO", - "R_INFO32", - "R_LARCH", - "R_LARCH_32", - "R_LARCH_32_PCREL", - "R_LARCH_64", - "R_LARCH_ABS64_HI12", - "R_LARCH_ABS64_LO20", - "R_LARCH_ABS_HI20", - "R_LARCH_ABS_LO12", - "R_LARCH_ADD16", - "R_LARCH_ADD24", - "R_LARCH_ADD32", - "R_LARCH_ADD64", - "R_LARCH_ADD8", - "R_LARCH_B16", - "R_LARCH_B21", - "R_LARCH_B26", - "R_LARCH_COPY", - "R_LARCH_GNU_VTENTRY", - "R_LARCH_GNU_VTINHERIT", - "R_LARCH_GOT64_HI12", - "R_LARCH_GOT64_LO20", - "R_LARCH_GOT64_PC_HI12", - "R_LARCH_GOT64_PC_LO20", - "R_LARCH_GOT_HI20", - "R_LARCH_GOT_LO12", - "R_LARCH_GOT_PC_HI20", - "R_LARCH_GOT_PC_LO12", - "R_LARCH_IRELATIVE", - "R_LARCH_JUMP_SLOT", - "R_LARCH_MARK_LA", - "R_LARCH_MARK_PCREL", - "R_LARCH_NONE", - "R_LARCH_PCALA64_HI12", - "R_LARCH_PCALA64_LO20", - "R_LARCH_PCALA_HI20", - "R_LARCH_PCALA_LO12", - "R_LARCH_RELATIVE", - "R_LARCH_RELAX", - "R_LARCH_SOP_ADD", - "R_LARCH_SOP_AND", - "R_LARCH_SOP_ASSERT", - "R_LARCH_SOP_IF_ELSE", - "R_LARCH_SOP_NOT", - "R_LARCH_SOP_POP_32_S_0_10_10_16_S2", - "R_LARCH_SOP_POP_32_S_0_5_10_16_S2", - "R_LARCH_SOP_POP_32_S_10_12", - "R_LARCH_SOP_POP_32_S_10_16", - "R_LARCH_SOP_POP_32_S_10_16_S2", - "R_LARCH_SOP_POP_32_S_10_5", - "R_LARCH_SOP_POP_32_S_5_20", - "R_LARCH_SOP_POP_32_U", - "R_LARCH_SOP_POP_32_U_10_12", - "R_LARCH_SOP_PUSH_ABSOLUTE", - "R_LARCH_SOP_PUSH_DUP", - "R_LARCH_SOP_PUSH_GPREL", - "R_LARCH_SOP_PUSH_PCREL", - "R_LARCH_SOP_PUSH_PLT_PCREL", - "R_LARCH_SOP_PUSH_TLS_GD", - "R_LARCH_SOP_PUSH_TLS_GOT", - "R_LARCH_SOP_PUSH_TLS_TPREL", - "R_LARCH_SOP_SL", - "R_LARCH_SOP_SR", - "R_LARCH_SOP_SUB", - "R_LARCH_SUB16", - "R_LARCH_SUB24", - "R_LARCH_SUB32", - "R_LARCH_SUB64", - "R_LARCH_SUB8", - "R_LARCH_TLS_DTPMOD32", - "R_LARCH_TLS_DTPMOD64", - "R_LARCH_TLS_DTPREL32", - "R_LARCH_TLS_DTPREL64", - "R_LARCH_TLS_GD_HI20", - "R_LARCH_TLS_GD_PC_HI20", - "R_LARCH_TLS_IE64_HI12", - "R_LARCH_TLS_IE64_LO20", - "R_LARCH_TLS_IE64_PC_HI12", - "R_LARCH_TLS_IE64_PC_LO20", - "R_LARCH_TLS_IE_HI20", - "R_LARCH_TLS_IE_LO12", - "R_LARCH_TLS_IE_PC_HI20", - "R_LARCH_TLS_IE_PC_LO12", - "R_LARCH_TLS_LD_HI20", - "R_LARCH_TLS_LD_PC_HI20", - "R_LARCH_TLS_LE64_HI12", - "R_LARCH_TLS_LE64_LO20", - "R_LARCH_TLS_LE_HI20", - "R_LARCH_TLS_LE_LO12", - "R_LARCH_TLS_TPREL32", - "R_LARCH_TLS_TPREL64", - "R_MIPS", - "R_MIPS_16", - "R_MIPS_26", - "R_MIPS_32", - "R_MIPS_64", - "R_MIPS_ADD_IMMEDIATE", - "R_MIPS_CALL16", - "R_MIPS_CALL_HI16", - "R_MIPS_CALL_LO16", - "R_MIPS_DELETE", - "R_MIPS_GOT16", - "R_MIPS_GOT_DISP", - "R_MIPS_GOT_HI16", - "R_MIPS_GOT_LO16", - "R_MIPS_GOT_OFST", - "R_MIPS_GOT_PAGE", - "R_MIPS_GPREL16", - "R_MIPS_GPREL32", - "R_MIPS_HI16", - "R_MIPS_HIGHER", - "R_MIPS_HIGHEST", - "R_MIPS_INSERT_A", - "R_MIPS_INSERT_B", - "R_MIPS_JALR", - "R_MIPS_LITERAL", - "R_MIPS_LO16", - "R_MIPS_NONE", - "R_MIPS_PC16", - "R_MIPS_PJUMP", - "R_MIPS_REL16", - "R_MIPS_REL32", - "R_MIPS_RELGOT", - "R_MIPS_SCN_DISP", - "R_MIPS_SHIFT5", - "R_MIPS_SHIFT6", - "R_MIPS_SUB", - "R_MIPS_TLS_DTPMOD32", - "R_MIPS_TLS_DTPMOD64", - "R_MIPS_TLS_DTPREL32", - "R_MIPS_TLS_DTPREL64", - "R_MIPS_TLS_DTPREL_HI16", - "R_MIPS_TLS_DTPREL_LO16", - "R_MIPS_TLS_GD", - "R_MIPS_TLS_GOTTPREL", - "R_MIPS_TLS_LDM", - "R_MIPS_TLS_TPREL32", - "R_MIPS_TLS_TPREL64", - "R_MIPS_TLS_TPREL_HI16", - "R_MIPS_TLS_TPREL_LO16", - "R_PPC", - "R_PPC64", - "R_PPC64_ADDR14", - "R_PPC64_ADDR14_BRNTAKEN", - "R_PPC64_ADDR14_BRTAKEN", - "R_PPC64_ADDR16", - "R_PPC64_ADDR16_DS", - "R_PPC64_ADDR16_HA", - "R_PPC64_ADDR16_HI", - "R_PPC64_ADDR16_HIGH", - "R_PPC64_ADDR16_HIGHA", - "R_PPC64_ADDR16_HIGHER", - "R_PPC64_ADDR16_HIGHER34", - "R_PPC64_ADDR16_HIGHERA", - "R_PPC64_ADDR16_HIGHERA34", - "R_PPC64_ADDR16_HIGHEST", - "R_PPC64_ADDR16_HIGHEST34", - "R_PPC64_ADDR16_HIGHESTA", - "R_PPC64_ADDR16_HIGHESTA34", - "R_PPC64_ADDR16_LO", - "R_PPC64_ADDR16_LO_DS", - "R_PPC64_ADDR24", - "R_PPC64_ADDR32", - "R_PPC64_ADDR64", - "R_PPC64_ADDR64_LOCAL", - "R_PPC64_COPY", - "R_PPC64_D28", - "R_PPC64_D34", - "R_PPC64_D34_HA30", - "R_PPC64_D34_HI30", - "R_PPC64_D34_LO", - "R_PPC64_DTPMOD64", - "R_PPC64_DTPREL16", - "R_PPC64_DTPREL16_DS", - "R_PPC64_DTPREL16_HA", - "R_PPC64_DTPREL16_HI", - "R_PPC64_DTPREL16_HIGH", - "R_PPC64_DTPREL16_HIGHA", - "R_PPC64_DTPREL16_HIGHER", - "R_PPC64_DTPREL16_HIGHERA", - "R_PPC64_DTPREL16_HIGHEST", - "R_PPC64_DTPREL16_HIGHESTA", - "R_PPC64_DTPREL16_LO", - "R_PPC64_DTPREL16_LO_DS", - "R_PPC64_DTPREL34", - "R_PPC64_DTPREL64", - "R_PPC64_ENTRY", - "R_PPC64_GLOB_DAT", - "R_PPC64_GNU_VTENTRY", - "R_PPC64_GNU_VTINHERIT", - "R_PPC64_GOT16", - "R_PPC64_GOT16_DS", - "R_PPC64_GOT16_HA", - "R_PPC64_GOT16_HI", - "R_PPC64_GOT16_LO", - "R_PPC64_GOT16_LO_DS", - "R_PPC64_GOT_DTPREL16_DS", - "R_PPC64_GOT_DTPREL16_HA", - "R_PPC64_GOT_DTPREL16_HI", - "R_PPC64_GOT_DTPREL16_LO_DS", - "R_PPC64_GOT_DTPREL_PCREL34", - "R_PPC64_GOT_PCREL34", - "R_PPC64_GOT_TLSGD16", - "R_PPC64_GOT_TLSGD16_HA", - "R_PPC64_GOT_TLSGD16_HI", - "R_PPC64_GOT_TLSGD16_LO", - "R_PPC64_GOT_TLSGD_PCREL34", - "R_PPC64_GOT_TLSLD16", - "R_PPC64_GOT_TLSLD16_HA", - "R_PPC64_GOT_TLSLD16_HI", - "R_PPC64_GOT_TLSLD16_LO", - "R_PPC64_GOT_TLSLD_PCREL34", - "R_PPC64_GOT_TPREL16_DS", - "R_PPC64_GOT_TPREL16_HA", - "R_PPC64_GOT_TPREL16_HI", - "R_PPC64_GOT_TPREL16_LO_DS", - "R_PPC64_GOT_TPREL_PCREL34", - "R_PPC64_IRELATIVE", - "R_PPC64_JMP_IREL", - "R_PPC64_JMP_SLOT", - "R_PPC64_NONE", - "R_PPC64_PCREL28", - "R_PPC64_PCREL34", - "R_PPC64_PCREL_OPT", - "R_PPC64_PLT16_HA", - "R_PPC64_PLT16_HI", - "R_PPC64_PLT16_LO", - "R_PPC64_PLT16_LO_DS", - "R_PPC64_PLT32", - "R_PPC64_PLT64", - "R_PPC64_PLTCALL", - "R_PPC64_PLTCALL_NOTOC", - "R_PPC64_PLTGOT16", - "R_PPC64_PLTGOT16_DS", - "R_PPC64_PLTGOT16_HA", - "R_PPC64_PLTGOT16_HI", - "R_PPC64_PLTGOT16_LO", - "R_PPC64_PLTGOT_LO_DS", - "R_PPC64_PLTREL32", - "R_PPC64_PLTREL64", - "R_PPC64_PLTSEQ", - "R_PPC64_PLTSEQ_NOTOC", - "R_PPC64_PLT_PCREL34", - "R_PPC64_PLT_PCREL34_NOTOC", - "R_PPC64_REL14", - "R_PPC64_REL14_BRNTAKEN", - "R_PPC64_REL14_BRTAKEN", - "R_PPC64_REL16", - "R_PPC64_REL16DX_HA", - "R_PPC64_REL16_HA", - "R_PPC64_REL16_HI", - "R_PPC64_REL16_HIGH", - "R_PPC64_REL16_HIGHA", - "R_PPC64_REL16_HIGHER", - "R_PPC64_REL16_HIGHER34", - "R_PPC64_REL16_HIGHERA", - "R_PPC64_REL16_HIGHERA34", - "R_PPC64_REL16_HIGHEST", - "R_PPC64_REL16_HIGHEST34", - "R_PPC64_REL16_HIGHESTA", - "R_PPC64_REL16_HIGHESTA34", - "R_PPC64_REL16_LO", - "R_PPC64_REL24", - "R_PPC64_REL24_NOTOC", - "R_PPC64_REL24_P9NOTOC", - "R_PPC64_REL30", - "R_PPC64_REL32", - "R_PPC64_REL64", - "R_PPC64_RELATIVE", - "R_PPC64_SECTOFF", - "R_PPC64_SECTOFF_DS", - "R_PPC64_SECTOFF_HA", - "R_PPC64_SECTOFF_HI", - "R_PPC64_SECTOFF_LO", - "R_PPC64_SECTOFF_LO_DS", - "R_PPC64_TLS", - "R_PPC64_TLSGD", - "R_PPC64_TLSLD", - "R_PPC64_TOC", - "R_PPC64_TOC16", - "R_PPC64_TOC16_DS", - "R_PPC64_TOC16_HA", - "R_PPC64_TOC16_HI", - "R_PPC64_TOC16_LO", - "R_PPC64_TOC16_LO_DS", - "R_PPC64_TOCSAVE", - "R_PPC64_TPREL16", - "R_PPC64_TPREL16_DS", - "R_PPC64_TPREL16_HA", - "R_PPC64_TPREL16_HI", - "R_PPC64_TPREL16_HIGH", - "R_PPC64_TPREL16_HIGHA", - "R_PPC64_TPREL16_HIGHER", - "R_PPC64_TPREL16_HIGHERA", - "R_PPC64_TPREL16_HIGHEST", - "R_PPC64_TPREL16_HIGHESTA", - "R_PPC64_TPREL16_LO", - "R_PPC64_TPREL16_LO_DS", - "R_PPC64_TPREL34", - "R_PPC64_TPREL64", - "R_PPC64_UADDR16", - "R_PPC64_UADDR32", - "R_PPC64_UADDR64", - "R_PPC_ADDR14", - "R_PPC_ADDR14_BRNTAKEN", - "R_PPC_ADDR14_BRTAKEN", - "R_PPC_ADDR16", - "R_PPC_ADDR16_HA", - "R_PPC_ADDR16_HI", - "R_PPC_ADDR16_LO", - "R_PPC_ADDR24", - "R_PPC_ADDR32", - "R_PPC_COPY", - "R_PPC_DTPMOD32", - "R_PPC_DTPREL16", - "R_PPC_DTPREL16_HA", - "R_PPC_DTPREL16_HI", - "R_PPC_DTPREL16_LO", - "R_PPC_DTPREL32", - "R_PPC_EMB_BIT_FLD", - "R_PPC_EMB_MRKREF", - "R_PPC_EMB_NADDR16", - "R_PPC_EMB_NADDR16_HA", - "R_PPC_EMB_NADDR16_HI", - "R_PPC_EMB_NADDR16_LO", - "R_PPC_EMB_NADDR32", - "R_PPC_EMB_RELSDA", - "R_PPC_EMB_RELSEC16", - "R_PPC_EMB_RELST_HA", - "R_PPC_EMB_RELST_HI", - "R_PPC_EMB_RELST_LO", - "R_PPC_EMB_SDA21", - "R_PPC_EMB_SDA2I16", - "R_PPC_EMB_SDA2REL", - "R_PPC_EMB_SDAI16", - "R_PPC_GLOB_DAT", - "R_PPC_GOT16", - "R_PPC_GOT16_HA", - "R_PPC_GOT16_HI", - "R_PPC_GOT16_LO", - "R_PPC_GOT_TLSGD16", - "R_PPC_GOT_TLSGD16_HA", - "R_PPC_GOT_TLSGD16_HI", - "R_PPC_GOT_TLSGD16_LO", - "R_PPC_GOT_TLSLD16", - "R_PPC_GOT_TLSLD16_HA", - "R_PPC_GOT_TLSLD16_HI", - "R_PPC_GOT_TLSLD16_LO", - "R_PPC_GOT_TPREL16", - "R_PPC_GOT_TPREL16_HA", - "R_PPC_GOT_TPREL16_HI", - "R_PPC_GOT_TPREL16_LO", - "R_PPC_JMP_SLOT", - "R_PPC_LOCAL24PC", - "R_PPC_NONE", - "R_PPC_PLT16_HA", - "R_PPC_PLT16_HI", - "R_PPC_PLT16_LO", - "R_PPC_PLT32", - "R_PPC_PLTREL24", - "R_PPC_PLTREL32", - "R_PPC_REL14", - "R_PPC_REL14_BRNTAKEN", - "R_PPC_REL14_BRTAKEN", - "R_PPC_REL24", - "R_PPC_REL32", - "R_PPC_RELATIVE", - "R_PPC_SDAREL16", - "R_PPC_SECTOFF", - "R_PPC_SECTOFF_HA", - "R_PPC_SECTOFF_HI", - "R_PPC_SECTOFF_LO", - "R_PPC_TLS", - "R_PPC_TPREL16", - "R_PPC_TPREL16_HA", - "R_PPC_TPREL16_HI", - "R_PPC_TPREL16_LO", - "R_PPC_TPREL32", - "R_PPC_UADDR16", - "R_PPC_UADDR32", - "R_RISCV", - "R_RISCV_32", - "R_RISCV_32_PCREL", - "R_RISCV_64", - "R_RISCV_ADD16", - "R_RISCV_ADD32", - "R_RISCV_ADD64", - "R_RISCV_ADD8", - "R_RISCV_ALIGN", - "R_RISCV_BRANCH", - "R_RISCV_CALL", - "R_RISCV_CALL_PLT", - "R_RISCV_COPY", - "R_RISCV_GNU_VTENTRY", - "R_RISCV_GNU_VTINHERIT", - "R_RISCV_GOT_HI20", - "R_RISCV_GPREL_I", - "R_RISCV_GPREL_S", - "R_RISCV_HI20", - "R_RISCV_JAL", - "R_RISCV_JUMP_SLOT", - "R_RISCV_LO12_I", - "R_RISCV_LO12_S", - "R_RISCV_NONE", - "R_RISCV_PCREL_HI20", - "R_RISCV_PCREL_LO12_I", - "R_RISCV_PCREL_LO12_S", - "R_RISCV_RELATIVE", - "R_RISCV_RELAX", - "R_RISCV_RVC_BRANCH", - "R_RISCV_RVC_JUMP", - "R_RISCV_RVC_LUI", - "R_RISCV_SET16", - "R_RISCV_SET32", - "R_RISCV_SET6", - "R_RISCV_SET8", - "R_RISCV_SUB16", - "R_RISCV_SUB32", - "R_RISCV_SUB6", - "R_RISCV_SUB64", - "R_RISCV_SUB8", - "R_RISCV_TLS_DTPMOD32", - "R_RISCV_TLS_DTPMOD64", - "R_RISCV_TLS_DTPREL32", - "R_RISCV_TLS_DTPREL64", - "R_RISCV_TLS_GD_HI20", - "R_RISCV_TLS_GOT_HI20", - "R_RISCV_TLS_TPREL32", - "R_RISCV_TLS_TPREL64", - "R_RISCV_TPREL_ADD", - "R_RISCV_TPREL_HI20", - "R_RISCV_TPREL_I", - "R_RISCV_TPREL_LO12_I", - "R_RISCV_TPREL_LO12_S", - "R_RISCV_TPREL_S", - "R_SPARC", - "R_SPARC_10", - "R_SPARC_11", - "R_SPARC_13", - "R_SPARC_16", - "R_SPARC_22", - "R_SPARC_32", - "R_SPARC_5", - "R_SPARC_6", - "R_SPARC_64", - "R_SPARC_7", - "R_SPARC_8", - "R_SPARC_COPY", - "R_SPARC_DISP16", - "R_SPARC_DISP32", - "R_SPARC_DISP64", - "R_SPARC_DISP8", - "R_SPARC_GLOB_DAT", - "R_SPARC_GLOB_JMP", - "R_SPARC_GOT10", - "R_SPARC_GOT13", - "R_SPARC_GOT22", - "R_SPARC_H44", - "R_SPARC_HH22", - "R_SPARC_HI22", - "R_SPARC_HIPLT22", - "R_SPARC_HIX22", - "R_SPARC_HM10", - "R_SPARC_JMP_SLOT", - "R_SPARC_L44", - "R_SPARC_LM22", - "R_SPARC_LO10", - "R_SPARC_LOPLT10", - "R_SPARC_LOX10", - "R_SPARC_M44", - "R_SPARC_NONE", - "R_SPARC_OLO10", - "R_SPARC_PC10", - "R_SPARC_PC22", - "R_SPARC_PCPLT10", - "R_SPARC_PCPLT22", - "R_SPARC_PCPLT32", - "R_SPARC_PC_HH22", - "R_SPARC_PC_HM10", - "R_SPARC_PC_LM22", - "R_SPARC_PLT32", - "R_SPARC_PLT64", - "R_SPARC_REGISTER", - "R_SPARC_RELATIVE", - "R_SPARC_UA16", - "R_SPARC_UA32", - "R_SPARC_UA64", - "R_SPARC_WDISP16", - "R_SPARC_WDISP19", - "R_SPARC_WDISP22", - "R_SPARC_WDISP30", - "R_SPARC_WPLT30", - "R_SYM32", - "R_SYM64", - "R_TYPE32", - "R_TYPE64", - "R_X86_64", - "R_X86_64_16", - "R_X86_64_32", - "R_X86_64_32S", - "R_X86_64_64", - "R_X86_64_8", - "R_X86_64_COPY", - "R_X86_64_DTPMOD64", - "R_X86_64_DTPOFF32", - "R_X86_64_DTPOFF64", - "R_X86_64_GLOB_DAT", - "R_X86_64_GOT32", - "R_X86_64_GOT64", - "R_X86_64_GOTOFF64", - "R_X86_64_GOTPC32", - "R_X86_64_GOTPC32_TLSDESC", - "R_X86_64_GOTPC64", - "R_X86_64_GOTPCREL", - "R_X86_64_GOTPCREL64", - "R_X86_64_GOTPCRELX", - "R_X86_64_GOTPLT64", - "R_X86_64_GOTTPOFF", - "R_X86_64_IRELATIVE", - "R_X86_64_JMP_SLOT", - "R_X86_64_NONE", - "R_X86_64_PC16", - "R_X86_64_PC32", - "R_X86_64_PC32_BND", - "R_X86_64_PC64", - "R_X86_64_PC8", - "R_X86_64_PLT32", - "R_X86_64_PLT32_BND", - "R_X86_64_PLTOFF64", - "R_X86_64_RELATIVE", - "R_X86_64_RELATIVE64", - "R_X86_64_REX_GOTPCRELX", - "R_X86_64_SIZE32", - "R_X86_64_SIZE64", - "R_X86_64_TLSDESC", - "R_X86_64_TLSDESC_CALL", - "R_X86_64_TLSGD", - "R_X86_64_TLSLD", - "R_X86_64_TPOFF32", - "R_X86_64_TPOFF64", - "Rel32", - "Rel64", - "Rela32", - "Rela64", - "SHF_ALLOC", - "SHF_COMPRESSED", - "SHF_EXECINSTR", - "SHF_GROUP", - "SHF_INFO_LINK", - "SHF_LINK_ORDER", - "SHF_MASKOS", - "SHF_MASKPROC", - "SHF_MERGE", - "SHF_OS_NONCONFORMING", - "SHF_STRINGS", - "SHF_TLS", - "SHF_WRITE", - "SHN_ABS", - "SHN_COMMON", - "SHN_HIOS", - "SHN_HIPROC", - "SHN_HIRESERVE", - "SHN_LOOS", - "SHN_LOPROC", - "SHN_LORESERVE", - "SHN_UNDEF", - "SHN_XINDEX", - "SHT_DYNAMIC", - "SHT_DYNSYM", - "SHT_FINI_ARRAY", - "SHT_GNU_ATTRIBUTES", - "SHT_GNU_HASH", - "SHT_GNU_LIBLIST", - "SHT_GNU_VERDEF", - "SHT_GNU_VERNEED", - "SHT_GNU_VERSYM", - "SHT_GROUP", - "SHT_HASH", - "SHT_HIOS", - "SHT_HIPROC", - "SHT_HIUSER", - "SHT_INIT_ARRAY", - "SHT_LOOS", - "SHT_LOPROC", - "SHT_LOUSER", - "SHT_MIPS_ABIFLAGS", - "SHT_NOBITS", - "SHT_NOTE", - "SHT_NULL", - "SHT_PREINIT_ARRAY", - "SHT_PROGBITS", - "SHT_REL", - "SHT_RELA", - "SHT_SHLIB", - "SHT_STRTAB", - "SHT_SYMTAB", - "SHT_SYMTAB_SHNDX", - "STB_GLOBAL", - "STB_HIOS", - "STB_HIPROC", - "STB_LOCAL", - "STB_LOOS", - "STB_LOPROC", - "STB_WEAK", - "STT_COMMON", - "STT_FILE", - "STT_FUNC", - "STT_HIOS", - "STT_HIPROC", - "STT_LOOS", - "STT_LOPROC", - "STT_NOTYPE", - "STT_OBJECT", - "STT_SECTION", - "STT_TLS", - "STV_DEFAULT", - "STV_HIDDEN", - "STV_INTERNAL", - "STV_PROTECTED", - "ST_BIND", - "ST_INFO", - "ST_TYPE", - "ST_VISIBILITY", - "Section", - "Section32", - "Section64", - "SectionFlag", - "SectionHeader", - "SectionIndex", - "SectionType", - "Sym32", - "Sym32Size", - "Sym64", - "Sym64Size", - "SymBind", - "SymType", - "SymVis", - "Symbol", - "Type", - "Version", - }, - "debug/gosym": { - "DecodingError", - "Func", - "LineTable", - "NewLineTable", - "NewTable", - "Obj", - "Sym", - "Table", - "UnknownFileError", - "UnknownLineError", - }, - "debug/macho": { - "ARM64_RELOC_ADDEND", - "ARM64_RELOC_BRANCH26", - "ARM64_RELOC_GOT_LOAD_PAGE21", - "ARM64_RELOC_GOT_LOAD_PAGEOFF12", - "ARM64_RELOC_PAGE21", - "ARM64_RELOC_PAGEOFF12", - "ARM64_RELOC_POINTER_TO_GOT", - "ARM64_RELOC_SUBTRACTOR", - "ARM64_RELOC_TLVP_LOAD_PAGE21", - "ARM64_RELOC_TLVP_LOAD_PAGEOFF12", - "ARM64_RELOC_UNSIGNED", - "ARM_RELOC_BR24", - "ARM_RELOC_HALF", - "ARM_RELOC_HALF_SECTDIFF", - "ARM_RELOC_LOCAL_SECTDIFF", - "ARM_RELOC_PAIR", - "ARM_RELOC_PB_LA_PTR", - "ARM_RELOC_SECTDIFF", - "ARM_RELOC_VANILLA", - "ARM_THUMB_32BIT_BRANCH", - "ARM_THUMB_RELOC_BR22", - "Cpu", - "Cpu386", - "CpuAmd64", - "CpuArm", - "CpuArm64", - "CpuPpc", - "CpuPpc64", - "Dylib", - "DylibCmd", - "Dysymtab", - "DysymtabCmd", - "ErrNotFat", - "FatArch", - "FatArchHeader", - "FatFile", - "File", - "FileHeader", - "FlagAllModsBound", - "FlagAllowStackExecution", - "FlagAppExtensionSafe", - "FlagBindAtLoad", - "FlagBindsToWeak", - "FlagCanonical", - "FlagDeadStrippableDylib", - "FlagDyldLink", - "FlagForceFlat", - "FlagHasTLVDescriptors", - "FlagIncrLink", - "FlagLazyInit", - "FlagNoFixPrebinding", - "FlagNoHeapExecution", - "FlagNoMultiDefs", - "FlagNoReexportedDylibs", - "FlagNoUndefs", - "FlagPIE", - "FlagPrebindable", - "FlagPrebound", - "FlagRootSafe", - "FlagSetuidSafe", - "FlagSplitSegs", - "FlagSubsectionsViaSymbols", - "FlagTwoLevel", - "FlagWeakDefines", - "FormatError", - "GENERIC_RELOC_LOCAL_SECTDIFF", - "GENERIC_RELOC_PAIR", - "GENERIC_RELOC_PB_LA_PTR", - "GENERIC_RELOC_SECTDIFF", - "GENERIC_RELOC_TLV", - "GENERIC_RELOC_VANILLA", - "Load", - "LoadBytes", - "LoadCmd", - "LoadCmdDylib", - "LoadCmdDylinker", - "LoadCmdDysymtab", - "LoadCmdRpath", - "LoadCmdSegment", - "LoadCmdSegment64", - "LoadCmdSymtab", - "LoadCmdThread", - "LoadCmdUnixThread", - "Magic32", - "Magic64", - "MagicFat", - "NewFatFile", - "NewFile", - "Nlist32", - "Nlist64", - "Open", - "OpenFat", - "Regs386", - "RegsAMD64", - "Reloc", - "RelocTypeARM", - "RelocTypeARM64", - "RelocTypeGeneric", - "RelocTypeX86_64", - "Rpath", - "RpathCmd", - "Section", - "Section32", - "Section64", - "SectionHeader", - "Segment", - "Segment32", - "Segment64", - "SegmentHeader", - "Symbol", - "Symtab", - "SymtabCmd", - "Thread", - "Type", - "TypeBundle", - "TypeDylib", - "TypeExec", - "TypeObj", - "X86_64_RELOC_BRANCH", - "X86_64_RELOC_GOT", - "X86_64_RELOC_GOT_LOAD", - "X86_64_RELOC_SIGNED", - "X86_64_RELOC_SIGNED_1", - "X86_64_RELOC_SIGNED_2", - "X86_64_RELOC_SIGNED_4", - "X86_64_RELOC_SUBTRACTOR", - "X86_64_RELOC_TLV", - "X86_64_RELOC_UNSIGNED", - }, - "debug/pe": { - "COFFSymbol", - "COFFSymbolAuxFormat5", - "COFFSymbolSize", - "DataDirectory", - "File", - "FileHeader", - "FormatError", - "IMAGE_COMDAT_SELECT_ANY", - "IMAGE_COMDAT_SELECT_ASSOCIATIVE", - "IMAGE_COMDAT_SELECT_EXACT_MATCH", - "IMAGE_COMDAT_SELECT_LARGEST", - "IMAGE_COMDAT_SELECT_NODUPLICATES", - "IMAGE_COMDAT_SELECT_SAME_SIZE", - "IMAGE_DIRECTORY_ENTRY_ARCHITECTURE", - "IMAGE_DIRECTORY_ENTRY_BASERELOC", - "IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT", - "IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR", - "IMAGE_DIRECTORY_ENTRY_DEBUG", - "IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT", - "IMAGE_DIRECTORY_ENTRY_EXCEPTION", - "IMAGE_DIRECTORY_ENTRY_EXPORT", - "IMAGE_DIRECTORY_ENTRY_GLOBALPTR", - "IMAGE_DIRECTORY_ENTRY_IAT", - "IMAGE_DIRECTORY_ENTRY_IMPORT", - "IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG", - "IMAGE_DIRECTORY_ENTRY_RESOURCE", - "IMAGE_DIRECTORY_ENTRY_SECURITY", - "IMAGE_DIRECTORY_ENTRY_TLS", - "IMAGE_DLLCHARACTERISTICS_APPCONTAINER", - "IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE", - "IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY", - "IMAGE_DLLCHARACTERISTICS_GUARD_CF", - "IMAGE_DLLCHARACTERISTICS_HIGH_ENTROPY_VA", - "IMAGE_DLLCHARACTERISTICS_NO_BIND", - "IMAGE_DLLCHARACTERISTICS_NO_ISOLATION", - "IMAGE_DLLCHARACTERISTICS_NO_SEH", - "IMAGE_DLLCHARACTERISTICS_NX_COMPAT", - "IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE", - "IMAGE_DLLCHARACTERISTICS_WDM_DRIVER", - "IMAGE_FILE_32BIT_MACHINE", - "IMAGE_FILE_AGGRESIVE_WS_TRIM", - "IMAGE_FILE_BYTES_REVERSED_HI", - "IMAGE_FILE_BYTES_REVERSED_LO", - "IMAGE_FILE_DEBUG_STRIPPED", - "IMAGE_FILE_DLL", - "IMAGE_FILE_EXECUTABLE_IMAGE", - "IMAGE_FILE_LARGE_ADDRESS_AWARE", - "IMAGE_FILE_LINE_NUMS_STRIPPED", - "IMAGE_FILE_LOCAL_SYMS_STRIPPED", - "IMAGE_FILE_MACHINE_AM33", - "IMAGE_FILE_MACHINE_AMD64", - "IMAGE_FILE_MACHINE_ARM", - "IMAGE_FILE_MACHINE_ARM64", - "IMAGE_FILE_MACHINE_ARMNT", - "IMAGE_FILE_MACHINE_EBC", - "IMAGE_FILE_MACHINE_I386", - "IMAGE_FILE_MACHINE_IA64", - "IMAGE_FILE_MACHINE_LOONGARCH32", - "IMAGE_FILE_MACHINE_LOONGARCH64", - "IMAGE_FILE_MACHINE_M32R", - "IMAGE_FILE_MACHINE_MIPS16", - "IMAGE_FILE_MACHINE_MIPSFPU", - "IMAGE_FILE_MACHINE_MIPSFPU16", - "IMAGE_FILE_MACHINE_POWERPC", - "IMAGE_FILE_MACHINE_POWERPCFP", - "IMAGE_FILE_MACHINE_R4000", - "IMAGE_FILE_MACHINE_RISCV128", - "IMAGE_FILE_MACHINE_RISCV32", - "IMAGE_FILE_MACHINE_RISCV64", - "IMAGE_FILE_MACHINE_SH3", - "IMAGE_FILE_MACHINE_SH3DSP", - "IMAGE_FILE_MACHINE_SH4", - "IMAGE_FILE_MACHINE_SH5", - "IMAGE_FILE_MACHINE_THUMB", - "IMAGE_FILE_MACHINE_UNKNOWN", - "IMAGE_FILE_MACHINE_WCEMIPSV2", - "IMAGE_FILE_NET_RUN_FROM_SWAP", - "IMAGE_FILE_RELOCS_STRIPPED", - "IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP", - "IMAGE_FILE_SYSTEM", - "IMAGE_FILE_UP_SYSTEM_ONLY", - "IMAGE_SCN_CNT_CODE", - "IMAGE_SCN_CNT_INITIALIZED_DATA", - "IMAGE_SCN_CNT_UNINITIALIZED_DATA", - "IMAGE_SCN_LNK_COMDAT", - "IMAGE_SCN_MEM_DISCARDABLE", - "IMAGE_SCN_MEM_EXECUTE", - "IMAGE_SCN_MEM_READ", - "IMAGE_SCN_MEM_WRITE", - "IMAGE_SUBSYSTEM_EFI_APPLICATION", - "IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER", - "IMAGE_SUBSYSTEM_EFI_ROM", - "IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER", - "IMAGE_SUBSYSTEM_NATIVE", - "IMAGE_SUBSYSTEM_NATIVE_WINDOWS", - "IMAGE_SUBSYSTEM_OS2_CUI", - "IMAGE_SUBSYSTEM_POSIX_CUI", - "IMAGE_SUBSYSTEM_UNKNOWN", - "IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION", - "IMAGE_SUBSYSTEM_WINDOWS_CE_GUI", - "IMAGE_SUBSYSTEM_WINDOWS_CUI", - "IMAGE_SUBSYSTEM_WINDOWS_GUI", - "IMAGE_SUBSYSTEM_XBOX", - "ImportDirectory", - "NewFile", - "Open", - "OptionalHeader32", - "OptionalHeader64", - "Reloc", - "Section", - "SectionHeader", - "SectionHeader32", - "StringTable", - "Symbol", - }, - "debug/plan9obj": { - "ErrNoSymbols", - "File", - "FileHeader", - "Magic386", - "Magic64", - "MagicAMD64", - "MagicARM", - "NewFile", - "Open", - "Section", - "SectionHeader", - "Sym", - }, - "embed": { - "FS", - }, - "encoding": { - "BinaryMarshaler", - "BinaryUnmarshaler", - "TextMarshaler", - "TextUnmarshaler", - }, - "encoding/ascii85": { - "CorruptInputError", - "Decode", - "Encode", - "MaxEncodedLen", - "NewDecoder", - "NewEncoder", - }, - "encoding/asn1": { - "BitString", - "ClassApplication", - "ClassContextSpecific", - "ClassPrivate", - "ClassUniversal", - "Enumerated", - "Flag", - "Marshal", - "MarshalWithParams", - "NullBytes", - "NullRawValue", - "ObjectIdentifier", - "RawContent", - "RawValue", - "StructuralError", - "SyntaxError", - "TagBMPString", - "TagBitString", - "TagBoolean", - "TagEnum", - "TagGeneralString", - "TagGeneralizedTime", - "TagIA5String", - "TagInteger", - "TagNull", - "TagNumericString", - "TagOID", - "TagOctetString", - "TagPrintableString", - "TagSequence", - "TagSet", - "TagT61String", - "TagUTCTime", - "TagUTF8String", - "Unmarshal", - "UnmarshalWithParams", - }, - "encoding/base32": { - "CorruptInputError", - "Encoding", - "HexEncoding", - "NewDecoder", - "NewEncoder", - "NewEncoding", - "NoPadding", - "StdEncoding", - "StdPadding", - }, - "encoding/base64": { - "CorruptInputError", - "Encoding", - "NewDecoder", - "NewEncoder", - "NewEncoding", - "NoPadding", - "RawStdEncoding", - "RawURLEncoding", - "StdEncoding", - "StdPadding", - "URLEncoding", - }, - "encoding/binary": { - "AppendByteOrder", - "AppendUvarint", - "AppendVarint", - "BigEndian", - "ByteOrder", - "LittleEndian", - "MaxVarintLen16", - "MaxVarintLen32", - "MaxVarintLen64", - "NativeEndian", - "PutUvarint", - "PutVarint", - "Read", - "ReadUvarint", - "ReadVarint", - "Size", - "Uvarint", - "Varint", - "Write", - }, - "encoding/csv": { - "ErrBareQuote", - "ErrFieldCount", - "ErrQuote", - "ErrTrailingComma", - "NewReader", - "NewWriter", - "ParseError", - "Reader", - "Writer", - }, - "encoding/gob": { - "CommonType", - "Decoder", - "Encoder", - "GobDecoder", - "GobEncoder", - "NewDecoder", - "NewEncoder", - "Register", - "RegisterName", - }, - "encoding/hex": { - "Decode", - "DecodeString", - "DecodedLen", - "Dump", - "Dumper", - "Encode", - "EncodeToString", - "EncodedLen", - "ErrLength", - "InvalidByteError", - "NewDecoder", - "NewEncoder", - }, - "encoding/json": { - "Compact", - "Decoder", - "Delim", - "Encoder", - "HTMLEscape", - "Indent", - "InvalidUTF8Error", - "InvalidUnmarshalError", - "Marshal", - "MarshalIndent", - "Marshaler", - "MarshalerError", - "NewDecoder", - "NewEncoder", - "Number", - "RawMessage", - "SyntaxError", - "Token", - "Unmarshal", - "UnmarshalFieldError", - "UnmarshalTypeError", - "Unmarshaler", - "UnsupportedTypeError", - "UnsupportedValueError", - "Valid", - }, - "encoding/pem": { - "Block", - "Decode", - "Encode", - "EncodeToMemory", - }, - "encoding/xml": { - "Attr", - "CharData", - "Comment", - "CopyToken", - "Decoder", - "Directive", - "Encoder", - "EndElement", - "Escape", - "EscapeText", - "HTMLAutoClose", - "HTMLEntity", - "Header", - "Marshal", - "MarshalIndent", - "Marshaler", - "MarshalerAttr", - "Name", - "NewDecoder", - "NewEncoder", - "NewTokenDecoder", - "ProcInst", - "StartElement", - "SyntaxError", - "TagPathError", - "Token", - "TokenReader", - "Unmarshal", - "UnmarshalError", - "Unmarshaler", - "UnmarshalerAttr", - "UnsupportedTypeError", - }, - "errors": { - "As", - "ErrUnsupported", - "Is", - "Join", - "New", - "Unwrap", - }, - "expvar": { - "Do", - "Float", - "Func", - "Get", - "Handler", - "Int", - "KeyValue", - "Map", - "NewFloat", - "NewInt", - "NewMap", - "NewString", - "Publish", - "String", - "Var", - }, - "flag": { - "Arg", - "Args", - "Bool", - "BoolFunc", - "BoolVar", - "CommandLine", - "ContinueOnError", - "Duration", - "DurationVar", - "ErrHelp", - "ErrorHandling", - "ExitOnError", - "Flag", - "FlagSet", - "Float64", - "Float64Var", - "Func", - "Getter", - "Int", - "Int64", - "Int64Var", - "IntVar", - "Lookup", - "NArg", - "NFlag", - "NewFlagSet", - "PanicOnError", - "Parse", - "Parsed", - "PrintDefaults", - "Set", - "String", - "StringVar", - "TextVar", - "Uint", - "Uint64", - "Uint64Var", - "UintVar", - "UnquoteUsage", - "Usage", - "Value", - "Var", - "Visit", - "VisitAll", - }, - "fmt": { - "Append", - "Appendf", - "Appendln", - "Errorf", - "FormatString", - "Formatter", - "Fprint", - "Fprintf", - "Fprintln", - "Fscan", - "Fscanf", - "Fscanln", - "GoStringer", - "Print", - "Printf", - "Println", - "Scan", - "ScanState", - "Scanf", - "Scanln", - "Scanner", - "Sprint", - "Sprintf", - "Sprintln", - "Sscan", - "Sscanf", - "Sscanln", - "State", - "Stringer", - }, - "go/ast": { - "ArrayType", - "AssignStmt", - "Bad", - "BadDecl", - "BadExpr", - "BadStmt", - "BasicLit", - "BinaryExpr", - "BlockStmt", - "BranchStmt", - "CallExpr", - "CaseClause", - "ChanDir", - "ChanType", - "CommClause", - "Comment", - "CommentGroup", - "CommentMap", - "CompositeLit", - "Con", - "Decl", - "DeclStmt", - "DeferStmt", - "Ellipsis", - "EmptyStmt", - "Expr", - "ExprStmt", - "Field", - "FieldFilter", - "FieldList", - "File", - "FileExports", - "Filter", - "FilterDecl", - "FilterFile", - "FilterFuncDuplicates", - "FilterImportDuplicates", - "FilterPackage", - "FilterUnassociatedComments", - "ForStmt", - "Fprint", - "Fun", - "FuncDecl", - "FuncLit", - "FuncType", - "GenDecl", - "GoStmt", - "Ident", - "IfStmt", - "ImportSpec", - "Importer", - "IncDecStmt", - "IndexExpr", - "IndexListExpr", - "Inspect", - "InterfaceType", - "IsExported", - "IsGenerated", - "KeyValueExpr", - "LabeledStmt", - "Lbl", - "MapType", - "MergeMode", - "MergePackageFiles", - "NewCommentMap", - "NewIdent", - "NewObj", - "NewPackage", - "NewScope", - "Node", - "NotNilFilter", - "ObjKind", - "Object", - "Package", - "PackageExports", - "ParenExpr", - "Pkg", - "Print", - "RECV", - "RangeStmt", - "ReturnStmt", - "SEND", - "Scope", - "SelectStmt", - "SelectorExpr", - "SendStmt", - "SliceExpr", - "SortImports", - "Spec", - "StarExpr", - "Stmt", - "StructType", - "SwitchStmt", - "Typ", - "TypeAssertExpr", - "TypeSpec", - "TypeSwitchStmt", - "UnaryExpr", - "ValueSpec", - "Var", - "Visitor", - "Walk", - }, - "go/build": { - "AllowBinary", - "ArchChar", - "Context", - "Default", - "Directive", - "FindOnly", - "IgnoreVendor", - "Import", - "ImportComment", - "ImportDir", - "ImportMode", - "IsLocalImport", - "MultiplePackageError", - "NoGoError", - "Package", - "ToolDir", - }, - "go/build/constraint": { - "AndExpr", - "Expr", - "GoVersion", - "IsGoBuild", - "IsPlusBuild", - "NotExpr", - "OrExpr", - "Parse", - "PlusBuildLines", - "SyntaxError", - "TagExpr", - }, - "go/constant": { - "BinaryOp", - "BitLen", - "Bool", - "BoolVal", - "Bytes", - "Compare", - "Complex", - "Denom", - "Float", - "Float32Val", - "Float64Val", - "Imag", - "Int", - "Int64Val", - "Kind", - "Make", - "MakeBool", - "MakeFloat64", - "MakeFromBytes", - "MakeFromLiteral", - "MakeImag", - "MakeInt64", - "MakeString", - "MakeUint64", - "MakeUnknown", - "Num", - "Real", - "Shift", - "Sign", - "String", - "StringVal", - "ToComplex", - "ToFloat", - "ToInt", - "Uint64Val", - "UnaryOp", - "Unknown", - "Val", - "Value", - }, - "go/doc": { - "AllDecls", - "AllMethods", - "Example", - "Examples", - "Filter", - "Func", - "IllegalPrefixes", - "IsPredeclared", - "Mode", - "New", - "NewFromFiles", - "Note", - "Package", - "PreserveAST", - "Synopsis", - "ToHTML", - "ToText", - "Type", - "Value", - }, - "go/doc/comment": { - "Block", - "Code", - "DefaultLookupPackage", - "Doc", - "DocLink", - "Heading", - "Italic", - "Link", - "LinkDef", - "List", - "ListItem", - "Paragraph", - "Parser", - "Plain", - "Printer", - "Text", - }, - "go/format": { - "Node", - "Source", - }, - "go/importer": { - "Default", - "For", - "ForCompiler", - "Lookup", - }, - "go/parser": { - "AllErrors", - "DeclarationErrors", - "ImportsOnly", - "Mode", - "PackageClauseOnly", - "ParseComments", - "ParseDir", - "ParseExpr", - "ParseExprFrom", - "ParseFile", - "SkipObjectResolution", - "SpuriousErrors", - "Trace", - }, - "go/printer": { - "CommentedNode", - "Config", - "Fprint", - "Mode", - "RawFormat", - "SourcePos", - "TabIndent", - "UseSpaces", - }, - "go/scanner": { - "Error", - "ErrorHandler", - "ErrorList", - "Mode", - "PrintError", - "ScanComments", - "Scanner", - }, - "go/token": { - "ADD", - "ADD_ASSIGN", - "AND", - "AND_ASSIGN", - "AND_NOT", - "AND_NOT_ASSIGN", - "ARROW", - "ASSIGN", - "BREAK", - "CASE", - "CHAN", - "CHAR", - "COLON", - "COMMA", - "COMMENT", - "CONST", - "CONTINUE", - "DEC", - "DEFAULT", - "DEFER", - "DEFINE", - "ELLIPSIS", - "ELSE", - "EOF", - "EQL", - "FALLTHROUGH", - "FLOAT", - "FOR", - "FUNC", - "File", - "FileSet", - "GEQ", - "GO", - "GOTO", - "GTR", - "HighestPrec", - "IDENT", - "IF", - "ILLEGAL", - "IMAG", - "IMPORT", - "INC", - "INT", - "INTERFACE", - "IsExported", - "IsIdentifier", - "IsKeyword", - "LAND", - "LBRACE", - "LBRACK", - "LEQ", - "LOR", - "LPAREN", - "LSS", - "Lookup", - "LowestPrec", - "MAP", - "MUL", - "MUL_ASSIGN", - "NEQ", - "NOT", - "NewFileSet", - "NoPos", - "OR", - "OR_ASSIGN", - "PACKAGE", - "PERIOD", - "Pos", - "Position", - "QUO", - "QUO_ASSIGN", - "RANGE", - "RBRACE", - "RBRACK", - "REM", - "REM_ASSIGN", - "RETURN", - "RPAREN", - "SELECT", - "SEMICOLON", - "SHL", - "SHL_ASSIGN", - "SHR", - "SHR_ASSIGN", - "STRING", - "STRUCT", - "SUB", - "SUB_ASSIGN", - "SWITCH", - "TILDE", - "TYPE", - "Token", - "UnaryPrec", - "VAR", - "XOR", - "XOR_ASSIGN", - }, - "go/types": { - "ArgumentError", - "Array", - "AssertableTo", - "AssignableTo", - "Basic", - "BasicInfo", - "BasicKind", - "Bool", - "Builtin", - "Byte", - "Chan", - "ChanDir", - "CheckExpr", - "Checker", - "Comparable", - "Complex128", - "Complex64", - "Config", - "Const", - "Context", - "ConvertibleTo", - "DefPredeclaredTestFuncs", - "Default", - "Error", - "Eval", - "ExprString", - "FieldVal", - "Float32", - "Float64", - "Func", - "Id", - "Identical", - "IdenticalIgnoreTags", - "Implements", - "ImportMode", - "Importer", - "ImporterFrom", - "Info", - "Initializer", - "Instance", - "Instantiate", - "Int", - "Int16", - "Int32", - "Int64", - "Int8", - "Interface", - "Invalid", - "IsBoolean", - "IsComplex", - "IsConstType", - "IsFloat", - "IsInteger", - "IsInterface", - "IsNumeric", - "IsOrdered", - "IsString", - "IsUnsigned", - "IsUntyped", - "Label", - "LookupFieldOrMethod", - "Map", - "MethodExpr", - "MethodSet", - "MethodVal", - "MissingMethod", - "Named", - "NewArray", - "NewChan", - "NewChecker", - "NewConst", - "NewContext", - "NewField", - "NewFunc", - "NewInterface", - "NewInterfaceType", - "NewLabel", - "NewMap", - "NewMethodSet", - "NewNamed", - "NewPackage", - "NewParam", - "NewPkgName", - "NewPointer", - "NewScope", - "NewSignature", - "NewSignatureType", - "NewSlice", - "NewStruct", - "NewTerm", - "NewTuple", - "NewTypeName", - "NewTypeParam", - "NewUnion", - "NewVar", - "Nil", - "Object", - "ObjectString", - "Package", - "PkgName", - "Pointer", - "Qualifier", - "RecvOnly", - "RelativeTo", - "Rune", - "Satisfies", - "Scope", - "Selection", - "SelectionKind", - "SelectionString", - "SendOnly", - "SendRecv", - "Signature", - "Sizes", - "SizesFor", - "Slice", - "StdSizes", - "String", - "Struct", - "Term", - "Tuple", - "Typ", - "Type", - "TypeAndValue", - "TypeList", - "TypeName", - "TypeParam", - "TypeParamList", - "TypeString", - "Uint", - "Uint16", - "Uint32", - "Uint64", - "Uint8", - "Uintptr", - "Union", - "Universe", - "Unsafe", - "UnsafePointer", - "UntypedBool", - "UntypedComplex", - "UntypedFloat", - "UntypedInt", - "UntypedNil", - "UntypedRune", - "UntypedString", - "Var", - "WriteExpr", - "WriteSignature", - "WriteType", - }, - "hash": { - "Hash", - "Hash32", - "Hash64", - }, - "hash/adler32": { - "Checksum", - "New", - "Size", - }, - "hash/crc32": { - "Castagnoli", - "Checksum", - "ChecksumIEEE", - "IEEE", - "IEEETable", - "Koopman", - "MakeTable", - "New", - "NewIEEE", - "Size", - "Table", - "Update", - }, - "hash/crc64": { - "Checksum", - "ECMA", - "ISO", - "MakeTable", - "New", - "Size", - "Table", - "Update", - }, - "hash/fnv": { - "New128", - "New128a", - "New32", - "New32a", - "New64", - "New64a", - }, - "hash/maphash": { - "Bytes", - "Hash", - "MakeSeed", - "Seed", - "String", - }, - "html": { - "EscapeString", - "UnescapeString", - }, - "html/template": { - "CSS", - "ErrAmbigContext", - "ErrBadHTML", - "ErrBranchEnd", - "ErrEndContext", - "ErrJSTemplate", - "ErrNoSuchTemplate", - "ErrOutputContext", - "ErrPartialCharset", - "ErrPartialEscape", - "ErrPredefinedEscaper", - "ErrRangeLoopReentry", - "ErrSlashAmbig", - "Error", - "ErrorCode", - "FuncMap", - "HTML", - "HTMLAttr", - "HTMLEscape", - "HTMLEscapeString", - "HTMLEscaper", - "IsTrue", - "JS", - "JSEscape", - "JSEscapeString", - "JSEscaper", - "JSStr", - "Must", - "New", - "OK", - "ParseFS", - "ParseFiles", - "ParseGlob", - "Srcset", - "Template", - "URL", - "URLQueryEscaper", - }, - "image": { - "Alpha", - "Alpha16", - "Black", - "CMYK", - "Config", - "Decode", - "DecodeConfig", - "ErrFormat", - "Gray", - "Gray16", - "Image", - "NRGBA", - "NRGBA64", - "NYCbCrA", - "NewAlpha", - "NewAlpha16", - "NewCMYK", - "NewGray", - "NewGray16", - "NewNRGBA", - "NewNRGBA64", - "NewNYCbCrA", - "NewPaletted", - "NewRGBA", - "NewRGBA64", - "NewUniform", - "NewYCbCr", - "Opaque", - "Paletted", - "PalettedImage", - "Point", - "Pt", - "RGBA", - "RGBA64", - "RGBA64Image", - "Rect", - "Rectangle", - "RegisterFormat", - "Transparent", - "Uniform", - "White", - "YCbCr", - "YCbCrSubsampleRatio", - "YCbCrSubsampleRatio410", - "YCbCrSubsampleRatio411", - "YCbCrSubsampleRatio420", - "YCbCrSubsampleRatio422", - "YCbCrSubsampleRatio440", - "YCbCrSubsampleRatio444", - "ZP", - "ZR", - }, - "image/color": { - "Alpha", - "Alpha16", - "Alpha16Model", - "AlphaModel", - "Black", - "CMYK", - "CMYKModel", - "CMYKToRGB", - "Color", - "Gray", - "Gray16", - "Gray16Model", - "GrayModel", - "Model", - "ModelFunc", - "NRGBA", - "NRGBA64", - "NRGBA64Model", - "NRGBAModel", - "NYCbCrA", - "NYCbCrAModel", - "Opaque", - "Palette", - "RGBA", - "RGBA64", - "RGBA64Model", - "RGBAModel", - "RGBToCMYK", - "RGBToYCbCr", - "Transparent", - "White", - "YCbCr", - "YCbCrModel", - "YCbCrToRGB", - }, - "image/color/palette": { - "Plan9", - "WebSafe", - }, - "image/draw": { - "Draw", - "DrawMask", - "Drawer", - "FloydSteinberg", - "Image", - "Op", - "Over", - "Quantizer", - "RGBA64Image", - "Src", - }, - "image/gif": { - "Decode", - "DecodeAll", - "DecodeConfig", - "DisposalBackground", - "DisposalNone", - "DisposalPrevious", - "Encode", - "EncodeAll", - "GIF", - "Options", - }, - "image/jpeg": { - "Decode", - "DecodeConfig", - "DefaultQuality", - "Encode", - "FormatError", - "Options", - "Reader", - "UnsupportedError", - }, - "image/png": { - "BestCompression", - "BestSpeed", - "CompressionLevel", - "Decode", - "DecodeConfig", - "DefaultCompression", - "Encode", - "Encoder", - "EncoderBuffer", - "EncoderBufferPool", - "FormatError", - "NoCompression", - "UnsupportedError", - }, - "index/suffixarray": { - "Index", - "New", - }, - "io": { - "ByteReader", - "ByteScanner", - "ByteWriter", - "Closer", - "Copy", - "CopyBuffer", - "CopyN", - "Discard", - "EOF", - "ErrClosedPipe", - "ErrNoProgress", - "ErrShortBuffer", - "ErrShortWrite", - "ErrUnexpectedEOF", - "LimitReader", - "LimitedReader", - "MultiReader", - "MultiWriter", - "NewOffsetWriter", - "NewSectionReader", - "NopCloser", - "OffsetWriter", - "Pipe", - "PipeReader", - "PipeWriter", - "ReadAll", - "ReadAtLeast", - "ReadCloser", - "ReadFull", - "ReadSeekCloser", - "ReadSeeker", - "ReadWriteCloser", - "ReadWriteSeeker", - "ReadWriter", - "Reader", - "ReaderAt", - "ReaderFrom", - "RuneReader", - "RuneScanner", - "SectionReader", - "SeekCurrent", - "SeekEnd", - "SeekStart", - "Seeker", - "StringWriter", - "TeeReader", - "WriteCloser", - "WriteSeeker", - "WriteString", - "Writer", - "WriterAt", - "WriterTo", - }, - "io/fs": { - "DirEntry", - "ErrClosed", - "ErrExist", - "ErrInvalid", - "ErrNotExist", - "ErrPermission", - "FS", - "File", - "FileInfo", - "FileInfoToDirEntry", - "FileMode", - "FormatDirEntry", - "FormatFileInfo", - "Glob", - "GlobFS", - "ModeAppend", - "ModeCharDevice", - "ModeDevice", - "ModeDir", - "ModeExclusive", - "ModeIrregular", - "ModeNamedPipe", - "ModePerm", - "ModeSetgid", - "ModeSetuid", - "ModeSocket", - "ModeSticky", - "ModeSymlink", - "ModeTemporary", - "ModeType", - "PathError", - "ReadDir", - "ReadDirFS", - "ReadDirFile", - "ReadFile", - "ReadFileFS", - "SkipAll", - "SkipDir", - "Stat", - "StatFS", - "Sub", - "SubFS", - "ValidPath", - "WalkDir", - "WalkDirFunc", - }, - "io/ioutil": { - "Discard", - "NopCloser", - "ReadAll", - "ReadDir", - "ReadFile", - "TempDir", - "TempFile", - "WriteFile", - }, - "log": { - "Default", - "Fatal", - "Fatalf", - "Fatalln", - "Flags", - "LUTC", - "Ldate", - "Llongfile", - "Lmicroseconds", - "Lmsgprefix", - "Logger", - "Lshortfile", - "LstdFlags", - "Ltime", - "New", - "Output", - "Panic", - "Panicf", - "Panicln", - "Prefix", - "Print", - "Printf", - "Println", - "SetFlags", - "SetOutput", - "SetPrefix", - "Writer", - }, - "log/slog": { - "Any", - "AnyValue", - "Attr", - "Bool", - "BoolValue", - "Debug", - "DebugContext", - "Default", - "Duration", - "DurationValue", - "Error", - "ErrorContext", - "Float64", - "Float64Value", - "Group", - "GroupValue", - "Handler", - "HandlerOptions", - "Info", - "InfoContext", - "Int", - "Int64", - "Int64Value", - "IntValue", - "JSONHandler", - "Kind", - "KindAny", - "KindBool", - "KindDuration", - "KindFloat64", - "KindGroup", - "KindInt64", - "KindLogValuer", - "KindString", - "KindTime", - "KindUint64", - "Level", - "LevelDebug", - "LevelError", - "LevelInfo", - "LevelKey", - "LevelVar", - "LevelWarn", - "Leveler", - "Log", - "LogAttrs", - "LogValuer", - "Logger", - "MessageKey", - "New", - "NewJSONHandler", - "NewLogLogger", - "NewRecord", - "NewTextHandler", - "Record", - "SetDefault", - "Source", - "SourceKey", - "String", - "StringValue", - "TextHandler", - "Time", - "TimeKey", - "TimeValue", - "Uint64", - "Uint64Value", - "Value", - "Warn", - "WarnContext", - "With", - }, - "log/syslog": { - "Dial", - "LOG_ALERT", - "LOG_AUTH", - "LOG_AUTHPRIV", - "LOG_CRIT", - "LOG_CRON", - "LOG_DAEMON", - "LOG_DEBUG", - "LOG_EMERG", - "LOG_ERR", - "LOG_FTP", - "LOG_INFO", - "LOG_KERN", - "LOG_LOCAL0", - "LOG_LOCAL1", - "LOG_LOCAL2", - "LOG_LOCAL3", - "LOG_LOCAL4", - "LOG_LOCAL5", - "LOG_LOCAL6", - "LOG_LOCAL7", - "LOG_LPR", - "LOG_MAIL", - "LOG_NEWS", - "LOG_NOTICE", - "LOG_SYSLOG", - "LOG_USER", - "LOG_UUCP", - "LOG_WARNING", - "New", - "NewLogger", - "Priority", - "Writer", - }, - "maps": { - "Clone", - "Copy", - "DeleteFunc", - "Equal", - "EqualFunc", - }, - "math": { - "Abs", - "Acos", - "Acosh", - "Asin", - "Asinh", - "Atan", - "Atan2", - "Atanh", - "Cbrt", - "Ceil", - "Copysign", - "Cos", - "Cosh", - "Dim", - "E", - "Erf", - "Erfc", - "Erfcinv", - "Erfinv", - "Exp", - "Exp2", - "Expm1", - "FMA", - "Float32bits", - "Float32frombits", - "Float64bits", - "Float64frombits", - "Floor", - "Frexp", - "Gamma", - "Hypot", - "Ilogb", - "Inf", - "IsInf", - "IsNaN", - "J0", - "J1", - "Jn", - "Ldexp", - "Lgamma", - "Ln10", - "Ln2", - "Log", - "Log10", - "Log10E", - "Log1p", - "Log2", - "Log2E", - "Logb", - "Max", - "MaxFloat32", - "MaxFloat64", - "MaxInt", - "MaxInt16", - "MaxInt32", - "MaxInt64", - "MaxInt8", - "MaxUint", - "MaxUint16", - "MaxUint32", - "MaxUint64", - "MaxUint8", - "Min", - "MinInt", - "MinInt16", - "MinInt32", - "MinInt64", - "MinInt8", - "Mod", - "Modf", - "NaN", - "Nextafter", - "Nextafter32", - "Phi", - "Pi", - "Pow", - "Pow10", - "Remainder", - "Round", - "RoundToEven", - "Signbit", - "Sin", - "Sincos", - "Sinh", - "SmallestNonzeroFloat32", - "SmallestNonzeroFloat64", - "Sqrt", - "Sqrt2", - "SqrtE", - "SqrtPhi", - "SqrtPi", - "Tan", - "Tanh", - "Trunc", - "Y0", - "Y1", - "Yn", - }, - "math/big": { - "Above", - "Accuracy", - "AwayFromZero", - "Below", - "ErrNaN", - "Exact", - "Float", - "Int", - "Jacobi", - "MaxBase", - "MaxExp", - "MaxPrec", - "MinExp", - "NewFloat", - "NewInt", - "NewRat", - "ParseFloat", - "Rat", - "RoundingMode", - "ToNearestAway", - "ToNearestEven", - "ToNegativeInf", - "ToPositiveInf", - "ToZero", - "Word", - }, - "math/bits": { - "Add", - "Add32", - "Add64", - "Div", - "Div32", - "Div64", - "LeadingZeros", - "LeadingZeros16", - "LeadingZeros32", - "LeadingZeros64", - "LeadingZeros8", - "Len", - "Len16", - "Len32", - "Len64", - "Len8", - "Mul", - "Mul32", - "Mul64", - "OnesCount", - "OnesCount16", - "OnesCount32", - "OnesCount64", - "OnesCount8", - "Rem", - "Rem32", - "Rem64", - "Reverse", - "Reverse16", - "Reverse32", - "Reverse64", - "Reverse8", - "ReverseBytes", - "ReverseBytes16", - "ReverseBytes32", - "ReverseBytes64", - "RotateLeft", - "RotateLeft16", - "RotateLeft32", - "RotateLeft64", - "RotateLeft8", - "Sub", - "Sub32", - "Sub64", - "TrailingZeros", - "TrailingZeros16", - "TrailingZeros32", - "TrailingZeros64", - "TrailingZeros8", - "UintSize", - }, - "math/cmplx": { - "Abs", - "Acos", - "Acosh", - "Asin", - "Asinh", - "Atan", - "Atanh", - "Conj", - "Cos", - "Cosh", - "Cot", - "Exp", - "Inf", - "IsInf", - "IsNaN", - "Log", - "Log10", - "NaN", - "Phase", - "Polar", - "Pow", - "Rect", - "Sin", - "Sinh", - "Sqrt", - "Tan", - "Tanh", - }, - "math/rand": { - "ExpFloat64", - "Float32", - "Float64", - "Int", - "Int31", - "Int31n", - "Int63", - "Int63n", - "Intn", - "New", - "NewSource", - "NewZipf", - "NormFloat64", - "Perm", - "Rand", - "Read", - "Seed", - "Shuffle", - "Source", - "Source64", - "Uint32", - "Uint64", - "Zipf", - }, - "mime": { - "AddExtensionType", - "BEncoding", - "ErrInvalidMediaParameter", - "ExtensionsByType", - "FormatMediaType", - "ParseMediaType", - "QEncoding", - "TypeByExtension", - "WordDecoder", - "WordEncoder", - }, - "mime/multipart": { - "ErrMessageTooLarge", - "File", - "FileHeader", - "Form", - "NewReader", - "NewWriter", - "Part", - "Reader", - "Writer", - }, - "mime/quotedprintable": { - "NewReader", - "NewWriter", - "Reader", - "Writer", - }, - "net": { - "Addr", - "AddrError", - "Buffers", - "CIDRMask", - "Conn", - "DNSConfigError", - "DNSError", - "DefaultResolver", - "Dial", - "DialIP", - "DialTCP", - "DialTimeout", - "DialUDP", - "DialUnix", - "Dialer", - "ErrClosed", - "ErrWriteToConnected", - "Error", - "FileConn", - "FileListener", - "FilePacketConn", - "FlagBroadcast", - "FlagLoopback", - "FlagMulticast", - "FlagPointToPoint", - "FlagRunning", - "FlagUp", - "Flags", - "HardwareAddr", - "IP", - "IPAddr", - "IPConn", - "IPMask", - "IPNet", - "IPv4", - "IPv4Mask", - "IPv4allrouter", - "IPv4allsys", - "IPv4bcast", - "IPv4len", - "IPv4zero", - "IPv6interfacelocalallnodes", - "IPv6len", - "IPv6linklocalallnodes", - "IPv6linklocalallrouters", - "IPv6loopback", - "IPv6unspecified", - "IPv6zero", - "Interface", - "InterfaceAddrs", - "InterfaceByIndex", - "InterfaceByName", - "Interfaces", - "InvalidAddrError", - "JoinHostPort", - "Listen", - "ListenConfig", - "ListenIP", - "ListenMulticastUDP", - "ListenPacket", - "ListenTCP", - "ListenUDP", - "ListenUnix", - "ListenUnixgram", - "Listener", - "LookupAddr", - "LookupCNAME", - "LookupHost", - "LookupIP", - "LookupMX", - "LookupNS", - "LookupPort", - "LookupSRV", - "LookupTXT", - "MX", - "NS", - "OpError", - "PacketConn", - "ParseCIDR", - "ParseError", - "ParseIP", - "ParseMAC", - "Pipe", - "ResolveIPAddr", - "ResolveTCPAddr", - "ResolveUDPAddr", - "ResolveUnixAddr", - "Resolver", - "SRV", - "SplitHostPort", - "TCPAddr", - "TCPAddrFromAddrPort", - "TCPConn", - "TCPListener", - "UDPAddr", - "UDPAddrFromAddrPort", - "UDPConn", - "UnixAddr", - "UnixConn", - "UnixListener", - "UnknownNetworkError", - }, - "net/http": { - "AllowQuerySemicolons", - "CanonicalHeaderKey", - "Client", - "CloseNotifier", - "ConnState", - "Cookie", - "CookieJar", - "DefaultClient", - "DefaultMaxHeaderBytes", - "DefaultMaxIdleConnsPerHost", - "DefaultServeMux", - "DefaultTransport", - "DetectContentType", - "Dir", - "ErrAbortHandler", - "ErrBodyNotAllowed", - "ErrBodyReadAfterClose", - "ErrContentLength", - "ErrHandlerTimeout", - "ErrHeaderTooLong", - "ErrHijacked", - "ErrLineTooLong", - "ErrMissingBoundary", - "ErrMissingContentLength", - "ErrMissingFile", - "ErrNoCookie", - "ErrNoLocation", - "ErrNotMultipart", - "ErrNotSupported", - "ErrSchemeMismatch", - "ErrServerClosed", - "ErrShortBody", - "ErrSkipAltProtocol", - "ErrUnexpectedTrailer", - "ErrUseLastResponse", - "ErrWriteAfterFlush", - "Error", - "FS", - "File", - "FileServer", - "FileSystem", - "Flusher", - "Get", - "Handle", - "HandleFunc", - "Handler", - "HandlerFunc", - "Head", - "Header", - "Hijacker", - "ListenAndServe", - "ListenAndServeTLS", - "LocalAddrContextKey", - "MaxBytesError", - "MaxBytesHandler", - "MaxBytesReader", - "MethodConnect", - "MethodDelete", - "MethodGet", - "MethodHead", - "MethodOptions", - "MethodPatch", - "MethodPost", - "MethodPut", - "MethodTrace", - "NewFileTransport", - "NewRequest", - "NewRequestWithContext", - "NewResponseController", - "NewServeMux", - "NoBody", - "NotFound", - "NotFoundHandler", - "ParseHTTPVersion", - "ParseTime", - "Post", - "PostForm", - "ProtocolError", - "ProxyFromEnvironment", - "ProxyURL", - "PushOptions", - "Pusher", - "ReadRequest", - "ReadResponse", - "Redirect", - "RedirectHandler", - "Request", - "Response", - "ResponseController", - "ResponseWriter", - "RoundTripper", - "SameSite", - "SameSiteDefaultMode", - "SameSiteLaxMode", - "SameSiteNoneMode", - "SameSiteStrictMode", - "Serve", - "ServeContent", - "ServeFile", - "ServeMux", - "ServeTLS", - "Server", - "ServerContextKey", - "SetCookie", - "StateActive", - "StateClosed", - "StateHijacked", - "StateIdle", - "StateNew", - "StatusAccepted", - "StatusAlreadyReported", - "StatusBadGateway", - "StatusBadRequest", - "StatusConflict", - "StatusContinue", - "StatusCreated", - "StatusEarlyHints", - "StatusExpectationFailed", - "StatusFailedDependency", - "StatusForbidden", - "StatusFound", - "StatusGatewayTimeout", - "StatusGone", - "StatusHTTPVersionNotSupported", - "StatusIMUsed", - "StatusInsufficientStorage", - "StatusInternalServerError", - "StatusLengthRequired", - "StatusLocked", - "StatusLoopDetected", - "StatusMethodNotAllowed", - "StatusMisdirectedRequest", - "StatusMovedPermanently", - "StatusMultiStatus", - "StatusMultipleChoices", - "StatusNetworkAuthenticationRequired", - "StatusNoContent", - "StatusNonAuthoritativeInfo", - "StatusNotAcceptable", - "StatusNotExtended", - "StatusNotFound", - "StatusNotImplemented", - "StatusNotModified", - "StatusOK", - "StatusPartialContent", - "StatusPaymentRequired", - "StatusPermanentRedirect", - "StatusPreconditionFailed", - "StatusPreconditionRequired", - "StatusProcessing", - "StatusProxyAuthRequired", - "StatusRequestEntityTooLarge", - "StatusRequestHeaderFieldsTooLarge", - "StatusRequestTimeout", - "StatusRequestURITooLong", - "StatusRequestedRangeNotSatisfiable", - "StatusResetContent", - "StatusSeeOther", - "StatusServiceUnavailable", - "StatusSwitchingProtocols", - "StatusTeapot", - "StatusTemporaryRedirect", - "StatusText", - "StatusTooEarly", - "StatusTooManyRequests", - "StatusUnauthorized", - "StatusUnavailableForLegalReasons", - "StatusUnprocessableEntity", - "StatusUnsupportedMediaType", - "StatusUpgradeRequired", - "StatusUseProxy", - "StatusVariantAlsoNegotiates", - "StripPrefix", - "TimeFormat", - "TimeoutHandler", - "TrailerPrefix", - "Transport", - }, - "net/http/cgi": { - "Handler", - "Request", - "RequestFromMap", - "Serve", - }, - "net/http/cookiejar": { - "Jar", - "New", - "Options", - "PublicSuffixList", - }, - "net/http/fcgi": { - "ErrConnClosed", - "ErrRequestAborted", - "ProcessEnv", - "Serve", - }, - "net/http/httptest": { - "DefaultRemoteAddr", - "NewRecorder", - "NewRequest", - "NewServer", - "NewTLSServer", - "NewUnstartedServer", - "ResponseRecorder", - "Server", - }, - "net/http/httptrace": { - "ClientTrace", - "ContextClientTrace", - "DNSDoneInfo", - "DNSStartInfo", - "GotConnInfo", - "WithClientTrace", - "WroteRequestInfo", - }, - "net/http/httputil": { - "BufferPool", - "ClientConn", - "DumpRequest", - "DumpRequestOut", - "DumpResponse", - "ErrClosed", - "ErrLineTooLong", - "ErrPersistEOF", - "ErrPipeline", - "NewChunkedReader", - "NewChunkedWriter", - "NewClientConn", - "NewProxyClientConn", - "NewServerConn", - "NewSingleHostReverseProxy", - "ProxyRequest", - "ReverseProxy", - "ServerConn", - }, - "net/http/pprof": { - "Cmdline", - "Handler", - "Index", - "Profile", - "Symbol", - "Trace", - }, - "net/mail": { - "Address", - "AddressParser", - "ErrHeaderNotPresent", - "Header", - "Message", - "ParseAddress", - "ParseAddressList", - "ParseDate", - "ReadMessage", - }, - "net/netip": { - "Addr", - "AddrFrom16", - "AddrFrom4", - "AddrFromSlice", - "AddrPort", - "AddrPortFrom", - "IPv4Unspecified", - "IPv6LinkLocalAllNodes", - "IPv6LinkLocalAllRouters", - "IPv6Loopback", - "IPv6Unspecified", - "MustParseAddr", - "MustParseAddrPort", - "MustParsePrefix", - "ParseAddr", - "ParseAddrPort", - "ParsePrefix", - "Prefix", - "PrefixFrom", - }, - "net/rpc": { - "Accept", - "Call", - "Client", - "ClientCodec", - "DefaultDebugPath", - "DefaultRPCPath", - "DefaultServer", - "Dial", - "DialHTTP", - "DialHTTPPath", - "ErrShutdown", - "HandleHTTP", - "NewClient", - "NewClientWithCodec", - "NewServer", - "Register", - "RegisterName", - "Request", - "Response", - "ServeCodec", - "ServeConn", - "ServeRequest", - "Server", - "ServerCodec", - "ServerError", - }, - "net/rpc/jsonrpc": { - "Dial", - "NewClient", - "NewClientCodec", - "NewServerCodec", - "ServeConn", - }, - "net/smtp": { - "Auth", - "CRAMMD5Auth", - "Client", - "Dial", - "NewClient", - "PlainAuth", - "SendMail", - "ServerInfo", - }, - "net/textproto": { - "CanonicalMIMEHeaderKey", - "Conn", - "Dial", - "Error", - "MIMEHeader", - "NewConn", - "NewReader", - "NewWriter", - "Pipeline", - "ProtocolError", - "Reader", - "TrimBytes", - "TrimString", - "Writer", - }, - "net/url": { - "Error", - "EscapeError", - "InvalidHostError", - "JoinPath", - "Parse", - "ParseQuery", - "ParseRequestURI", - "PathEscape", - "PathUnescape", - "QueryEscape", - "QueryUnescape", - "URL", - "User", - "UserPassword", - "Userinfo", - "Values", - }, - "os": { - "Args", - "Chdir", - "Chmod", - "Chown", - "Chtimes", - "Clearenv", - "Create", - "CreateTemp", - "DevNull", - "DirEntry", - "DirFS", - "Environ", - "ErrClosed", - "ErrDeadlineExceeded", - "ErrExist", - "ErrInvalid", - "ErrNoDeadline", - "ErrNotExist", - "ErrPermission", - "ErrProcessDone", - "Executable", - "Exit", - "Expand", - "ExpandEnv", - "File", - "FileInfo", - "FileMode", - "FindProcess", - "Getegid", - "Getenv", - "Geteuid", - "Getgid", - "Getgroups", - "Getpagesize", - "Getpid", - "Getppid", - "Getuid", - "Getwd", - "Hostname", - "Interrupt", - "IsExist", - "IsNotExist", - "IsPathSeparator", - "IsPermission", - "IsTimeout", - "Kill", - "Lchown", - "Link", - "LinkError", - "LookupEnv", - "Lstat", - "Mkdir", - "MkdirAll", - "MkdirTemp", - "ModeAppend", - "ModeCharDevice", - "ModeDevice", - "ModeDir", - "ModeExclusive", - "ModeIrregular", - "ModeNamedPipe", - "ModePerm", - "ModeSetgid", - "ModeSetuid", - "ModeSocket", - "ModeSticky", - "ModeSymlink", - "ModeTemporary", - "ModeType", - "NewFile", - "NewSyscallError", - "O_APPEND", - "O_CREATE", - "O_EXCL", - "O_RDONLY", - "O_RDWR", - "O_SYNC", - "O_TRUNC", - "O_WRONLY", - "Open", - "OpenFile", - "PathError", - "PathListSeparator", - "PathSeparator", - "Pipe", - "ProcAttr", - "Process", - "ProcessState", - "ReadDir", - "ReadFile", - "Readlink", - "Remove", - "RemoveAll", - "Rename", - "SEEK_CUR", - "SEEK_END", - "SEEK_SET", - "SameFile", - "Setenv", - "Signal", - "StartProcess", - "Stat", - "Stderr", - "Stdin", - "Stdout", - "Symlink", - "SyscallError", - "TempDir", - "Truncate", - "Unsetenv", - "UserCacheDir", - "UserConfigDir", - "UserHomeDir", - "WriteFile", - }, - "os/exec": { - "Cmd", - "Command", - "CommandContext", - "ErrDot", - "ErrNotFound", - "ErrWaitDelay", - "Error", - "ExitError", - "LookPath", - }, - "os/signal": { - "Ignore", - "Ignored", - "Notify", - "NotifyContext", - "Reset", - "Stop", - }, - "os/user": { - "Current", - "Group", - "Lookup", - "LookupGroup", - "LookupGroupId", - "LookupId", - "UnknownGroupError", - "UnknownGroupIdError", - "UnknownUserError", - "UnknownUserIdError", - "User", - }, - "path": { - "Base", - "Clean", - "Dir", - "ErrBadPattern", - "Ext", - "IsAbs", - "Join", - "Match", - "Split", - }, - "path/filepath": { - "Abs", - "Base", - "Clean", - "Dir", - "ErrBadPattern", - "EvalSymlinks", - "Ext", - "FromSlash", - "Glob", - "HasPrefix", - "IsAbs", - "IsLocal", - "Join", - "ListSeparator", - "Match", - "Rel", - "Separator", - "SkipAll", - "SkipDir", - "Split", - "SplitList", - "ToSlash", - "VolumeName", - "Walk", - "WalkDir", - "WalkFunc", - }, - "plugin": { - "Open", - "Plugin", - "Symbol", - }, - "reflect": { - "Append", - "AppendSlice", - "Array", - "ArrayOf", - "Bool", - "BothDir", - "Chan", - "ChanDir", - "ChanOf", - "Complex128", - "Complex64", - "Copy", - "DeepEqual", - "Float32", - "Float64", - "Func", - "FuncOf", - "Indirect", - "Int", - "Int16", - "Int32", - "Int64", - "Int8", - "Interface", - "Invalid", - "Kind", - "MakeChan", - "MakeFunc", - "MakeMap", - "MakeMapWithSize", - "MakeSlice", - "Map", - "MapIter", - "MapOf", - "Method", - "New", - "NewAt", - "Pointer", - "PointerTo", - "Ptr", - "PtrTo", - "RecvDir", - "Select", - "SelectCase", - "SelectDefault", - "SelectDir", - "SelectRecv", - "SelectSend", - "SendDir", - "Slice", - "SliceHeader", - "SliceOf", - "String", - "StringHeader", - "Struct", - "StructField", - "StructOf", - "StructTag", - "Swapper", - "Type", - "TypeOf", - "Uint", - "Uint16", - "Uint32", - "Uint64", - "Uint8", - "Uintptr", - "UnsafePointer", - "Value", - "ValueError", - "ValueOf", - "VisibleFields", - "Zero", - }, - "regexp": { - "Compile", - "CompilePOSIX", - "Match", - "MatchReader", - "MatchString", - "MustCompile", - "MustCompilePOSIX", - "QuoteMeta", - "Regexp", - }, - "regexp/syntax": { - "ClassNL", - "Compile", - "DotNL", - "EmptyBeginLine", - "EmptyBeginText", - "EmptyEndLine", - "EmptyEndText", - "EmptyNoWordBoundary", - "EmptyOp", - "EmptyOpContext", - "EmptyWordBoundary", - "ErrInternalError", - "ErrInvalidCharClass", - "ErrInvalidCharRange", - "ErrInvalidEscape", - "ErrInvalidNamedCapture", - "ErrInvalidPerlOp", - "ErrInvalidRepeatOp", - "ErrInvalidRepeatSize", - "ErrInvalidUTF8", - "ErrLarge", - "ErrMissingBracket", - "ErrMissingParen", - "ErrMissingRepeatArgument", - "ErrNestingDepth", - "ErrTrailingBackslash", - "ErrUnexpectedParen", - "Error", - "ErrorCode", - "Flags", - "FoldCase", - "Inst", - "InstAlt", - "InstAltMatch", - "InstCapture", - "InstEmptyWidth", - "InstFail", - "InstMatch", - "InstNop", - "InstOp", - "InstRune", - "InstRune1", - "InstRuneAny", - "InstRuneAnyNotNL", - "IsWordChar", - "Literal", - "MatchNL", - "NonGreedy", - "OneLine", - "Op", - "OpAlternate", - "OpAnyChar", - "OpAnyCharNotNL", - "OpBeginLine", - "OpBeginText", - "OpCapture", - "OpCharClass", - "OpConcat", - "OpEmptyMatch", - "OpEndLine", - "OpEndText", - "OpLiteral", - "OpNoMatch", - "OpNoWordBoundary", - "OpPlus", - "OpQuest", - "OpRepeat", - "OpStar", - "OpWordBoundary", - "POSIX", - "Parse", - "Perl", - "PerlX", - "Prog", - "Regexp", - "Simple", - "UnicodeGroups", - "WasDollar", - }, - "runtime": { - "BlockProfile", - "BlockProfileRecord", - "Breakpoint", - "CPUProfile", - "Caller", - "Callers", - "CallersFrames", - "Compiler", - "Error", - "Frame", - "Frames", - "Func", - "FuncForPC", - "GC", - "GOARCH", - "GOMAXPROCS", - "GOOS", - "GOROOT", - "Goexit", - "GoroutineProfile", - "Gosched", - "KeepAlive", - "LockOSThread", - "MemProfile", - "MemProfileRate", - "MemProfileRecord", - "MemStats", - "MutexProfile", - "NumCPU", - "NumCgoCall", - "NumGoroutine", - "PanicNilError", - "Pinner", - "ReadMemStats", - "ReadTrace", - "SetBlockProfileRate", - "SetCPUProfileRate", - "SetCgoTraceback", - "SetFinalizer", - "SetMutexProfileFraction", - "Stack", - "StackRecord", - "StartTrace", - "StopTrace", - "ThreadCreateProfile", - "TypeAssertionError", - "UnlockOSThread", - "Version", - }, - "runtime/cgo": { - "Handle", - "Incomplete", - "NewHandle", - }, - "runtime/coverage": { - "ClearCounters", - "WriteCounters", - "WriteCountersDir", - "WriteMeta", - "WriteMetaDir", - }, - "runtime/debug": { - "BuildInfo", - "BuildSetting", - "FreeOSMemory", - "GCStats", - "Module", - "ParseBuildInfo", - "PrintStack", - "ReadBuildInfo", - "ReadGCStats", - "SetGCPercent", - "SetMaxStack", - "SetMaxThreads", - "SetMemoryLimit", - "SetPanicOnFault", - "SetTraceback", - "Stack", - "WriteHeapDump", - }, - "runtime/metrics": { - "All", - "Description", - "Float64Histogram", - "KindBad", - "KindFloat64", - "KindFloat64Histogram", - "KindUint64", - "Read", - "Sample", - "Value", - "ValueKind", - }, - "runtime/pprof": { - "Do", - "ForLabels", - "Label", - "LabelSet", - "Labels", - "Lookup", - "NewProfile", - "Profile", - "Profiles", - "SetGoroutineLabels", - "StartCPUProfile", - "StopCPUProfile", - "WithLabels", - "WriteHeapProfile", - }, - "runtime/trace": { - "IsEnabled", - "Log", - "Logf", - "NewTask", - "Region", - "Start", - "StartRegion", - "Stop", - "Task", - "WithRegion", - }, - "slices": { - "BinarySearch", - "BinarySearchFunc", - "Clip", - "Clone", - "Compact", - "CompactFunc", - "Compare", - "CompareFunc", - "Contains", - "ContainsFunc", - "Delete", - "DeleteFunc", - "Equal", - "EqualFunc", - "Grow", - "Index", - "IndexFunc", - "Insert", - "IsSorted", - "IsSortedFunc", - "Max", - "MaxFunc", - "Min", - "MinFunc", - "Replace", - "Reverse", - "Sort", - "SortFunc", - "SortStableFunc", - }, - "sort": { - "Find", - "Float64Slice", - "Float64s", - "Float64sAreSorted", - "IntSlice", - "Interface", - "Ints", - "IntsAreSorted", - "IsSorted", - "Reverse", - "Search", - "SearchFloat64s", - "SearchInts", - "SearchStrings", - "Slice", - "SliceIsSorted", - "SliceStable", - "Sort", - "Stable", - "StringSlice", - "Strings", - "StringsAreSorted", - }, - "strconv": { - "AppendBool", - "AppendFloat", - "AppendInt", - "AppendQuote", - "AppendQuoteRune", - "AppendQuoteRuneToASCII", - "AppendQuoteRuneToGraphic", - "AppendQuoteToASCII", - "AppendQuoteToGraphic", - "AppendUint", - "Atoi", - "CanBackquote", - "ErrRange", - "ErrSyntax", - "FormatBool", - "FormatComplex", - "FormatFloat", - "FormatInt", - "FormatUint", - "IntSize", - "IsGraphic", - "IsPrint", - "Itoa", - "NumError", - "ParseBool", - "ParseComplex", - "ParseFloat", - "ParseInt", - "ParseUint", - "Quote", - "QuoteRune", - "QuoteRuneToASCII", - "QuoteRuneToGraphic", - "QuoteToASCII", - "QuoteToGraphic", - "QuotedPrefix", - "Unquote", - "UnquoteChar", - }, - "strings": { - "Builder", - "Clone", - "Compare", - "Contains", - "ContainsAny", - "ContainsFunc", - "ContainsRune", - "Count", - "Cut", - "CutPrefix", - "CutSuffix", - "EqualFold", - "Fields", - "FieldsFunc", - "HasPrefix", - "HasSuffix", - "Index", - "IndexAny", - "IndexByte", - "IndexFunc", - "IndexRune", - "Join", - "LastIndex", - "LastIndexAny", - "LastIndexByte", - "LastIndexFunc", - "Map", - "NewReader", - "NewReplacer", - "Reader", - "Repeat", - "Replace", - "ReplaceAll", - "Replacer", - "Split", - "SplitAfter", - "SplitAfterN", - "SplitN", - "Title", - "ToLower", - "ToLowerSpecial", - "ToTitle", - "ToTitleSpecial", - "ToUpper", - "ToUpperSpecial", - "ToValidUTF8", - "Trim", - "TrimFunc", - "TrimLeft", - "TrimLeftFunc", - "TrimPrefix", - "TrimRight", - "TrimRightFunc", - "TrimSpace", - "TrimSuffix", - }, - "sync": { - "Cond", - "Locker", - "Map", - "Mutex", - "NewCond", - "Once", - "OnceFunc", - "OnceValue", - "OnceValues", - "Pool", - "RWMutex", - "WaitGroup", - }, - "sync/atomic": { - "AddInt32", - "AddInt64", - "AddUint32", - "AddUint64", - "AddUintptr", - "Bool", - "CompareAndSwapInt32", - "CompareAndSwapInt64", - "CompareAndSwapPointer", - "CompareAndSwapUint32", - "CompareAndSwapUint64", - "CompareAndSwapUintptr", - "Int32", - "Int64", - "LoadInt32", - "LoadInt64", - "LoadPointer", - "LoadUint32", - "LoadUint64", - "LoadUintptr", - "Pointer", - "StoreInt32", - "StoreInt64", - "StorePointer", - "StoreUint32", - "StoreUint64", - "StoreUintptr", - "SwapInt32", - "SwapInt64", - "SwapPointer", - "SwapUint32", - "SwapUint64", - "SwapUintptr", - "Uint32", - "Uint64", - "Uintptr", - "Value", - }, - "syscall": { - "AF_ALG", - "AF_APPLETALK", - "AF_ARP", - "AF_ASH", - "AF_ATM", - "AF_ATMPVC", - "AF_ATMSVC", - "AF_AX25", - "AF_BLUETOOTH", - "AF_BRIDGE", - "AF_CAIF", - "AF_CAN", - "AF_CCITT", - "AF_CHAOS", - "AF_CNT", - "AF_COIP", - "AF_DATAKIT", - "AF_DECnet", - "AF_DLI", - "AF_E164", - "AF_ECMA", - "AF_ECONET", - "AF_ENCAP", - "AF_FILE", - "AF_HYLINK", - "AF_IEEE80211", - "AF_IEEE802154", - "AF_IMPLINK", - "AF_INET", - "AF_INET6", - "AF_INET6_SDP", - "AF_INET_SDP", - "AF_IPX", - "AF_IRDA", - "AF_ISDN", - "AF_ISO", - "AF_IUCV", - "AF_KEY", - "AF_LAT", - "AF_LINK", - "AF_LLC", - "AF_LOCAL", - "AF_MAX", - "AF_MPLS", - "AF_NATM", - "AF_NDRV", - "AF_NETBEUI", - "AF_NETBIOS", - "AF_NETGRAPH", - "AF_NETLINK", - "AF_NETROM", - "AF_NS", - "AF_OROUTE", - "AF_OSI", - "AF_PACKET", - "AF_PHONET", - "AF_PPP", - "AF_PPPOX", - "AF_PUP", - "AF_RDS", - "AF_RESERVED_36", - "AF_ROSE", - "AF_ROUTE", - "AF_RXRPC", - "AF_SCLUSTER", - "AF_SECURITY", - "AF_SIP", - "AF_SLOW", - "AF_SNA", - "AF_SYSTEM", - "AF_TIPC", - "AF_UNIX", - "AF_UNSPEC", - "AF_UTUN", - "AF_VENDOR00", - "AF_VENDOR01", - "AF_VENDOR02", - "AF_VENDOR03", - "AF_VENDOR04", - "AF_VENDOR05", - "AF_VENDOR06", - "AF_VENDOR07", - "AF_VENDOR08", - "AF_VENDOR09", - "AF_VENDOR10", - "AF_VENDOR11", - "AF_VENDOR12", - "AF_VENDOR13", - "AF_VENDOR14", - "AF_VENDOR15", - "AF_VENDOR16", - "AF_VENDOR17", - "AF_VENDOR18", - "AF_VENDOR19", - "AF_VENDOR20", - "AF_VENDOR21", - "AF_VENDOR22", - "AF_VENDOR23", - "AF_VENDOR24", - "AF_VENDOR25", - "AF_VENDOR26", - "AF_VENDOR27", - "AF_VENDOR28", - "AF_VENDOR29", - "AF_VENDOR30", - "AF_VENDOR31", - "AF_VENDOR32", - "AF_VENDOR33", - "AF_VENDOR34", - "AF_VENDOR35", - "AF_VENDOR36", - "AF_VENDOR37", - "AF_VENDOR38", - "AF_VENDOR39", - "AF_VENDOR40", - "AF_VENDOR41", - "AF_VENDOR42", - "AF_VENDOR43", - "AF_VENDOR44", - "AF_VENDOR45", - "AF_VENDOR46", - "AF_VENDOR47", - "AF_WANPIPE", - "AF_X25", - "AI_CANONNAME", - "AI_NUMERICHOST", - "AI_PASSIVE", - "APPLICATION_ERROR", - "ARPHRD_ADAPT", - "ARPHRD_APPLETLK", - "ARPHRD_ARCNET", - "ARPHRD_ASH", - "ARPHRD_ATM", - "ARPHRD_AX25", - "ARPHRD_BIF", - "ARPHRD_CHAOS", - "ARPHRD_CISCO", - "ARPHRD_CSLIP", - "ARPHRD_CSLIP6", - "ARPHRD_DDCMP", - "ARPHRD_DLCI", - "ARPHRD_ECONET", - "ARPHRD_EETHER", - "ARPHRD_ETHER", - "ARPHRD_EUI64", - "ARPHRD_FCAL", - "ARPHRD_FCFABRIC", - "ARPHRD_FCPL", - "ARPHRD_FCPP", - "ARPHRD_FDDI", - "ARPHRD_FRAD", - "ARPHRD_FRELAY", - "ARPHRD_HDLC", - "ARPHRD_HIPPI", - "ARPHRD_HWX25", - "ARPHRD_IEEE1394", - "ARPHRD_IEEE802", - "ARPHRD_IEEE80211", - "ARPHRD_IEEE80211_PRISM", - "ARPHRD_IEEE80211_RADIOTAP", - "ARPHRD_IEEE802154", - "ARPHRD_IEEE802154_PHY", - "ARPHRD_IEEE802_TR", - "ARPHRD_INFINIBAND", - "ARPHRD_IPDDP", - "ARPHRD_IPGRE", - "ARPHRD_IRDA", - "ARPHRD_LAPB", - "ARPHRD_LOCALTLK", - "ARPHRD_LOOPBACK", - "ARPHRD_METRICOM", - "ARPHRD_NETROM", - "ARPHRD_NONE", - "ARPHRD_PIMREG", - "ARPHRD_PPP", - "ARPHRD_PRONET", - "ARPHRD_RAWHDLC", - "ARPHRD_ROSE", - "ARPHRD_RSRVD", - "ARPHRD_SIT", - "ARPHRD_SKIP", - "ARPHRD_SLIP", - "ARPHRD_SLIP6", - "ARPHRD_STRIP", - "ARPHRD_TUNNEL", - "ARPHRD_TUNNEL6", - "ARPHRD_VOID", - "ARPHRD_X25", - "AUTHTYPE_CLIENT", - "AUTHTYPE_SERVER", - "Accept", - "Accept4", - "AcceptEx", - "Access", - "Acct", - "AddrinfoW", - "Adjtime", - "Adjtimex", - "AllThreadsSyscall", - "AllThreadsSyscall6", - "AttachLsf", - "B0", - "B1000000", - "B110", - "B115200", - "B1152000", - "B1200", - "B134", - "B14400", - "B150", - "B1500000", - "B1800", - "B19200", - "B200", - "B2000000", - "B230400", - "B2400", - "B2500000", - "B28800", - "B300", - "B3000000", - "B3500000", - "B38400", - "B4000000", - "B460800", - "B4800", - "B50", - "B500000", - "B57600", - "B576000", - "B600", - "B7200", - "B75", - "B76800", - "B921600", - "B9600", - "BASE_PROTOCOL", - "BIOCFEEDBACK", - "BIOCFLUSH", - "BIOCGBLEN", - "BIOCGDIRECTION", - "BIOCGDIRFILT", - "BIOCGDLT", - "BIOCGDLTLIST", - "BIOCGETBUFMODE", - "BIOCGETIF", - "BIOCGETZMAX", - "BIOCGFEEDBACK", - "BIOCGFILDROP", - "BIOCGHDRCMPLT", - "BIOCGRSIG", - "BIOCGRTIMEOUT", - "BIOCGSEESENT", - "BIOCGSTATS", - "BIOCGSTATSOLD", - "BIOCGTSTAMP", - "BIOCIMMEDIATE", - "BIOCLOCK", - "BIOCPROMISC", - "BIOCROTZBUF", - "BIOCSBLEN", - "BIOCSDIRECTION", - "BIOCSDIRFILT", - "BIOCSDLT", - "BIOCSETBUFMODE", - "BIOCSETF", - "BIOCSETFNR", - "BIOCSETIF", - "BIOCSETWF", - "BIOCSETZBUF", - "BIOCSFEEDBACK", - "BIOCSFILDROP", - "BIOCSHDRCMPLT", - "BIOCSRSIG", - "BIOCSRTIMEOUT", - "BIOCSSEESENT", - "BIOCSTCPF", - "BIOCSTSTAMP", - "BIOCSUDPF", - "BIOCVERSION", - "BPF_A", - "BPF_ABS", - "BPF_ADD", - "BPF_ALIGNMENT", - "BPF_ALIGNMENT32", - "BPF_ALU", - "BPF_AND", - "BPF_B", - "BPF_BUFMODE_BUFFER", - "BPF_BUFMODE_ZBUF", - "BPF_DFLTBUFSIZE", - "BPF_DIRECTION_IN", - "BPF_DIRECTION_OUT", - "BPF_DIV", - "BPF_H", - "BPF_IMM", - "BPF_IND", - "BPF_JA", - "BPF_JEQ", - "BPF_JGE", - "BPF_JGT", - "BPF_JMP", - "BPF_JSET", - "BPF_K", - "BPF_LD", - "BPF_LDX", - "BPF_LEN", - "BPF_LSH", - "BPF_MAJOR_VERSION", - "BPF_MAXBUFSIZE", - "BPF_MAXINSNS", - "BPF_MEM", - "BPF_MEMWORDS", - "BPF_MINBUFSIZE", - "BPF_MINOR_VERSION", - "BPF_MISC", - "BPF_MSH", - "BPF_MUL", - "BPF_NEG", - "BPF_OR", - "BPF_RELEASE", - "BPF_RET", - "BPF_RSH", - "BPF_ST", - "BPF_STX", - "BPF_SUB", - "BPF_TAX", - "BPF_TXA", - "BPF_T_BINTIME", - "BPF_T_BINTIME_FAST", - "BPF_T_BINTIME_MONOTONIC", - "BPF_T_BINTIME_MONOTONIC_FAST", - "BPF_T_FAST", - "BPF_T_FLAG_MASK", - "BPF_T_FORMAT_MASK", - "BPF_T_MICROTIME", - "BPF_T_MICROTIME_FAST", - "BPF_T_MICROTIME_MONOTONIC", - "BPF_T_MICROTIME_MONOTONIC_FAST", - "BPF_T_MONOTONIC", - "BPF_T_MONOTONIC_FAST", - "BPF_T_NANOTIME", - "BPF_T_NANOTIME_FAST", - "BPF_T_NANOTIME_MONOTONIC", - "BPF_T_NANOTIME_MONOTONIC_FAST", - "BPF_T_NONE", - "BPF_T_NORMAL", - "BPF_W", - "BPF_X", - "BRKINT", - "Bind", - "BindToDevice", - "BpfBuflen", - "BpfDatalink", - "BpfHdr", - "BpfHeadercmpl", - "BpfInsn", - "BpfInterface", - "BpfJump", - "BpfProgram", - "BpfStat", - "BpfStats", - "BpfStmt", - "BpfTimeout", - "BpfTimeval", - "BpfVersion", - "BpfZbuf", - "BpfZbufHeader", - "ByHandleFileInformation", - "BytePtrFromString", - "ByteSliceFromString", - "CCR0_FLUSH", - "CERT_CHAIN_POLICY_AUTHENTICODE", - "CERT_CHAIN_POLICY_AUTHENTICODE_TS", - "CERT_CHAIN_POLICY_BASE", - "CERT_CHAIN_POLICY_BASIC_CONSTRAINTS", - "CERT_CHAIN_POLICY_EV", - "CERT_CHAIN_POLICY_MICROSOFT_ROOT", - "CERT_CHAIN_POLICY_NT_AUTH", - "CERT_CHAIN_POLICY_SSL", - "CERT_E_CN_NO_MATCH", - "CERT_E_EXPIRED", - "CERT_E_PURPOSE", - "CERT_E_ROLE", - "CERT_E_UNTRUSTEDROOT", - "CERT_STORE_ADD_ALWAYS", - "CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG", - "CERT_STORE_PROV_MEMORY", - "CERT_TRUST_HAS_EXCLUDED_NAME_CONSTRAINT", - "CERT_TRUST_HAS_NOT_DEFINED_NAME_CONSTRAINT", - "CERT_TRUST_HAS_NOT_PERMITTED_NAME_CONSTRAINT", - "CERT_TRUST_HAS_NOT_SUPPORTED_CRITICAL_EXT", - "CERT_TRUST_HAS_NOT_SUPPORTED_NAME_CONSTRAINT", - "CERT_TRUST_INVALID_BASIC_CONSTRAINTS", - "CERT_TRUST_INVALID_EXTENSION", - "CERT_TRUST_INVALID_NAME_CONSTRAINTS", - "CERT_TRUST_INVALID_POLICY_CONSTRAINTS", - "CERT_TRUST_IS_CYCLIC", - "CERT_TRUST_IS_EXPLICIT_DISTRUST", - "CERT_TRUST_IS_NOT_SIGNATURE_VALID", - "CERT_TRUST_IS_NOT_TIME_VALID", - "CERT_TRUST_IS_NOT_VALID_FOR_USAGE", - "CERT_TRUST_IS_OFFLINE_REVOCATION", - "CERT_TRUST_IS_REVOKED", - "CERT_TRUST_IS_UNTRUSTED_ROOT", - "CERT_TRUST_NO_ERROR", - "CERT_TRUST_NO_ISSUANCE_CHAIN_POLICY", - "CERT_TRUST_REVOCATION_STATUS_UNKNOWN", - "CFLUSH", - "CLOCAL", - "CLONE_CHILD_CLEARTID", - "CLONE_CHILD_SETTID", - "CLONE_CLEAR_SIGHAND", - "CLONE_CSIGNAL", - "CLONE_DETACHED", - "CLONE_FILES", - "CLONE_FS", - "CLONE_INTO_CGROUP", - "CLONE_IO", - "CLONE_NEWCGROUP", - "CLONE_NEWIPC", - "CLONE_NEWNET", - "CLONE_NEWNS", - "CLONE_NEWPID", - "CLONE_NEWTIME", - "CLONE_NEWUSER", - "CLONE_NEWUTS", - "CLONE_PARENT", - "CLONE_PARENT_SETTID", - "CLONE_PID", - "CLONE_PIDFD", - "CLONE_PTRACE", - "CLONE_SETTLS", - "CLONE_SIGHAND", - "CLONE_SYSVSEM", - "CLONE_THREAD", - "CLONE_UNTRACED", - "CLONE_VFORK", - "CLONE_VM", - "CPUID_CFLUSH", - "CREAD", - "CREATE_ALWAYS", - "CREATE_NEW", - "CREATE_NEW_PROCESS_GROUP", - "CREATE_UNICODE_ENVIRONMENT", - "CRYPT_DEFAULT_CONTAINER_OPTIONAL", - "CRYPT_DELETEKEYSET", - "CRYPT_MACHINE_KEYSET", - "CRYPT_NEWKEYSET", - "CRYPT_SILENT", - "CRYPT_VERIFYCONTEXT", - "CS5", - "CS6", - "CS7", - "CS8", - "CSIZE", - "CSTART", - "CSTATUS", - "CSTOP", - "CSTOPB", - "CSUSP", - "CTL_MAXNAME", - "CTL_NET", - "CTL_QUERY", - "CTRL_BREAK_EVENT", - "CTRL_CLOSE_EVENT", - "CTRL_C_EVENT", - "CTRL_LOGOFF_EVENT", - "CTRL_SHUTDOWN_EVENT", - "CancelIo", - "CancelIoEx", - "CertAddCertificateContextToStore", - "CertChainContext", - "CertChainElement", - "CertChainPara", - "CertChainPolicyPara", - "CertChainPolicyStatus", - "CertCloseStore", - "CertContext", - "CertCreateCertificateContext", - "CertEnhKeyUsage", - "CertEnumCertificatesInStore", - "CertFreeCertificateChain", - "CertFreeCertificateContext", - "CertGetCertificateChain", - "CertInfo", - "CertOpenStore", - "CertOpenSystemStore", - "CertRevocationCrlInfo", - "CertRevocationInfo", - "CertSimpleChain", - "CertTrustListInfo", - "CertTrustStatus", - "CertUsageMatch", - "CertVerifyCertificateChainPolicy", - "Chdir", - "CheckBpfVersion", - "Chflags", - "Chmod", - "Chown", - "Chroot", - "Clearenv", - "Close", - "CloseHandle", - "CloseOnExec", - "Closesocket", - "CmsgLen", - "CmsgSpace", - "Cmsghdr", - "CommandLineToArgv", - "ComputerName", - "Conn", - "Connect", - "ConnectEx", - "ConvertSidToStringSid", - "ConvertStringSidToSid", - "CopySid", - "Creat", - "CreateDirectory", - "CreateFile", - "CreateFileMapping", - "CreateHardLink", - "CreateIoCompletionPort", - "CreatePipe", - "CreateProcess", - "CreateProcessAsUser", - "CreateSymbolicLink", - "CreateToolhelp32Snapshot", - "Credential", - "CryptAcquireContext", - "CryptGenRandom", - "CryptReleaseContext", - "DIOCBSFLUSH", - "DIOCOSFPFLUSH", - "DLL", - "DLLError", - "DLT_A429", - "DLT_A653_ICM", - "DLT_AIRONET_HEADER", - "DLT_AOS", - "DLT_APPLE_IP_OVER_IEEE1394", - "DLT_ARCNET", - "DLT_ARCNET_LINUX", - "DLT_ATM_CLIP", - "DLT_ATM_RFC1483", - "DLT_AURORA", - "DLT_AX25", - "DLT_AX25_KISS", - "DLT_BACNET_MS_TP", - "DLT_BLUETOOTH_HCI_H4", - "DLT_BLUETOOTH_HCI_H4_WITH_PHDR", - "DLT_CAN20B", - "DLT_CAN_SOCKETCAN", - "DLT_CHAOS", - "DLT_CHDLC", - "DLT_CISCO_IOS", - "DLT_C_HDLC", - "DLT_C_HDLC_WITH_DIR", - "DLT_DBUS", - "DLT_DECT", - "DLT_DOCSIS", - "DLT_DVB_CI", - "DLT_ECONET", - "DLT_EN10MB", - "DLT_EN3MB", - "DLT_ENC", - "DLT_ERF", - "DLT_ERF_ETH", - "DLT_ERF_POS", - "DLT_FC_2", - "DLT_FC_2_WITH_FRAME_DELIMS", - "DLT_FDDI", - "DLT_FLEXRAY", - "DLT_FRELAY", - "DLT_FRELAY_WITH_DIR", - "DLT_GCOM_SERIAL", - "DLT_GCOM_T1E1", - "DLT_GPF_F", - "DLT_GPF_T", - "DLT_GPRS_LLC", - "DLT_GSMTAP_ABIS", - "DLT_GSMTAP_UM", - "DLT_HDLC", - "DLT_HHDLC", - "DLT_HIPPI", - "DLT_IBM_SN", - "DLT_IBM_SP", - "DLT_IEEE802", - "DLT_IEEE802_11", - "DLT_IEEE802_11_RADIO", - "DLT_IEEE802_11_RADIO_AVS", - "DLT_IEEE802_15_4", - "DLT_IEEE802_15_4_LINUX", - "DLT_IEEE802_15_4_NOFCS", - "DLT_IEEE802_15_4_NONASK_PHY", - "DLT_IEEE802_16_MAC_CPS", - "DLT_IEEE802_16_MAC_CPS_RADIO", - "DLT_IPFILTER", - "DLT_IPMB", - "DLT_IPMB_LINUX", - "DLT_IPNET", - "DLT_IPOIB", - "DLT_IPV4", - "DLT_IPV6", - "DLT_IP_OVER_FC", - "DLT_JUNIPER_ATM1", - "DLT_JUNIPER_ATM2", - "DLT_JUNIPER_ATM_CEMIC", - "DLT_JUNIPER_CHDLC", - "DLT_JUNIPER_ES", - "DLT_JUNIPER_ETHER", - "DLT_JUNIPER_FIBRECHANNEL", - "DLT_JUNIPER_FRELAY", - "DLT_JUNIPER_GGSN", - "DLT_JUNIPER_ISM", - "DLT_JUNIPER_MFR", - "DLT_JUNIPER_MLFR", - "DLT_JUNIPER_MLPPP", - "DLT_JUNIPER_MONITOR", - "DLT_JUNIPER_PIC_PEER", - "DLT_JUNIPER_PPP", - "DLT_JUNIPER_PPPOE", - "DLT_JUNIPER_PPPOE_ATM", - "DLT_JUNIPER_SERVICES", - "DLT_JUNIPER_SRX_E2E", - "DLT_JUNIPER_ST", - "DLT_JUNIPER_VP", - "DLT_JUNIPER_VS", - "DLT_LAPB_WITH_DIR", - "DLT_LAPD", - "DLT_LIN", - "DLT_LINUX_EVDEV", - "DLT_LINUX_IRDA", - "DLT_LINUX_LAPD", - "DLT_LINUX_PPP_WITHDIRECTION", - "DLT_LINUX_SLL", - "DLT_LOOP", - "DLT_LTALK", - "DLT_MATCHING_MAX", - "DLT_MATCHING_MIN", - "DLT_MFR", - "DLT_MOST", - "DLT_MPEG_2_TS", - "DLT_MPLS", - "DLT_MTP2", - "DLT_MTP2_WITH_PHDR", - "DLT_MTP3", - "DLT_MUX27010", - "DLT_NETANALYZER", - "DLT_NETANALYZER_TRANSPARENT", - "DLT_NFC_LLCP", - "DLT_NFLOG", - "DLT_NG40", - "DLT_NULL", - "DLT_PCI_EXP", - "DLT_PFLOG", - "DLT_PFSYNC", - "DLT_PPI", - "DLT_PPP", - "DLT_PPP_BSDOS", - "DLT_PPP_ETHER", - "DLT_PPP_PPPD", - "DLT_PPP_SERIAL", - "DLT_PPP_WITH_DIR", - "DLT_PPP_WITH_DIRECTION", - "DLT_PRISM_HEADER", - "DLT_PRONET", - "DLT_RAIF1", - "DLT_RAW", - "DLT_RAWAF_MASK", - "DLT_RIO", - "DLT_SCCP", - "DLT_SITA", - "DLT_SLIP", - "DLT_SLIP_BSDOS", - "DLT_STANAG_5066_D_PDU", - "DLT_SUNATM", - "DLT_SYMANTEC_FIREWALL", - "DLT_TZSP", - "DLT_USB", - "DLT_USB_LINUX", - "DLT_USB_LINUX_MMAPPED", - "DLT_USER0", - "DLT_USER1", - "DLT_USER10", - "DLT_USER11", - "DLT_USER12", - "DLT_USER13", - "DLT_USER14", - "DLT_USER15", - "DLT_USER2", - "DLT_USER3", - "DLT_USER4", - "DLT_USER5", - "DLT_USER6", - "DLT_USER7", - "DLT_USER8", - "DLT_USER9", - "DLT_WIHART", - "DLT_X2E_SERIAL", - "DLT_X2E_XORAYA", - "DNSMXData", - "DNSPTRData", - "DNSRecord", - "DNSSRVData", - "DNSTXTData", - "DNS_INFO_NO_RECORDS", - "DNS_TYPE_A", - "DNS_TYPE_A6", - "DNS_TYPE_AAAA", - "DNS_TYPE_ADDRS", - "DNS_TYPE_AFSDB", - "DNS_TYPE_ALL", - "DNS_TYPE_ANY", - "DNS_TYPE_ATMA", - "DNS_TYPE_AXFR", - "DNS_TYPE_CERT", - "DNS_TYPE_CNAME", - "DNS_TYPE_DHCID", - "DNS_TYPE_DNAME", - "DNS_TYPE_DNSKEY", - "DNS_TYPE_DS", - "DNS_TYPE_EID", - "DNS_TYPE_GID", - "DNS_TYPE_GPOS", - "DNS_TYPE_HINFO", - "DNS_TYPE_ISDN", - "DNS_TYPE_IXFR", - "DNS_TYPE_KEY", - "DNS_TYPE_KX", - "DNS_TYPE_LOC", - "DNS_TYPE_MAILA", - "DNS_TYPE_MAILB", - "DNS_TYPE_MB", - "DNS_TYPE_MD", - "DNS_TYPE_MF", - "DNS_TYPE_MG", - "DNS_TYPE_MINFO", - "DNS_TYPE_MR", - "DNS_TYPE_MX", - "DNS_TYPE_NAPTR", - "DNS_TYPE_NBSTAT", - "DNS_TYPE_NIMLOC", - "DNS_TYPE_NS", - "DNS_TYPE_NSAP", - "DNS_TYPE_NSAPPTR", - "DNS_TYPE_NSEC", - "DNS_TYPE_NULL", - "DNS_TYPE_NXT", - "DNS_TYPE_OPT", - "DNS_TYPE_PTR", - "DNS_TYPE_PX", - "DNS_TYPE_RP", - "DNS_TYPE_RRSIG", - "DNS_TYPE_RT", - "DNS_TYPE_SIG", - "DNS_TYPE_SINK", - "DNS_TYPE_SOA", - "DNS_TYPE_SRV", - "DNS_TYPE_TEXT", - "DNS_TYPE_TKEY", - "DNS_TYPE_TSIG", - "DNS_TYPE_UID", - "DNS_TYPE_UINFO", - "DNS_TYPE_UNSPEC", - "DNS_TYPE_WINS", - "DNS_TYPE_WINSR", - "DNS_TYPE_WKS", - "DNS_TYPE_X25", - "DT_BLK", - "DT_CHR", - "DT_DIR", - "DT_FIFO", - "DT_LNK", - "DT_REG", - "DT_SOCK", - "DT_UNKNOWN", - "DT_WHT", - "DUPLICATE_CLOSE_SOURCE", - "DUPLICATE_SAME_ACCESS", - "DeleteFile", - "DetachLsf", - "DeviceIoControl", - "Dirent", - "DnsNameCompare", - "DnsQuery", - "DnsRecordListFree", - "DnsSectionAdditional", - "DnsSectionAnswer", - "DnsSectionAuthority", - "DnsSectionQuestion", - "Dup", - "Dup2", - "Dup3", - "DuplicateHandle", - "E2BIG", - "EACCES", - "EADDRINUSE", - "EADDRNOTAVAIL", - "EADV", - "EAFNOSUPPORT", - "EAGAIN", - "EALREADY", - "EAUTH", - "EBADARCH", - "EBADE", - "EBADEXEC", - "EBADF", - "EBADFD", - "EBADMACHO", - "EBADMSG", - "EBADR", - "EBADRPC", - "EBADRQC", - "EBADSLT", - "EBFONT", - "EBUSY", - "ECANCELED", - "ECAPMODE", - "ECHILD", - "ECHO", - "ECHOCTL", - "ECHOE", - "ECHOK", - "ECHOKE", - "ECHONL", - "ECHOPRT", - "ECHRNG", - "ECOMM", - "ECONNABORTED", - "ECONNREFUSED", - "ECONNRESET", - "EDEADLK", - "EDEADLOCK", - "EDESTADDRREQ", - "EDEVERR", - "EDOM", - "EDOOFUS", - "EDOTDOT", - "EDQUOT", - "EEXIST", - "EFAULT", - "EFBIG", - "EFER_LMA", - "EFER_LME", - "EFER_NXE", - "EFER_SCE", - "EFTYPE", - "EHOSTDOWN", - "EHOSTUNREACH", - "EHWPOISON", - "EIDRM", - "EILSEQ", - "EINPROGRESS", - "EINTR", - "EINVAL", - "EIO", - "EIPSEC", - "EISCONN", - "EISDIR", - "EISNAM", - "EKEYEXPIRED", - "EKEYREJECTED", - "EKEYREVOKED", - "EL2HLT", - "EL2NSYNC", - "EL3HLT", - "EL3RST", - "ELAST", - "ELF_NGREG", - "ELF_PRARGSZ", - "ELIBACC", - "ELIBBAD", - "ELIBEXEC", - "ELIBMAX", - "ELIBSCN", - "ELNRNG", - "ELOOP", - "EMEDIUMTYPE", - "EMFILE", - "EMLINK", - "EMSGSIZE", - "EMT_TAGOVF", - "EMULTIHOP", - "EMUL_ENABLED", - "EMUL_LINUX", - "EMUL_LINUX32", - "EMUL_MAXID", - "EMUL_NATIVE", - "ENAMETOOLONG", - "ENAVAIL", - "ENDRUNDISC", - "ENEEDAUTH", - "ENETDOWN", - "ENETRESET", - "ENETUNREACH", - "ENFILE", - "ENOANO", - "ENOATTR", - "ENOBUFS", - "ENOCSI", - "ENODATA", - "ENODEV", - "ENOENT", - "ENOEXEC", - "ENOKEY", - "ENOLCK", - "ENOLINK", - "ENOMEDIUM", - "ENOMEM", - "ENOMSG", - "ENONET", - "ENOPKG", - "ENOPOLICY", - "ENOPROTOOPT", - "ENOSPC", - "ENOSR", - "ENOSTR", - "ENOSYS", - "ENOTBLK", - "ENOTCAPABLE", - "ENOTCONN", - "ENOTDIR", - "ENOTEMPTY", - "ENOTNAM", - "ENOTRECOVERABLE", - "ENOTSOCK", - "ENOTSUP", - "ENOTTY", - "ENOTUNIQ", - "ENXIO", - "EN_SW_CTL_INF", - "EN_SW_CTL_PREC", - "EN_SW_CTL_ROUND", - "EN_SW_DATACHAIN", - "EN_SW_DENORM", - "EN_SW_INVOP", - "EN_SW_OVERFLOW", - "EN_SW_PRECLOSS", - "EN_SW_UNDERFLOW", - "EN_SW_ZERODIV", - "EOPNOTSUPP", - "EOVERFLOW", - "EOWNERDEAD", - "EPERM", - "EPFNOSUPPORT", - "EPIPE", - "EPOLLERR", - "EPOLLET", - "EPOLLHUP", - "EPOLLIN", - "EPOLLMSG", - "EPOLLONESHOT", - "EPOLLOUT", - "EPOLLPRI", - "EPOLLRDBAND", - "EPOLLRDHUP", - "EPOLLRDNORM", - "EPOLLWRBAND", - "EPOLLWRNORM", - "EPOLL_CLOEXEC", - "EPOLL_CTL_ADD", - "EPOLL_CTL_DEL", - "EPOLL_CTL_MOD", - "EPOLL_NONBLOCK", - "EPROCLIM", - "EPROCUNAVAIL", - "EPROGMISMATCH", - "EPROGUNAVAIL", - "EPROTO", - "EPROTONOSUPPORT", - "EPROTOTYPE", - "EPWROFF", - "EQFULL", - "ERANGE", - "EREMCHG", - "EREMOTE", - "EREMOTEIO", - "ERESTART", - "ERFKILL", - "EROFS", - "ERPCMISMATCH", - "ERROR_ACCESS_DENIED", - "ERROR_ALREADY_EXISTS", - "ERROR_BROKEN_PIPE", - "ERROR_BUFFER_OVERFLOW", - "ERROR_DIR_NOT_EMPTY", - "ERROR_ENVVAR_NOT_FOUND", - "ERROR_FILE_EXISTS", - "ERROR_FILE_NOT_FOUND", - "ERROR_HANDLE_EOF", - "ERROR_INSUFFICIENT_BUFFER", - "ERROR_IO_PENDING", - "ERROR_MOD_NOT_FOUND", - "ERROR_MORE_DATA", - "ERROR_NETNAME_DELETED", - "ERROR_NOT_FOUND", - "ERROR_NO_MORE_FILES", - "ERROR_OPERATION_ABORTED", - "ERROR_PATH_NOT_FOUND", - "ERROR_PRIVILEGE_NOT_HELD", - "ERROR_PROC_NOT_FOUND", - "ESHLIBVERS", - "ESHUTDOWN", - "ESOCKTNOSUPPORT", - "ESPIPE", - "ESRCH", - "ESRMNT", - "ESTALE", - "ESTRPIPE", - "ETHERCAP_JUMBO_MTU", - "ETHERCAP_VLAN_HWTAGGING", - "ETHERCAP_VLAN_MTU", - "ETHERMIN", - "ETHERMTU", - "ETHERMTU_JUMBO", - "ETHERTYPE_8023", - "ETHERTYPE_AARP", - "ETHERTYPE_ACCTON", - "ETHERTYPE_AEONIC", - "ETHERTYPE_ALPHA", - "ETHERTYPE_AMBER", - "ETHERTYPE_AMOEBA", - "ETHERTYPE_AOE", - "ETHERTYPE_APOLLO", - "ETHERTYPE_APOLLODOMAIN", - "ETHERTYPE_APPLETALK", - "ETHERTYPE_APPLITEK", - "ETHERTYPE_ARGONAUT", - "ETHERTYPE_ARP", - "ETHERTYPE_AT", - "ETHERTYPE_ATALK", - "ETHERTYPE_ATOMIC", - "ETHERTYPE_ATT", - "ETHERTYPE_ATTSTANFORD", - "ETHERTYPE_AUTOPHON", - "ETHERTYPE_AXIS", - "ETHERTYPE_BCLOOP", - "ETHERTYPE_BOFL", - "ETHERTYPE_CABLETRON", - "ETHERTYPE_CHAOS", - "ETHERTYPE_COMDESIGN", - "ETHERTYPE_COMPUGRAPHIC", - "ETHERTYPE_COUNTERPOINT", - "ETHERTYPE_CRONUS", - "ETHERTYPE_CRONUSVLN", - "ETHERTYPE_DCA", - "ETHERTYPE_DDE", - "ETHERTYPE_DEBNI", - "ETHERTYPE_DECAM", - "ETHERTYPE_DECCUST", - "ETHERTYPE_DECDIAG", - "ETHERTYPE_DECDNS", - "ETHERTYPE_DECDTS", - "ETHERTYPE_DECEXPER", - "ETHERTYPE_DECLAST", - "ETHERTYPE_DECLTM", - "ETHERTYPE_DECMUMPS", - "ETHERTYPE_DECNETBIOS", - "ETHERTYPE_DELTACON", - "ETHERTYPE_DIDDLE", - "ETHERTYPE_DLOG1", - "ETHERTYPE_DLOG2", - "ETHERTYPE_DN", - "ETHERTYPE_DOGFIGHT", - "ETHERTYPE_DSMD", - "ETHERTYPE_ECMA", - "ETHERTYPE_ENCRYPT", - "ETHERTYPE_ES", - "ETHERTYPE_EXCELAN", - "ETHERTYPE_EXPERDATA", - "ETHERTYPE_FLIP", - "ETHERTYPE_FLOWCONTROL", - "ETHERTYPE_FRARP", - "ETHERTYPE_GENDYN", - "ETHERTYPE_HAYES", - "ETHERTYPE_HIPPI_FP", - "ETHERTYPE_HITACHI", - "ETHERTYPE_HP", - "ETHERTYPE_IEEEPUP", - "ETHERTYPE_IEEEPUPAT", - "ETHERTYPE_IMLBL", - "ETHERTYPE_IMLBLDIAG", - "ETHERTYPE_IP", - "ETHERTYPE_IPAS", - "ETHERTYPE_IPV6", - "ETHERTYPE_IPX", - "ETHERTYPE_IPXNEW", - "ETHERTYPE_KALPANA", - "ETHERTYPE_LANBRIDGE", - "ETHERTYPE_LANPROBE", - "ETHERTYPE_LAT", - "ETHERTYPE_LBACK", - "ETHERTYPE_LITTLE", - "ETHERTYPE_LLDP", - "ETHERTYPE_LOGICRAFT", - "ETHERTYPE_LOOPBACK", - "ETHERTYPE_MATRA", - "ETHERTYPE_MAX", - "ETHERTYPE_MERIT", - "ETHERTYPE_MICP", - "ETHERTYPE_MOPDL", - "ETHERTYPE_MOPRC", - "ETHERTYPE_MOTOROLA", - "ETHERTYPE_MPLS", - "ETHERTYPE_MPLS_MCAST", - "ETHERTYPE_MUMPS", - "ETHERTYPE_NBPCC", - "ETHERTYPE_NBPCLAIM", - "ETHERTYPE_NBPCLREQ", - "ETHERTYPE_NBPCLRSP", - "ETHERTYPE_NBPCREQ", - "ETHERTYPE_NBPCRSP", - "ETHERTYPE_NBPDG", - "ETHERTYPE_NBPDGB", - "ETHERTYPE_NBPDLTE", - "ETHERTYPE_NBPRAR", - "ETHERTYPE_NBPRAS", - "ETHERTYPE_NBPRST", - "ETHERTYPE_NBPSCD", - "ETHERTYPE_NBPVCD", - "ETHERTYPE_NBS", - "ETHERTYPE_NCD", - "ETHERTYPE_NESTAR", - "ETHERTYPE_NETBEUI", - "ETHERTYPE_NOVELL", - "ETHERTYPE_NS", - "ETHERTYPE_NSAT", - "ETHERTYPE_NSCOMPAT", - "ETHERTYPE_NTRAILER", - "ETHERTYPE_OS9", - "ETHERTYPE_OS9NET", - "ETHERTYPE_PACER", - "ETHERTYPE_PAE", - "ETHERTYPE_PCS", - "ETHERTYPE_PLANNING", - "ETHERTYPE_PPP", - "ETHERTYPE_PPPOE", - "ETHERTYPE_PPPOEDISC", - "ETHERTYPE_PRIMENTS", - "ETHERTYPE_PUP", - "ETHERTYPE_PUPAT", - "ETHERTYPE_QINQ", - "ETHERTYPE_RACAL", - "ETHERTYPE_RATIONAL", - "ETHERTYPE_RAWFR", - "ETHERTYPE_RCL", - "ETHERTYPE_RDP", - "ETHERTYPE_RETIX", - "ETHERTYPE_REVARP", - "ETHERTYPE_SCA", - "ETHERTYPE_SECTRA", - "ETHERTYPE_SECUREDATA", - "ETHERTYPE_SGITW", - "ETHERTYPE_SG_BOUNCE", - "ETHERTYPE_SG_DIAG", - "ETHERTYPE_SG_NETGAMES", - "ETHERTYPE_SG_RESV", - "ETHERTYPE_SIMNET", - "ETHERTYPE_SLOW", - "ETHERTYPE_SLOWPROTOCOLS", - "ETHERTYPE_SNA", - "ETHERTYPE_SNMP", - "ETHERTYPE_SONIX", - "ETHERTYPE_SPIDER", - "ETHERTYPE_SPRITE", - "ETHERTYPE_STP", - "ETHERTYPE_TALARIS", - "ETHERTYPE_TALARISMC", - "ETHERTYPE_TCPCOMP", - "ETHERTYPE_TCPSM", - "ETHERTYPE_TEC", - "ETHERTYPE_TIGAN", - "ETHERTYPE_TRAIL", - "ETHERTYPE_TRANSETHER", - "ETHERTYPE_TYMSHARE", - "ETHERTYPE_UBBST", - "ETHERTYPE_UBDEBUG", - "ETHERTYPE_UBDIAGLOOP", - "ETHERTYPE_UBDL", - "ETHERTYPE_UBNIU", - "ETHERTYPE_UBNMC", - "ETHERTYPE_VALID", - "ETHERTYPE_VARIAN", - "ETHERTYPE_VAXELN", - "ETHERTYPE_VEECO", - "ETHERTYPE_VEXP", - "ETHERTYPE_VGLAB", - "ETHERTYPE_VINES", - "ETHERTYPE_VINESECHO", - "ETHERTYPE_VINESLOOP", - "ETHERTYPE_VITAL", - "ETHERTYPE_VLAN", - "ETHERTYPE_VLTLMAN", - "ETHERTYPE_VPROD", - "ETHERTYPE_VURESERVED", - "ETHERTYPE_WATERLOO", - "ETHERTYPE_WELLFLEET", - "ETHERTYPE_X25", - "ETHERTYPE_X75", - "ETHERTYPE_XNSSM", - "ETHERTYPE_XTP", - "ETHER_ADDR_LEN", - "ETHER_ALIGN", - "ETHER_CRC_LEN", - "ETHER_CRC_POLY_BE", - "ETHER_CRC_POLY_LE", - "ETHER_HDR_LEN", - "ETHER_MAX_DIX_LEN", - "ETHER_MAX_LEN", - "ETHER_MAX_LEN_JUMBO", - "ETHER_MIN_LEN", - "ETHER_PPPOE_ENCAP_LEN", - "ETHER_TYPE_LEN", - "ETHER_VLAN_ENCAP_LEN", - "ETH_P_1588", - "ETH_P_8021Q", - "ETH_P_802_2", - "ETH_P_802_3", - "ETH_P_AARP", - "ETH_P_ALL", - "ETH_P_AOE", - "ETH_P_ARCNET", - "ETH_P_ARP", - "ETH_P_ATALK", - "ETH_P_ATMFATE", - "ETH_P_ATMMPOA", - "ETH_P_AX25", - "ETH_P_BPQ", - "ETH_P_CAIF", - "ETH_P_CAN", - "ETH_P_CONTROL", - "ETH_P_CUST", - "ETH_P_DDCMP", - "ETH_P_DEC", - "ETH_P_DIAG", - "ETH_P_DNA_DL", - "ETH_P_DNA_RC", - "ETH_P_DNA_RT", - "ETH_P_DSA", - "ETH_P_ECONET", - "ETH_P_EDSA", - "ETH_P_FCOE", - "ETH_P_FIP", - "ETH_P_HDLC", - "ETH_P_IEEE802154", - "ETH_P_IEEEPUP", - "ETH_P_IEEEPUPAT", - "ETH_P_IP", - "ETH_P_IPV6", - "ETH_P_IPX", - "ETH_P_IRDA", - "ETH_P_LAT", - "ETH_P_LINK_CTL", - "ETH_P_LOCALTALK", - "ETH_P_LOOP", - "ETH_P_MOBITEX", - "ETH_P_MPLS_MC", - "ETH_P_MPLS_UC", - "ETH_P_PAE", - "ETH_P_PAUSE", - "ETH_P_PHONET", - "ETH_P_PPPTALK", - "ETH_P_PPP_DISC", - "ETH_P_PPP_MP", - "ETH_P_PPP_SES", - "ETH_P_PUP", - "ETH_P_PUPAT", - "ETH_P_RARP", - "ETH_P_SCA", - "ETH_P_SLOW", - "ETH_P_SNAP", - "ETH_P_TEB", - "ETH_P_TIPC", - "ETH_P_TRAILER", - "ETH_P_TR_802_2", - "ETH_P_WAN_PPP", - "ETH_P_WCCP", - "ETH_P_X25", - "ETIME", - "ETIMEDOUT", - "ETOOMANYREFS", - "ETXTBSY", - "EUCLEAN", - "EUNATCH", - "EUSERS", - "EVFILT_AIO", - "EVFILT_FS", - "EVFILT_LIO", - "EVFILT_MACHPORT", - "EVFILT_PROC", - "EVFILT_READ", - "EVFILT_SIGNAL", - "EVFILT_SYSCOUNT", - "EVFILT_THREADMARKER", - "EVFILT_TIMER", - "EVFILT_USER", - "EVFILT_VM", - "EVFILT_VNODE", - "EVFILT_WRITE", - "EV_ADD", - "EV_CLEAR", - "EV_DELETE", - "EV_DISABLE", - "EV_DISPATCH", - "EV_DROP", - "EV_ENABLE", - "EV_EOF", - "EV_ERROR", - "EV_FLAG0", - "EV_FLAG1", - "EV_ONESHOT", - "EV_OOBAND", - "EV_POLL", - "EV_RECEIPT", - "EV_SYSFLAGS", - "EWINDOWS", - "EWOULDBLOCK", - "EXDEV", - "EXFULL", - "EXTA", - "EXTB", - "EXTPROC", - "Environ", - "EpollCreate", - "EpollCreate1", - "EpollCtl", - "EpollEvent", - "EpollWait", - "Errno", - "EscapeArg", - "Exchangedata", - "Exec", - "Exit", - "ExitProcess", - "FD_CLOEXEC", - "FD_SETSIZE", - "FILE_ACTION_ADDED", - "FILE_ACTION_MODIFIED", - "FILE_ACTION_REMOVED", - "FILE_ACTION_RENAMED_NEW_NAME", - "FILE_ACTION_RENAMED_OLD_NAME", - "FILE_APPEND_DATA", - "FILE_ATTRIBUTE_ARCHIVE", - "FILE_ATTRIBUTE_DIRECTORY", - "FILE_ATTRIBUTE_HIDDEN", - "FILE_ATTRIBUTE_NORMAL", - "FILE_ATTRIBUTE_READONLY", - "FILE_ATTRIBUTE_REPARSE_POINT", - "FILE_ATTRIBUTE_SYSTEM", - "FILE_BEGIN", - "FILE_CURRENT", - "FILE_END", - "FILE_FLAG_BACKUP_SEMANTICS", - "FILE_FLAG_OPEN_REPARSE_POINT", - "FILE_FLAG_OVERLAPPED", - "FILE_LIST_DIRECTORY", - "FILE_MAP_COPY", - "FILE_MAP_EXECUTE", - "FILE_MAP_READ", - "FILE_MAP_WRITE", - "FILE_NOTIFY_CHANGE_ATTRIBUTES", - "FILE_NOTIFY_CHANGE_CREATION", - "FILE_NOTIFY_CHANGE_DIR_NAME", - "FILE_NOTIFY_CHANGE_FILE_NAME", - "FILE_NOTIFY_CHANGE_LAST_ACCESS", - "FILE_NOTIFY_CHANGE_LAST_WRITE", - "FILE_NOTIFY_CHANGE_SIZE", - "FILE_SHARE_DELETE", - "FILE_SHARE_READ", - "FILE_SHARE_WRITE", - "FILE_SKIP_COMPLETION_PORT_ON_SUCCESS", - "FILE_SKIP_SET_EVENT_ON_HANDLE", - "FILE_TYPE_CHAR", - "FILE_TYPE_DISK", - "FILE_TYPE_PIPE", - "FILE_TYPE_REMOTE", - "FILE_TYPE_UNKNOWN", - "FILE_WRITE_ATTRIBUTES", - "FLUSHO", - "FORMAT_MESSAGE_ALLOCATE_BUFFER", - "FORMAT_MESSAGE_ARGUMENT_ARRAY", - "FORMAT_MESSAGE_FROM_HMODULE", - "FORMAT_MESSAGE_FROM_STRING", - "FORMAT_MESSAGE_FROM_SYSTEM", - "FORMAT_MESSAGE_IGNORE_INSERTS", - "FORMAT_MESSAGE_MAX_WIDTH_MASK", - "FSCTL_GET_REPARSE_POINT", - "F_ADDFILESIGS", - "F_ADDSIGS", - "F_ALLOCATEALL", - "F_ALLOCATECONTIG", - "F_CANCEL", - "F_CHKCLEAN", - "F_CLOSEM", - "F_DUP2FD", - "F_DUP2FD_CLOEXEC", - "F_DUPFD", - "F_DUPFD_CLOEXEC", - "F_EXLCK", - "F_FINDSIGS", - "F_FLUSH_DATA", - "F_FREEZE_FS", - "F_FSCTL", - "F_FSDIRMASK", - "F_FSIN", - "F_FSINOUT", - "F_FSOUT", - "F_FSPRIV", - "F_FSVOID", - "F_FULLFSYNC", - "F_GETCODEDIR", - "F_GETFD", - "F_GETFL", - "F_GETLEASE", - "F_GETLK", - "F_GETLK64", - "F_GETLKPID", - "F_GETNOSIGPIPE", - "F_GETOWN", - "F_GETOWN_EX", - "F_GETPATH", - "F_GETPATH_MTMINFO", - "F_GETPIPE_SZ", - "F_GETPROTECTIONCLASS", - "F_GETPROTECTIONLEVEL", - "F_GETSIG", - "F_GLOBAL_NOCACHE", - "F_LOCK", - "F_LOG2PHYS", - "F_LOG2PHYS_EXT", - "F_MARKDEPENDENCY", - "F_MAXFD", - "F_NOCACHE", - "F_NODIRECT", - "F_NOTIFY", - "F_OGETLK", - "F_OK", - "F_OSETLK", - "F_OSETLKW", - "F_PARAM_MASK", - "F_PARAM_MAX", - "F_PATHPKG_CHECK", - "F_PEOFPOSMODE", - "F_PREALLOCATE", - "F_RDADVISE", - "F_RDAHEAD", - "F_RDLCK", - "F_READAHEAD", - "F_READBOOTSTRAP", - "F_SETBACKINGSTORE", - "F_SETFD", - "F_SETFL", - "F_SETLEASE", - "F_SETLK", - "F_SETLK64", - "F_SETLKW", - "F_SETLKW64", - "F_SETLKWTIMEOUT", - "F_SETLK_REMOTE", - "F_SETNOSIGPIPE", - "F_SETOWN", - "F_SETOWN_EX", - "F_SETPIPE_SZ", - "F_SETPROTECTIONCLASS", - "F_SETSIG", - "F_SETSIZE", - "F_SHLCK", - "F_SINGLE_WRITER", - "F_TEST", - "F_THAW_FS", - "F_TLOCK", - "F_TRANSCODEKEY", - "F_ULOCK", - "F_UNLCK", - "F_UNLCKSYS", - "F_VOLPOSMODE", - "F_WRITEBOOTSTRAP", - "F_WRLCK", - "Faccessat", - "Fallocate", - "Fbootstraptransfer_t", - "Fchdir", - "Fchflags", - "Fchmod", - "Fchmodat", - "Fchown", - "Fchownat", - "FcntlFlock", - "FdSet", - "Fdatasync", - "FileNotifyInformation", - "Filetime", - "FindClose", - "FindFirstFile", - "FindNextFile", - "Flock", - "Flock_t", - "FlushBpf", - "FlushFileBuffers", - "FlushViewOfFile", - "ForkExec", - "ForkLock", - "FormatMessage", - "Fpathconf", - "FreeAddrInfoW", - "FreeEnvironmentStrings", - "FreeLibrary", - "Fsid", - "Fstat", - "Fstatat", - "Fstatfs", - "Fstore_t", - "Fsync", - "Ftruncate", - "FullPath", - "Futimes", - "Futimesat", - "GENERIC_ALL", - "GENERIC_EXECUTE", - "GENERIC_READ", - "GENERIC_WRITE", - "GUID", - "GetAcceptExSockaddrs", - "GetAdaptersInfo", - "GetAddrInfoW", - "GetCommandLine", - "GetComputerName", - "GetConsoleMode", - "GetCurrentDirectory", - "GetCurrentProcess", - "GetEnvironmentStrings", - "GetEnvironmentVariable", - "GetExitCodeProcess", - "GetFileAttributes", - "GetFileAttributesEx", - "GetFileExInfoStandard", - "GetFileExMaxInfoLevel", - "GetFileInformationByHandle", - "GetFileType", - "GetFullPathName", - "GetHostByName", - "GetIfEntry", - "GetLastError", - "GetLengthSid", - "GetLongPathName", - "GetProcAddress", - "GetProcessTimes", - "GetProtoByName", - "GetQueuedCompletionStatus", - "GetServByName", - "GetShortPathName", - "GetStartupInfo", - "GetStdHandle", - "GetSystemTimeAsFileTime", - "GetTempPath", - "GetTimeZoneInformation", - "GetTokenInformation", - "GetUserNameEx", - "GetUserProfileDirectory", - "GetVersion", - "Getcwd", - "Getdents", - "Getdirentries", - "Getdtablesize", - "Getegid", - "Getenv", - "Geteuid", - "Getfsstat", - "Getgid", - "Getgroups", - "Getpagesize", - "Getpeername", - "Getpgid", - "Getpgrp", - "Getpid", - "Getppid", - "Getpriority", - "Getrlimit", - "Getrusage", - "Getsid", - "Getsockname", - "Getsockopt", - "GetsockoptByte", - "GetsockoptICMPv6Filter", - "GetsockoptIPMreq", - "GetsockoptIPMreqn", - "GetsockoptIPv6MTUInfo", - "GetsockoptIPv6Mreq", - "GetsockoptInet4Addr", - "GetsockoptInt", - "GetsockoptUcred", - "Gettid", - "Gettimeofday", - "Getuid", - "Getwd", - "Getxattr", - "HANDLE_FLAG_INHERIT", - "HKEY_CLASSES_ROOT", - "HKEY_CURRENT_CONFIG", - "HKEY_CURRENT_USER", - "HKEY_DYN_DATA", - "HKEY_LOCAL_MACHINE", - "HKEY_PERFORMANCE_DATA", - "HKEY_USERS", - "HUPCL", - "Handle", - "Hostent", - "ICANON", - "ICMP6_FILTER", - "ICMPV6_FILTER", - "ICMPv6Filter", - "ICRNL", - "IEXTEN", - "IFAN_ARRIVAL", - "IFAN_DEPARTURE", - "IFA_ADDRESS", - "IFA_ANYCAST", - "IFA_BROADCAST", - "IFA_CACHEINFO", - "IFA_F_DADFAILED", - "IFA_F_DEPRECATED", - "IFA_F_HOMEADDRESS", - "IFA_F_NODAD", - "IFA_F_OPTIMISTIC", - "IFA_F_PERMANENT", - "IFA_F_SECONDARY", - "IFA_F_TEMPORARY", - "IFA_F_TENTATIVE", - "IFA_LABEL", - "IFA_LOCAL", - "IFA_MAX", - "IFA_MULTICAST", - "IFA_ROUTE", - "IFA_UNSPEC", - "IFF_ALLMULTI", - "IFF_ALTPHYS", - "IFF_AUTOMEDIA", - "IFF_BROADCAST", - "IFF_CANTCHANGE", - "IFF_CANTCONFIG", - "IFF_DEBUG", - "IFF_DRV_OACTIVE", - "IFF_DRV_RUNNING", - "IFF_DYING", - "IFF_DYNAMIC", - "IFF_LINK0", - "IFF_LINK1", - "IFF_LINK2", - "IFF_LOOPBACK", - "IFF_MASTER", - "IFF_MONITOR", - "IFF_MULTICAST", - "IFF_NOARP", - "IFF_NOTRAILERS", - "IFF_NO_PI", - "IFF_OACTIVE", - "IFF_ONE_QUEUE", - "IFF_POINTOPOINT", - "IFF_POINTTOPOINT", - "IFF_PORTSEL", - "IFF_PPROMISC", - "IFF_PROMISC", - "IFF_RENAMING", - "IFF_RUNNING", - "IFF_SIMPLEX", - "IFF_SLAVE", - "IFF_SMART", - "IFF_STATICARP", - "IFF_TAP", - "IFF_TUN", - "IFF_TUN_EXCL", - "IFF_UP", - "IFF_VNET_HDR", - "IFLA_ADDRESS", - "IFLA_BROADCAST", - "IFLA_COST", - "IFLA_IFALIAS", - "IFLA_IFNAME", - "IFLA_LINK", - "IFLA_LINKINFO", - "IFLA_LINKMODE", - "IFLA_MAP", - "IFLA_MASTER", - "IFLA_MAX", - "IFLA_MTU", - "IFLA_NET_NS_PID", - "IFLA_OPERSTATE", - "IFLA_PRIORITY", - "IFLA_PROTINFO", - "IFLA_QDISC", - "IFLA_STATS", - "IFLA_TXQLEN", - "IFLA_UNSPEC", - "IFLA_WEIGHT", - "IFLA_WIRELESS", - "IFNAMSIZ", - "IFT_1822", - "IFT_A12MPPSWITCH", - "IFT_AAL2", - "IFT_AAL5", - "IFT_ADSL", - "IFT_AFLANE8023", - "IFT_AFLANE8025", - "IFT_ARAP", - "IFT_ARCNET", - "IFT_ARCNETPLUS", - "IFT_ASYNC", - "IFT_ATM", - "IFT_ATMDXI", - "IFT_ATMFUNI", - "IFT_ATMIMA", - "IFT_ATMLOGICAL", - "IFT_ATMRADIO", - "IFT_ATMSUBINTERFACE", - "IFT_ATMVCIENDPT", - "IFT_ATMVIRTUAL", - "IFT_BGPPOLICYACCOUNTING", - "IFT_BLUETOOTH", - "IFT_BRIDGE", - "IFT_BSC", - "IFT_CARP", - "IFT_CCTEMUL", - "IFT_CELLULAR", - "IFT_CEPT", - "IFT_CES", - "IFT_CHANNEL", - "IFT_CNR", - "IFT_COFFEE", - "IFT_COMPOSITELINK", - "IFT_DCN", - "IFT_DIGITALPOWERLINE", - "IFT_DIGITALWRAPPEROVERHEADCHANNEL", - "IFT_DLSW", - "IFT_DOCSCABLEDOWNSTREAM", - "IFT_DOCSCABLEMACLAYER", - "IFT_DOCSCABLEUPSTREAM", - "IFT_DOCSCABLEUPSTREAMCHANNEL", - "IFT_DS0", - "IFT_DS0BUNDLE", - "IFT_DS1FDL", - "IFT_DS3", - "IFT_DTM", - "IFT_DUMMY", - "IFT_DVBASILN", - "IFT_DVBASIOUT", - "IFT_DVBRCCDOWNSTREAM", - "IFT_DVBRCCMACLAYER", - "IFT_DVBRCCUPSTREAM", - "IFT_ECONET", - "IFT_ENC", - "IFT_EON", - "IFT_EPLRS", - "IFT_ESCON", - "IFT_ETHER", - "IFT_FAITH", - "IFT_FAST", - "IFT_FASTETHER", - "IFT_FASTETHERFX", - "IFT_FDDI", - "IFT_FIBRECHANNEL", - "IFT_FRAMERELAYINTERCONNECT", - "IFT_FRAMERELAYMPI", - "IFT_FRDLCIENDPT", - "IFT_FRELAY", - "IFT_FRELAYDCE", - "IFT_FRF16MFRBUNDLE", - "IFT_FRFORWARD", - "IFT_G703AT2MB", - "IFT_G703AT64K", - "IFT_GIF", - "IFT_GIGABITETHERNET", - "IFT_GR303IDT", - "IFT_GR303RDT", - "IFT_H323GATEKEEPER", - "IFT_H323PROXY", - "IFT_HDH1822", - "IFT_HDLC", - "IFT_HDSL2", - "IFT_HIPERLAN2", - "IFT_HIPPI", - "IFT_HIPPIINTERFACE", - "IFT_HOSTPAD", - "IFT_HSSI", - "IFT_HY", - "IFT_IBM370PARCHAN", - "IFT_IDSL", - "IFT_IEEE1394", - "IFT_IEEE80211", - "IFT_IEEE80212", - "IFT_IEEE8023ADLAG", - "IFT_IFGSN", - "IFT_IMT", - "IFT_INFINIBAND", - "IFT_INTERLEAVE", - "IFT_IP", - "IFT_IPFORWARD", - "IFT_IPOVERATM", - "IFT_IPOVERCDLC", - "IFT_IPOVERCLAW", - "IFT_IPSWITCH", - "IFT_IPXIP", - "IFT_ISDN", - "IFT_ISDNBASIC", - "IFT_ISDNPRIMARY", - "IFT_ISDNS", - "IFT_ISDNU", - "IFT_ISO88022LLC", - "IFT_ISO88023", - "IFT_ISO88024", - "IFT_ISO88025", - "IFT_ISO88025CRFPINT", - "IFT_ISO88025DTR", - "IFT_ISO88025FIBER", - "IFT_ISO88026", - "IFT_ISUP", - "IFT_L2VLAN", - "IFT_L3IPVLAN", - "IFT_L3IPXVLAN", - "IFT_LAPB", - "IFT_LAPD", - "IFT_LAPF", - "IFT_LINEGROUP", - "IFT_LOCALTALK", - "IFT_LOOP", - "IFT_MEDIAMAILOVERIP", - "IFT_MFSIGLINK", - "IFT_MIOX25", - "IFT_MODEM", - "IFT_MPC", - "IFT_MPLS", - "IFT_MPLSTUNNEL", - "IFT_MSDSL", - "IFT_MVL", - "IFT_MYRINET", - "IFT_NFAS", - "IFT_NSIP", - "IFT_OPTICALCHANNEL", - "IFT_OPTICALTRANSPORT", - "IFT_OTHER", - "IFT_P10", - "IFT_P80", - "IFT_PARA", - "IFT_PDP", - "IFT_PFLOG", - "IFT_PFLOW", - "IFT_PFSYNC", - "IFT_PLC", - "IFT_PON155", - "IFT_PON622", - "IFT_POS", - "IFT_PPP", - "IFT_PPPMULTILINKBUNDLE", - "IFT_PROPATM", - "IFT_PROPBWAP2MP", - "IFT_PROPCNLS", - "IFT_PROPDOCSWIRELESSDOWNSTREAM", - "IFT_PROPDOCSWIRELESSMACLAYER", - "IFT_PROPDOCSWIRELESSUPSTREAM", - "IFT_PROPMUX", - "IFT_PROPVIRTUAL", - "IFT_PROPWIRELESSP2P", - "IFT_PTPSERIAL", - "IFT_PVC", - "IFT_Q2931", - "IFT_QLLC", - "IFT_RADIOMAC", - "IFT_RADSL", - "IFT_REACHDSL", - "IFT_RFC1483", - "IFT_RS232", - "IFT_RSRB", - "IFT_SDLC", - "IFT_SDSL", - "IFT_SHDSL", - "IFT_SIP", - "IFT_SIPSIG", - "IFT_SIPTG", - "IFT_SLIP", - "IFT_SMDSDXI", - "IFT_SMDSICIP", - "IFT_SONET", - "IFT_SONETOVERHEADCHANNEL", - "IFT_SONETPATH", - "IFT_SONETVT", - "IFT_SRP", - "IFT_SS7SIGLINK", - "IFT_STACKTOSTACK", - "IFT_STARLAN", - "IFT_STF", - "IFT_T1", - "IFT_TDLC", - "IFT_TELINK", - "IFT_TERMPAD", - "IFT_TR008", - "IFT_TRANSPHDLC", - "IFT_TUNNEL", - "IFT_ULTRA", - "IFT_USB", - "IFT_V11", - "IFT_V35", - "IFT_V36", - "IFT_V37", - "IFT_VDSL", - "IFT_VIRTUALIPADDRESS", - "IFT_VIRTUALTG", - "IFT_VOICEDID", - "IFT_VOICEEM", - "IFT_VOICEEMFGD", - "IFT_VOICEENCAP", - "IFT_VOICEFGDEANA", - "IFT_VOICEFXO", - "IFT_VOICEFXS", - "IFT_VOICEOVERATM", - "IFT_VOICEOVERCABLE", - "IFT_VOICEOVERFRAMERELAY", - "IFT_VOICEOVERIP", - "IFT_X213", - "IFT_X25", - "IFT_X25DDN", - "IFT_X25HUNTGROUP", - "IFT_X25MLP", - "IFT_X25PLE", - "IFT_XETHER", - "IGNBRK", - "IGNCR", - "IGNORE", - "IGNPAR", - "IMAXBEL", - "INFINITE", - "INLCR", - "INPCK", - "INVALID_FILE_ATTRIBUTES", - "IN_ACCESS", - "IN_ALL_EVENTS", - "IN_ATTRIB", - "IN_CLASSA_HOST", - "IN_CLASSA_MAX", - "IN_CLASSA_NET", - "IN_CLASSA_NSHIFT", - "IN_CLASSB_HOST", - "IN_CLASSB_MAX", - "IN_CLASSB_NET", - "IN_CLASSB_NSHIFT", - "IN_CLASSC_HOST", - "IN_CLASSC_NET", - "IN_CLASSC_NSHIFT", - "IN_CLASSD_HOST", - "IN_CLASSD_NET", - "IN_CLASSD_NSHIFT", - "IN_CLOEXEC", - "IN_CLOSE", - "IN_CLOSE_NOWRITE", - "IN_CLOSE_WRITE", - "IN_CREATE", - "IN_DELETE", - "IN_DELETE_SELF", - "IN_DONT_FOLLOW", - "IN_EXCL_UNLINK", - "IN_IGNORED", - "IN_ISDIR", - "IN_LINKLOCALNETNUM", - "IN_LOOPBACKNET", - "IN_MASK_ADD", - "IN_MODIFY", - "IN_MOVE", - "IN_MOVED_FROM", - "IN_MOVED_TO", - "IN_MOVE_SELF", - "IN_NONBLOCK", - "IN_ONESHOT", - "IN_ONLYDIR", - "IN_OPEN", - "IN_Q_OVERFLOW", - "IN_RFC3021_HOST", - "IN_RFC3021_MASK", - "IN_RFC3021_NET", - "IN_RFC3021_NSHIFT", - "IN_UNMOUNT", - "IOC_IN", - "IOC_INOUT", - "IOC_OUT", - "IOC_VENDOR", - "IOC_WS2", - "IO_REPARSE_TAG_SYMLINK", - "IPMreq", - "IPMreqn", - "IPPROTO_3PC", - "IPPROTO_ADFS", - "IPPROTO_AH", - "IPPROTO_AHIP", - "IPPROTO_APES", - "IPPROTO_ARGUS", - "IPPROTO_AX25", - "IPPROTO_BHA", - "IPPROTO_BLT", - "IPPROTO_BRSATMON", - "IPPROTO_CARP", - "IPPROTO_CFTP", - "IPPROTO_CHAOS", - "IPPROTO_CMTP", - "IPPROTO_COMP", - "IPPROTO_CPHB", - "IPPROTO_CPNX", - "IPPROTO_DCCP", - "IPPROTO_DDP", - "IPPROTO_DGP", - "IPPROTO_DIVERT", - "IPPROTO_DIVERT_INIT", - "IPPROTO_DIVERT_RESP", - "IPPROTO_DONE", - "IPPROTO_DSTOPTS", - "IPPROTO_EGP", - "IPPROTO_EMCON", - "IPPROTO_ENCAP", - "IPPROTO_EON", - "IPPROTO_ESP", - "IPPROTO_ETHERIP", - "IPPROTO_FRAGMENT", - "IPPROTO_GGP", - "IPPROTO_GMTP", - "IPPROTO_GRE", - "IPPROTO_HELLO", - "IPPROTO_HMP", - "IPPROTO_HOPOPTS", - "IPPROTO_ICMP", - "IPPROTO_ICMPV6", - "IPPROTO_IDP", - "IPPROTO_IDPR", - "IPPROTO_IDRP", - "IPPROTO_IGMP", - "IPPROTO_IGP", - "IPPROTO_IGRP", - "IPPROTO_IL", - "IPPROTO_INLSP", - "IPPROTO_INP", - "IPPROTO_IP", - "IPPROTO_IPCOMP", - "IPPROTO_IPCV", - "IPPROTO_IPEIP", - "IPPROTO_IPIP", - "IPPROTO_IPPC", - "IPPROTO_IPV4", - "IPPROTO_IPV6", - "IPPROTO_IPV6_ICMP", - "IPPROTO_IRTP", - "IPPROTO_KRYPTOLAN", - "IPPROTO_LARP", - "IPPROTO_LEAF1", - "IPPROTO_LEAF2", - "IPPROTO_MAX", - "IPPROTO_MAXID", - "IPPROTO_MEAS", - "IPPROTO_MH", - "IPPROTO_MHRP", - "IPPROTO_MICP", - "IPPROTO_MOBILE", - "IPPROTO_MPLS", - "IPPROTO_MTP", - "IPPROTO_MUX", - "IPPROTO_ND", - "IPPROTO_NHRP", - "IPPROTO_NONE", - "IPPROTO_NSP", - "IPPROTO_NVPII", - "IPPROTO_OLD_DIVERT", - "IPPROTO_OSPFIGP", - "IPPROTO_PFSYNC", - "IPPROTO_PGM", - "IPPROTO_PIGP", - "IPPROTO_PIM", - "IPPROTO_PRM", - "IPPROTO_PUP", - "IPPROTO_PVP", - "IPPROTO_RAW", - "IPPROTO_RCCMON", - "IPPROTO_RDP", - "IPPROTO_ROUTING", - "IPPROTO_RSVP", - "IPPROTO_RVD", - "IPPROTO_SATEXPAK", - "IPPROTO_SATMON", - "IPPROTO_SCCSP", - "IPPROTO_SCTP", - "IPPROTO_SDRP", - "IPPROTO_SEND", - "IPPROTO_SEP", - "IPPROTO_SKIP", - "IPPROTO_SPACER", - "IPPROTO_SRPC", - "IPPROTO_ST", - "IPPROTO_SVMTP", - "IPPROTO_SWIPE", - "IPPROTO_TCF", - "IPPROTO_TCP", - "IPPROTO_TLSP", - "IPPROTO_TP", - "IPPROTO_TPXX", - "IPPROTO_TRUNK1", - "IPPROTO_TRUNK2", - "IPPROTO_TTP", - "IPPROTO_UDP", - "IPPROTO_UDPLITE", - "IPPROTO_VINES", - "IPPROTO_VISA", - "IPPROTO_VMTP", - "IPPROTO_VRRP", - "IPPROTO_WBEXPAK", - "IPPROTO_WBMON", - "IPPROTO_WSN", - "IPPROTO_XNET", - "IPPROTO_XTP", - "IPV6_2292DSTOPTS", - "IPV6_2292HOPLIMIT", - "IPV6_2292HOPOPTS", - "IPV6_2292NEXTHOP", - "IPV6_2292PKTINFO", - "IPV6_2292PKTOPTIONS", - "IPV6_2292RTHDR", - "IPV6_ADDRFORM", - "IPV6_ADD_MEMBERSHIP", - "IPV6_AUTHHDR", - "IPV6_AUTH_LEVEL", - "IPV6_AUTOFLOWLABEL", - "IPV6_BINDANY", - "IPV6_BINDV6ONLY", - "IPV6_BOUND_IF", - "IPV6_CHECKSUM", - "IPV6_DEFAULT_MULTICAST_HOPS", - "IPV6_DEFAULT_MULTICAST_LOOP", - "IPV6_DEFHLIM", - "IPV6_DONTFRAG", - "IPV6_DROP_MEMBERSHIP", - "IPV6_DSTOPTS", - "IPV6_ESP_NETWORK_LEVEL", - "IPV6_ESP_TRANS_LEVEL", - "IPV6_FAITH", - "IPV6_FLOWINFO_MASK", - "IPV6_FLOWLABEL_MASK", - "IPV6_FRAGTTL", - "IPV6_FW_ADD", - "IPV6_FW_DEL", - "IPV6_FW_FLUSH", - "IPV6_FW_GET", - "IPV6_FW_ZERO", - "IPV6_HLIMDEC", - "IPV6_HOPLIMIT", - "IPV6_HOPOPTS", - "IPV6_IPCOMP_LEVEL", - "IPV6_IPSEC_POLICY", - "IPV6_JOIN_ANYCAST", - "IPV6_JOIN_GROUP", - "IPV6_LEAVE_ANYCAST", - "IPV6_LEAVE_GROUP", - "IPV6_MAXHLIM", - "IPV6_MAXOPTHDR", - "IPV6_MAXPACKET", - "IPV6_MAX_GROUP_SRC_FILTER", - "IPV6_MAX_MEMBERSHIPS", - "IPV6_MAX_SOCK_SRC_FILTER", - "IPV6_MIN_MEMBERSHIPS", - "IPV6_MMTU", - "IPV6_MSFILTER", - "IPV6_MTU", - "IPV6_MTU_DISCOVER", - "IPV6_MULTICAST_HOPS", - "IPV6_MULTICAST_IF", - "IPV6_MULTICAST_LOOP", - "IPV6_NEXTHOP", - "IPV6_OPTIONS", - "IPV6_PATHMTU", - "IPV6_PIPEX", - "IPV6_PKTINFO", - "IPV6_PMTUDISC_DO", - "IPV6_PMTUDISC_DONT", - "IPV6_PMTUDISC_PROBE", - "IPV6_PMTUDISC_WANT", - "IPV6_PORTRANGE", - "IPV6_PORTRANGE_DEFAULT", - "IPV6_PORTRANGE_HIGH", - "IPV6_PORTRANGE_LOW", - "IPV6_PREFER_TEMPADDR", - "IPV6_RECVDSTOPTS", - "IPV6_RECVDSTPORT", - "IPV6_RECVERR", - "IPV6_RECVHOPLIMIT", - "IPV6_RECVHOPOPTS", - "IPV6_RECVPATHMTU", - "IPV6_RECVPKTINFO", - "IPV6_RECVRTHDR", - "IPV6_RECVTCLASS", - "IPV6_ROUTER_ALERT", - "IPV6_RTABLE", - "IPV6_RTHDR", - "IPV6_RTHDRDSTOPTS", - "IPV6_RTHDR_LOOSE", - "IPV6_RTHDR_STRICT", - "IPV6_RTHDR_TYPE_0", - "IPV6_RXDSTOPTS", - "IPV6_RXHOPOPTS", - "IPV6_SOCKOPT_RESERVED1", - "IPV6_TCLASS", - "IPV6_UNICAST_HOPS", - "IPV6_USE_MIN_MTU", - "IPV6_V6ONLY", - "IPV6_VERSION", - "IPV6_VERSION_MASK", - "IPV6_XFRM_POLICY", - "IP_ADD_MEMBERSHIP", - "IP_ADD_SOURCE_MEMBERSHIP", - "IP_AUTH_LEVEL", - "IP_BINDANY", - "IP_BLOCK_SOURCE", - "IP_BOUND_IF", - "IP_DEFAULT_MULTICAST_LOOP", - "IP_DEFAULT_MULTICAST_TTL", - "IP_DF", - "IP_DIVERTFL", - "IP_DONTFRAG", - "IP_DROP_MEMBERSHIP", - "IP_DROP_SOURCE_MEMBERSHIP", - "IP_DUMMYNET3", - "IP_DUMMYNET_CONFIGURE", - "IP_DUMMYNET_DEL", - "IP_DUMMYNET_FLUSH", - "IP_DUMMYNET_GET", - "IP_EF", - "IP_ERRORMTU", - "IP_ESP_NETWORK_LEVEL", - "IP_ESP_TRANS_LEVEL", - "IP_FAITH", - "IP_FREEBIND", - "IP_FW3", - "IP_FW_ADD", - "IP_FW_DEL", - "IP_FW_FLUSH", - "IP_FW_GET", - "IP_FW_NAT_CFG", - "IP_FW_NAT_DEL", - "IP_FW_NAT_GET_CONFIG", - "IP_FW_NAT_GET_LOG", - "IP_FW_RESETLOG", - "IP_FW_TABLE_ADD", - "IP_FW_TABLE_DEL", - "IP_FW_TABLE_FLUSH", - "IP_FW_TABLE_GETSIZE", - "IP_FW_TABLE_LIST", - "IP_FW_ZERO", - "IP_HDRINCL", - "IP_IPCOMP_LEVEL", - "IP_IPSECFLOWINFO", - "IP_IPSEC_LOCAL_AUTH", - "IP_IPSEC_LOCAL_CRED", - "IP_IPSEC_LOCAL_ID", - "IP_IPSEC_POLICY", - "IP_IPSEC_REMOTE_AUTH", - "IP_IPSEC_REMOTE_CRED", - "IP_IPSEC_REMOTE_ID", - "IP_MAXPACKET", - "IP_MAX_GROUP_SRC_FILTER", - "IP_MAX_MEMBERSHIPS", - "IP_MAX_SOCK_MUTE_FILTER", - "IP_MAX_SOCK_SRC_FILTER", - "IP_MAX_SOURCE_FILTER", - "IP_MF", - "IP_MINFRAGSIZE", - "IP_MINTTL", - "IP_MIN_MEMBERSHIPS", - "IP_MSFILTER", - "IP_MSS", - "IP_MTU", - "IP_MTU_DISCOVER", - "IP_MULTICAST_IF", - "IP_MULTICAST_IFINDEX", - "IP_MULTICAST_LOOP", - "IP_MULTICAST_TTL", - "IP_MULTICAST_VIF", - "IP_NAT__XXX", - "IP_OFFMASK", - "IP_OLD_FW_ADD", - "IP_OLD_FW_DEL", - "IP_OLD_FW_FLUSH", - "IP_OLD_FW_GET", - "IP_OLD_FW_RESETLOG", - "IP_OLD_FW_ZERO", - "IP_ONESBCAST", - "IP_OPTIONS", - "IP_ORIGDSTADDR", - "IP_PASSSEC", - "IP_PIPEX", - "IP_PKTINFO", - "IP_PKTOPTIONS", - "IP_PMTUDISC", - "IP_PMTUDISC_DO", - "IP_PMTUDISC_DONT", - "IP_PMTUDISC_PROBE", - "IP_PMTUDISC_WANT", - "IP_PORTRANGE", - "IP_PORTRANGE_DEFAULT", - "IP_PORTRANGE_HIGH", - "IP_PORTRANGE_LOW", - "IP_RECVDSTADDR", - "IP_RECVDSTPORT", - "IP_RECVERR", - "IP_RECVIF", - "IP_RECVOPTS", - "IP_RECVORIGDSTADDR", - "IP_RECVPKTINFO", - "IP_RECVRETOPTS", - "IP_RECVRTABLE", - "IP_RECVTOS", - "IP_RECVTTL", - "IP_RETOPTS", - "IP_RF", - "IP_ROUTER_ALERT", - "IP_RSVP_OFF", - "IP_RSVP_ON", - "IP_RSVP_VIF_OFF", - "IP_RSVP_VIF_ON", - "IP_RTABLE", - "IP_SENDSRCADDR", - "IP_STRIPHDR", - "IP_TOS", - "IP_TRAFFIC_MGT_BACKGROUND", - "IP_TRANSPARENT", - "IP_TTL", - "IP_UNBLOCK_SOURCE", - "IP_XFRM_POLICY", - "IPv6MTUInfo", - "IPv6Mreq", - "ISIG", - "ISTRIP", - "IUCLC", - "IUTF8", - "IXANY", - "IXOFF", - "IXON", - "IfAddrmsg", - "IfAnnounceMsghdr", - "IfData", - "IfInfomsg", - "IfMsghdr", - "IfaMsghdr", - "IfmaMsghdr", - "IfmaMsghdr2", - "ImplementsGetwd", - "Inet4Pktinfo", - "Inet6Pktinfo", - "InotifyAddWatch", - "InotifyEvent", - "InotifyInit", - "InotifyInit1", - "InotifyRmWatch", - "InterfaceAddrMessage", - "InterfaceAnnounceMessage", - "InterfaceInfo", - "InterfaceMessage", - "InterfaceMulticastAddrMessage", - "InvalidHandle", - "Ioperm", - "Iopl", - "Iovec", - "IpAdapterInfo", - "IpAddrString", - "IpAddressString", - "IpMaskString", - "Issetugid", - "KEY_ALL_ACCESS", - "KEY_CREATE_LINK", - "KEY_CREATE_SUB_KEY", - "KEY_ENUMERATE_SUB_KEYS", - "KEY_EXECUTE", - "KEY_NOTIFY", - "KEY_QUERY_VALUE", - "KEY_READ", - "KEY_SET_VALUE", - "KEY_WOW64_32KEY", - "KEY_WOW64_64KEY", - "KEY_WRITE", - "Kevent", - "Kevent_t", - "Kill", - "Klogctl", - "Kqueue", - "LANG_ENGLISH", - "LAYERED_PROTOCOL", - "LCNT_OVERLOAD_FLUSH", - "LINUX_REBOOT_CMD_CAD_OFF", - "LINUX_REBOOT_CMD_CAD_ON", - "LINUX_REBOOT_CMD_HALT", - "LINUX_REBOOT_CMD_KEXEC", - "LINUX_REBOOT_CMD_POWER_OFF", - "LINUX_REBOOT_CMD_RESTART", - "LINUX_REBOOT_CMD_RESTART2", - "LINUX_REBOOT_CMD_SW_SUSPEND", - "LINUX_REBOOT_MAGIC1", - "LINUX_REBOOT_MAGIC2", - "LOCK_EX", - "LOCK_NB", - "LOCK_SH", - "LOCK_UN", - "LazyDLL", - "LazyProc", - "Lchown", - "Linger", - "Link", - "Listen", - "Listxattr", - "LoadCancelIoEx", - "LoadConnectEx", - "LoadCreateSymbolicLink", - "LoadDLL", - "LoadGetAddrInfo", - "LoadLibrary", - "LoadSetFileCompletionNotificationModes", - "LocalFree", - "Log2phys_t", - "LookupAccountName", - "LookupAccountSid", - "LookupSID", - "LsfJump", - "LsfSocket", - "LsfStmt", - "Lstat", - "MADV_AUTOSYNC", - "MADV_CAN_REUSE", - "MADV_CORE", - "MADV_DOFORK", - "MADV_DONTFORK", - "MADV_DONTNEED", - "MADV_FREE", - "MADV_FREE_REUSABLE", - "MADV_FREE_REUSE", - "MADV_HUGEPAGE", - "MADV_HWPOISON", - "MADV_MERGEABLE", - "MADV_NOCORE", - "MADV_NOHUGEPAGE", - "MADV_NORMAL", - "MADV_NOSYNC", - "MADV_PROTECT", - "MADV_RANDOM", - "MADV_REMOVE", - "MADV_SEQUENTIAL", - "MADV_SPACEAVAIL", - "MADV_UNMERGEABLE", - "MADV_WILLNEED", - "MADV_ZERO_WIRED_PAGES", - "MAP_32BIT", - "MAP_ALIGNED_SUPER", - "MAP_ALIGNMENT_16MB", - "MAP_ALIGNMENT_1TB", - "MAP_ALIGNMENT_256TB", - "MAP_ALIGNMENT_4GB", - "MAP_ALIGNMENT_64KB", - "MAP_ALIGNMENT_64PB", - "MAP_ALIGNMENT_MASK", - "MAP_ALIGNMENT_SHIFT", - "MAP_ANON", - "MAP_ANONYMOUS", - "MAP_COPY", - "MAP_DENYWRITE", - "MAP_EXECUTABLE", - "MAP_FILE", - "MAP_FIXED", - "MAP_FLAGMASK", - "MAP_GROWSDOWN", - "MAP_HASSEMAPHORE", - "MAP_HUGETLB", - "MAP_INHERIT", - "MAP_INHERIT_COPY", - "MAP_INHERIT_DEFAULT", - "MAP_INHERIT_DONATE_COPY", - "MAP_INHERIT_NONE", - "MAP_INHERIT_SHARE", - "MAP_JIT", - "MAP_LOCKED", - "MAP_NOCACHE", - "MAP_NOCORE", - "MAP_NOEXTEND", - "MAP_NONBLOCK", - "MAP_NORESERVE", - "MAP_NOSYNC", - "MAP_POPULATE", - "MAP_PREFAULT_READ", - "MAP_PRIVATE", - "MAP_RENAME", - "MAP_RESERVED0080", - "MAP_RESERVED0100", - "MAP_SHARED", - "MAP_STACK", - "MAP_TRYFIXED", - "MAP_TYPE", - "MAP_WIRED", - "MAXIMUM_REPARSE_DATA_BUFFER_SIZE", - "MAXLEN_IFDESCR", - "MAXLEN_PHYSADDR", - "MAX_ADAPTER_ADDRESS_LENGTH", - "MAX_ADAPTER_DESCRIPTION_LENGTH", - "MAX_ADAPTER_NAME_LENGTH", - "MAX_COMPUTERNAME_LENGTH", - "MAX_INTERFACE_NAME_LEN", - "MAX_LONG_PATH", - "MAX_PATH", - "MAX_PROTOCOL_CHAIN", - "MCL_CURRENT", - "MCL_FUTURE", - "MNT_DETACH", - "MNT_EXPIRE", - "MNT_FORCE", - "MSG_BCAST", - "MSG_CMSG_CLOEXEC", - "MSG_COMPAT", - "MSG_CONFIRM", - "MSG_CONTROLMBUF", - "MSG_CTRUNC", - "MSG_DONTROUTE", - "MSG_DONTWAIT", - "MSG_EOF", - "MSG_EOR", - "MSG_ERRQUEUE", - "MSG_FASTOPEN", - "MSG_FIN", - "MSG_FLUSH", - "MSG_HAVEMORE", - "MSG_HOLD", - "MSG_IOVUSRSPACE", - "MSG_LENUSRSPACE", - "MSG_MCAST", - "MSG_MORE", - "MSG_NAMEMBUF", - "MSG_NBIO", - "MSG_NEEDSA", - "MSG_NOSIGNAL", - "MSG_NOTIFICATION", - "MSG_OOB", - "MSG_PEEK", - "MSG_PROXY", - "MSG_RCVMORE", - "MSG_RST", - "MSG_SEND", - "MSG_SYN", - "MSG_TRUNC", - "MSG_TRYHARD", - "MSG_USERFLAGS", - "MSG_WAITALL", - "MSG_WAITFORONE", - "MSG_WAITSTREAM", - "MS_ACTIVE", - "MS_ASYNC", - "MS_BIND", - "MS_DEACTIVATE", - "MS_DIRSYNC", - "MS_INVALIDATE", - "MS_I_VERSION", - "MS_KERNMOUNT", - "MS_KILLPAGES", - "MS_MANDLOCK", - "MS_MGC_MSK", - "MS_MGC_VAL", - "MS_MOVE", - "MS_NOATIME", - "MS_NODEV", - "MS_NODIRATIME", - "MS_NOEXEC", - "MS_NOSUID", - "MS_NOUSER", - "MS_POSIXACL", - "MS_PRIVATE", - "MS_RDONLY", - "MS_REC", - "MS_RELATIME", - "MS_REMOUNT", - "MS_RMT_MASK", - "MS_SHARED", - "MS_SILENT", - "MS_SLAVE", - "MS_STRICTATIME", - "MS_SYNC", - "MS_SYNCHRONOUS", - "MS_UNBINDABLE", - "Madvise", - "MapViewOfFile", - "MaxTokenInfoClass", - "Mclpool", - "MibIfRow", - "Mkdir", - "Mkdirat", - "Mkfifo", - "Mknod", - "Mknodat", - "Mlock", - "Mlockall", - "Mmap", - "Mount", - "MoveFile", - "Mprotect", - "Msghdr", - "Munlock", - "Munlockall", - "Munmap", - "MustLoadDLL", - "NAME_MAX", - "NETLINK_ADD_MEMBERSHIP", - "NETLINK_AUDIT", - "NETLINK_BROADCAST_ERROR", - "NETLINK_CONNECTOR", - "NETLINK_DNRTMSG", - "NETLINK_DROP_MEMBERSHIP", - "NETLINK_ECRYPTFS", - "NETLINK_FIB_LOOKUP", - "NETLINK_FIREWALL", - "NETLINK_GENERIC", - "NETLINK_INET_DIAG", - "NETLINK_IP6_FW", - "NETLINK_ISCSI", - "NETLINK_KOBJECT_UEVENT", - "NETLINK_NETFILTER", - "NETLINK_NFLOG", - "NETLINK_NO_ENOBUFS", - "NETLINK_PKTINFO", - "NETLINK_RDMA", - "NETLINK_ROUTE", - "NETLINK_SCSITRANSPORT", - "NETLINK_SELINUX", - "NETLINK_UNUSED", - "NETLINK_USERSOCK", - "NETLINK_XFRM", - "NET_RT_DUMP", - "NET_RT_DUMP2", - "NET_RT_FLAGS", - "NET_RT_IFLIST", - "NET_RT_IFLIST2", - "NET_RT_IFLISTL", - "NET_RT_IFMALIST", - "NET_RT_MAXID", - "NET_RT_OIFLIST", - "NET_RT_OOIFLIST", - "NET_RT_STAT", - "NET_RT_STATS", - "NET_RT_TABLE", - "NET_RT_TRASH", - "NLA_ALIGNTO", - "NLA_F_NESTED", - "NLA_F_NET_BYTEORDER", - "NLA_HDRLEN", - "NLMSG_ALIGNTO", - "NLMSG_DONE", - "NLMSG_ERROR", - "NLMSG_HDRLEN", - "NLMSG_MIN_TYPE", - "NLMSG_NOOP", - "NLMSG_OVERRUN", - "NLM_F_ACK", - "NLM_F_APPEND", - "NLM_F_ATOMIC", - "NLM_F_CREATE", - "NLM_F_DUMP", - "NLM_F_ECHO", - "NLM_F_EXCL", - "NLM_F_MATCH", - "NLM_F_MULTI", - "NLM_F_REPLACE", - "NLM_F_REQUEST", - "NLM_F_ROOT", - "NOFLSH", - "NOTE_ABSOLUTE", - "NOTE_ATTRIB", - "NOTE_BACKGROUND", - "NOTE_CHILD", - "NOTE_CRITICAL", - "NOTE_DELETE", - "NOTE_EOF", - "NOTE_EXEC", - "NOTE_EXIT", - "NOTE_EXITSTATUS", - "NOTE_EXIT_CSERROR", - "NOTE_EXIT_DECRYPTFAIL", - "NOTE_EXIT_DETAIL", - "NOTE_EXIT_DETAIL_MASK", - "NOTE_EXIT_MEMORY", - "NOTE_EXIT_REPARENTED", - "NOTE_EXTEND", - "NOTE_FFAND", - "NOTE_FFCOPY", - "NOTE_FFCTRLMASK", - "NOTE_FFLAGSMASK", - "NOTE_FFNOP", - "NOTE_FFOR", - "NOTE_FORK", - "NOTE_LEEWAY", - "NOTE_LINK", - "NOTE_LOWAT", - "NOTE_NONE", - "NOTE_NSECONDS", - "NOTE_PCTRLMASK", - "NOTE_PDATAMASK", - "NOTE_REAP", - "NOTE_RENAME", - "NOTE_RESOURCEEND", - "NOTE_REVOKE", - "NOTE_SECONDS", - "NOTE_SIGNAL", - "NOTE_TRACK", - "NOTE_TRACKERR", - "NOTE_TRIGGER", - "NOTE_TRUNCATE", - "NOTE_USECONDS", - "NOTE_VM_ERROR", - "NOTE_VM_PRESSURE", - "NOTE_VM_PRESSURE_SUDDEN_TERMINATE", - "NOTE_VM_PRESSURE_TERMINATE", - "NOTE_WRITE", - "NameCanonical", - "NameCanonicalEx", - "NameDisplay", - "NameDnsDomain", - "NameFullyQualifiedDN", - "NameSamCompatible", - "NameServicePrincipal", - "NameUniqueId", - "NameUnknown", - "NameUserPrincipal", - "Nanosleep", - "NetApiBufferFree", - "NetGetJoinInformation", - "NetSetupDomainName", - "NetSetupUnjoined", - "NetSetupUnknownStatus", - "NetSetupWorkgroupName", - "NetUserGetInfo", - "NetlinkMessage", - "NetlinkRIB", - "NetlinkRouteAttr", - "NetlinkRouteRequest", - "NewCallback", - "NewCallbackCDecl", - "NewLazyDLL", - "NlAttr", - "NlMsgerr", - "NlMsghdr", - "NsecToFiletime", - "NsecToTimespec", - "NsecToTimeval", - "Ntohs", - "OCRNL", - "OFDEL", - "OFILL", - "OFIOGETBMAP", - "OID_PKIX_KP_SERVER_AUTH", - "OID_SERVER_GATED_CRYPTO", - "OID_SGC_NETSCAPE", - "OLCUC", - "ONLCR", - "ONLRET", - "ONOCR", - "ONOEOT", - "OPEN_ALWAYS", - "OPEN_EXISTING", - "OPOST", - "O_ACCMODE", - "O_ALERT", - "O_ALT_IO", - "O_APPEND", - "O_ASYNC", - "O_CLOEXEC", - "O_CREAT", - "O_DIRECT", - "O_DIRECTORY", - "O_DP_GETRAWENCRYPTED", - "O_DSYNC", - "O_EVTONLY", - "O_EXCL", - "O_EXEC", - "O_EXLOCK", - "O_FSYNC", - "O_LARGEFILE", - "O_NDELAY", - "O_NOATIME", - "O_NOCTTY", - "O_NOFOLLOW", - "O_NONBLOCK", - "O_NOSIGPIPE", - "O_POPUP", - "O_RDONLY", - "O_RDWR", - "O_RSYNC", - "O_SHLOCK", - "O_SYMLINK", - "O_SYNC", - "O_TRUNC", - "O_TTY_INIT", - "O_WRONLY", - "Open", - "OpenCurrentProcessToken", - "OpenProcess", - "OpenProcessToken", - "Openat", - "Overlapped", - "PACKET_ADD_MEMBERSHIP", - "PACKET_BROADCAST", - "PACKET_DROP_MEMBERSHIP", - "PACKET_FASTROUTE", - "PACKET_HOST", - "PACKET_LOOPBACK", - "PACKET_MR_ALLMULTI", - "PACKET_MR_MULTICAST", - "PACKET_MR_PROMISC", - "PACKET_MULTICAST", - "PACKET_OTHERHOST", - "PACKET_OUTGOING", - "PACKET_RECV_OUTPUT", - "PACKET_RX_RING", - "PACKET_STATISTICS", - "PAGE_EXECUTE_READ", - "PAGE_EXECUTE_READWRITE", - "PAGE_EXECUTE_WRITECOPY", - "PAGE_READONLY", - "PAGE_READWRITE", - "PAGE_WRITECOPY", - "PARENB", - "PARMRK", - "PARODD", - "PENDIN", - "PFL_HIDDEN", - "PFL_MATCHES_PROTOCOL_ZERO", - "PFL_MULTIPLE_PROTO_ENTRIES", - "PFL_NETWORKDIRECT_PROVIDER", - "PFL_RECOMMENDED_PROTO_ENTRY", - "PF_FLUSH", - "PKCS_7_ASN_ENCODING", - "PMC5_PIPELINE_FLUSH", - "PRIO_PGRP", - "PRIO_PROCESS", - "PRIO_USER", - "PRI_IOFLUSH", - "PROCESS_QUERY_INFORMATION", - "PROCESS_TERMINATE", - "PROT_EXEC", - "PROT_GROWSDOWN", - "PROT_GROWSUP", - "PROT_NONE", - "PROT_READ", - "PROT_WRITE", - "PROV_DH_SCHANNEL", - "PROV_DSS", - "PROV_DSS_DH", - "PROV_EC_ECDSA_FULL", - "PROV_EC_ECDSA_SIG", - "PROV_EC_ECNRA_FULL", - "PROV_EC_ECNRA_SIG", - "PROV_FORTEZZA", - "PROV_INTEL_SEC", - "PROV_MS_EXCHANGE", - "PROV_REPLACE_OWF", - "PROV_RNG", - "PROV_RSA_AES", - "PROV_RSA_FULL", - "PROV_RSA_SCHANNEL", - "PROV_RSA_SIG", - "PROV_SPYRUS_LYNKS", - "PROV_SSL", - "PR_CAPBSET_DROP", - "PR_CAPBSET_READ", - "PR_CLEAR_SECCOMP_FILTER", - "PR_ENDIAN_BIG", - "PR_ENDIAN_LITTLE", - "PR_ENDIAN_PPC_LITTLE", - "PR_FPEMU_NOPRINT", - "PR_FPEMU_SIGFPE", - "PR_FP_EXC_ASYNC", - "PR_FP_EXC_DISABLED", - "PR_FP_EXC_DIV", - "PR_FP_EXC_INV", - "PR_FP_EXC_NONRECOV", - "PR_FP_EXC_OVF", - "PR_FP_EXC_PRECISE", - "PR_FP_EXC_RES", - "PR_FP_EXC_SW_ENABLE", - "PR_FP_EXC_UND", - "PR_GET_DUMPABLE", - "PR_GET_ENDIAN", - "PR_GET_FPEMU", - "PR_GET_FPEXC", - "PR_GET_KEEPCAPS", - "PR_GET_NAME", - "PR_GET_PDEATHSIG", - "PR_GET_SECCOMP", - "PR_GET_SECCOMP_FILTER", - "PR_GET_SECUREBITS", - "PR_GET_TIMERSLACK", - "PR_GET_TIMING", - "PR_GET_TSC", - "PR_GET_UNALIGN", - "PR_MCE_KILL", - "PR_MCE_KILL_CLEAR", - "PR_MCE_KILL_DEFAULT", - "PR_MCE_KILL_EARLY", - "PR_MCE_KILL_GET", - "PR_MCE_KILL_LATE", - "PR_MCE_KILL_SET", - "PR_SECCOMP_FILTER_EVENT", - "PR_SECCOMP_FILTER_SYSCALL", - "PR_SET_DUMPABLE", - "PR_SET_ENDIAN", - "PR_SET_FPEMU", - "PR_SET_FPEXC", - "PR_SET_KEEPCAPS", - "PR_SET_NAME", - "PR_SET_PDEATHSIG", - "PR_SET_PTRACER", - "PR_SET_SECCOMP", - "PR_SET_SECCOMP_FILTER", - "PR_SET_SECUREBITS", - "PR_SET_TIMERSLACK", - "PR_SET_TIMING", - "PR_SET_TSC", - "PR_SET_UNALIGN", - "PR_TASK_PERF_EVENTS_DISABLE", - "PR_TASK_PERF_EVENTS_ENABLE", - "PR_TIMING_STATISTICAL", - "PR_TIMING_TIMESTAMP", - "PR_TSC_ENABLE", - "PR_TSC_SIGSEGV", - "PR_UNALIGN_NOPRINT", - "PR_UNALIGN_SIGBUS", - "PTRACE_ARCH_PRCTL", - "PTRACE_ATTACH", - "PTRACE_CONT", - "PTRACE_DETACH", - "PTRACE_EVENT_CLONE", - "PTRACE_EVENT_EXEC", - "PTRACE_EVENT_EXIT", - "PTRACE_EVENT_FORK", - "PTRACE_EVENT_VFORK", - "PTRACE_EVENT_VFORK_DONE", - "PTRACE_GETCRUNCHREGS", - "PTRACE_GETEVENTMSG", - "PTRACE_GETFPREGS", - "PTRACE_GETFPXREGS", - "PTRACE_GETHBPREGS", - "PTRACE_GETREGS", - "PTRACE_GETREGSET", - "PTRACE_GETSIGINFO", - "PTRACE_GETVFPREGS", - "PTRACE_GETWMMXREGS", - "PTRACE_GET_THREAD_AREA", - "PTRACE_KILL", - "PTRACE_OLDSETOPTIONS", - "PTRACE_O_MASK", - "PTRACE_O_TRACECLONE", - "PTRACE_O_TRACEEXEC", - "PTRACE_O_TRACEEXIT", - "PTRACE_O_TRACEFORK", - "PTRACE_O_TRACESYSGOOD", - "PTRACE_O_TRACEVFORK", - "PTRACE_O_TRACEVFORKDONE", - "PTRACE_PEEKDATA", - "PTRACE_PEEKTEXT", - "PTRACE_PEEKUSR", - "PTRACE_POKEDATA", - "PTRACE_POKETEXT", - "PTRACE_POKEUSR", - "PTRACE_SETCRUNCHREGS", - "PTRACE_SETFPREGS", - "PTRACE_SETFPXREGS", - "PTRACE_SETHBPREGS", - "PTRACE_SETOPTIONS", - "PTRACE_SETREGS", - "PTRACE_SETREGSET", - "PTRACE_SETSIGINFO", - "PTRACE_SETVFPREGS", - "PTRACE_SETWMMXREGS", - "PTRACE_SET_SYSCALL", - "PTRACE_SET_THREAD_AREA", - "PTRACE_SINGLEBLOCK", - "PTRACE_SINGLESTEP", - "PTRACE_SYSCALL", - "PTRACE_SYSEMU", - "PTRACE_SYSEMU_SINGLESTEP", - "PTRACE_TRACEME", - "PT_ATTACH", - "PT_ATTACHEXC", - "PT_CONTINUE", - "PT_DATA_ADDR", - "PT_DENY_ATTACH", - "PT_DETACH", - "PT_FIRSTMACH", - "PT_FORCEQUOTA", - "PT_KILL", - "PT_MASK", - "PT_READ_D", - "PT_READ_I", - "PT_READ_U", - "PT_SIGEXC", - "PT_STEP", - "PT_TEXT_ADDR", - "PT_TEXT_END_ADDR", - "PT_THUPDATE", - "PT_TRACE_ME", - "PT_WRITE_D", - "PT_WRITE_I", - "PT_WRITE_U", - "ParseDirent", - "ParseNetlinkMessage", - "ParseNetlinkRouteAttr", - "ParseRoutingMessage", - "ParseRoutingSockaddr", - "ParseSocketControlMessage", - "ParseUnixCredentials", - "ParseUnixRights", - "PathMax", - "Pathconf", - "Pause", - "Pipe", - "Pipe2", - "PivotRoot", - "Pointer", - "PostQueuedCompletionStatus", - "Pread", - "Proc", - "ProcAttr", - "Process32First", - "Process32Next", - "ProcessEntry32", - "ProcessInformation", - "Protoent", - "PtraceAttach", - "PtraceCont", - "PtraceDetach", - "PtraceGetEventMsg", - "PtraceGetRegs", - "PtracePeekData", - "PtracePeekText", - "PtracePokeData", - "PtracePokeText", - "PtraceRegs", - "PtraceSetOptions", - "PtraceSetRegs", - "PtraceSingleStep", - "PtraceSyscall", - "Pwrite", - "REG_BINARY", - "REG_DWORD", - "REG_DWORD_BIG_ENDIAN", - "REG_DWORD_LITTLE_ENDIAN", - "REG_EXPAND_SZ", - "REG_FULL_RESOURCE_DESCRIPTOR", - "REG_LINK", - "REG_MULTI_SZ", - "REG_NONE", - "REG_QWORD", - "REG_QWORD_LITTLE_ENDIAN", - "REG_RESOURCE_LIST", - "REG_RESOURCE_REQUIREMENTS_LIST", - "REG_SZ", - "RLIMIT_AS", - "RLIMIT_CORE", - "RLIMIT_CPU", - "RLIMIT_CPU_USAGE_MONITOR", - "RLIMIT_DATA", - "RLIMIT_FSIZE", - "RLIMIT_NOFILE", - "RLIMIT_STACK", - "RLIM_INFINITY", - "RTAX_ADVMSS", - "RTAX_AUTHOR", - "RTAX_BRD", - "RTAX_CWND", - "RTAX_DST", - "RTAX_FEATURES", - "RTAX_FEATURE_ALLFRAG", - "RTAX_FEATURE_ECN", - "RTAX_FEATURE_SACK", - "RTAX_FEATURE_TIMESTAMP", - "RTAX_GATEWAY", - "RTAX_GENMASK", - "RTAX_HOPLIMIT", - "RTAX_IFA", - "RTAX_IFP", - "RTAX_INITCWND", - "RTAX_INITRWND", - "RTAX_LABEL", - "RTAX_LOCK", - "RTAX_MAX", - "RTAX_MTU", - "RTAX_NETMASK", - "RTAX_REORDERING", - "RTAX_RTO_MIN", - "RTAX_RTT", - "RTAX_RTTVAR", - "RTAX_SRC", - "RTAX_SRCMASK", - "RTAX_SSTHRESH", - "RTAX_TAG", - "RTAX_UNSPEC", - "RTAX_WINDOW", - "RTA_ALIGNTO", - "RTA_AUTHOR", - "RTA_BRD", - "RTA_CACHEINFO", - "RTA_DST", - "RTA_FLOW", - "RTA_GATEWAY", - "RTA_GENMASK", - "RTA_IFA", - "RTA_IFP", - "RTA_IIF", - "RTA_LABEL", - "RTA_MAX", - "RTA_METRICS", - "RTA_MULTIPATH", - "RTA_NETMASK", - "RTA_OIF", - "RTA_PREFSRC", - "RTA_PRIORITY", - "RTA_SRC", - "RTA_SRCMASK", - "RTA_TABLE", - "RTA_TAG", - "RTA_UNSPEC", - "RTCF_DIRECTSRC", - "RTCF_DOREDIRECT", - "RTCF_LOG", - "RTCF_MASQ", - "RTCF_NAT", - "RTCF_VALVE", - "RTF_ADDRCLASSMASK", - "RTF_ADDRCONF", - "RTF_ALLONLINK", - "RTF_ANNOUNCE", - "RTF_BLACKHOLE", - "RTF_BROADCAST", - "RTF_CACHE", - "RTF_CLONED", - "RTF_CLONING", - "RTF_CONDEMNED", - "RTF_DEFAULT", - "RTF_DELCLONE", - "RTF_DONE", - "RTF_DYNAMIC", - "RTF_FLOW", - "RTF_FMASK", - "RTF_GATEWAY", - "RTF_GWFLAG_COMPAT", - "RTF_HOST", - "RTF_IFREF", - "RTF_IFSCOPE", - "RTF_INTERFACE", - "RTF_IRTT", - "RTF_LINKRT", - "RTF_LLDATA", - "RTF_LLINFO", - "RTF_LOCAL", - "RTF_MASK", - "RTF_MODIFIED", - "RTF_MPATH", - "RTF_MPLS", - "RTF_MSS", - "RTF_MTU", - "RTF_MULTICAST", - "RTF_NAT", - "RTF_NOFORWARD", - "RTF_NONEXTHOP", - "RTF_NOPMTUDISC", - "RTF_PERMANENT_ARP", - "RTF_PINNED", - "RTF_POLICY", - "RTF_PRCLONING", - "RTF_PROTO1", - "RTF_PROTO2", - "RTF_PROTO3", - "RTF_PROXY", - "RTF_REINSTATE", - "RTF_REJECT", - "RTF_RNH_LOCKED", - "RTF_ROUTER", - "RTF_SOURCE", - "RTF_SRC", - "RTF_STATIC", - "RTF_STICKY", - "RTF_THROW", - "RTF_TUNNEL", - "RTF_UP", - "RTF_USETRAILERS", - "RTF_WASCLONED", - "RTF_WINDOW", - "RTF_XRESOLVE", - "RTM_ADD", - "RTM_BASE", - "RTM_CHANGE", - "RTM_CHGADDR", - "RTM_DELACTION", - "RTM_DELADDR", - "RTM_DELADDRLABEL", - "RTM_DELETE", - "RTM_DELLINK", - "RTM_DELMADDR", - "RTM_DELNEIGH", - "RTM_DELQDISC", - "RTM_DELROUTE", - "RTM_DELRULE", - "RTM_DELTCLASS", - "RTM_DELTFILTER", - "RTM_DESYNC", - "RTM_F_CLONED", - "RTM_F_EQUALIZE", - "RTM_F_NOTIFY", - "RTM_F_PREFIX", - "RTM_GET", - "RTM_GET2", - "RTM_GETACTION", - "RTM_GETADDR", - "RTM_GETADDRLABEL", - "RTM_GETANYCAST", - "RTM_GETDCB", - "RTM_GETLINK", - "RTM_GETMULTICAST", - "RTM_GETNEIGH", - "RTM_GETNEIGHTBL", - "RTM_GETQDISC", - "RTM_GETROUTE", - "RTM_GETRULE", - "RTM_GETTCLASS", - "RTM_GETTFILTER", - "RTM_IEEE80211", - "RTM_IFANNOUNCE", - "RTM_IFINFO", - "RTM_IFINFO2", - "RTM_LLINFO_UPD", - "RTM_LOCK", - "RTM_LOSING", - "RTM_MAX", - "RTM_MAXSIZE", - "RTM_MISS", - "RTM_NEWACTION", - "RTM_NEWADDR", - "RTM_NEWADDRLABEL", - "RTM_NEWLINK", - "RTM_NEWMADDR", - "RTM_NEWMADDR2", - "RTM_NEWNDUSEROPT", - "RTM_NEWNEIGH", - "RTM_NEWNEIGHTBL", - "RTM_NEWPREFIX", - "RTM_NEWQDISC", - "RTM_NEWROUTE", - "RTM_NEWRULE", - "RTM_NEWTCLASS", - "RTM_NEWTFILTER", - "RTM_NR_FAMILIES", - "RTM_NR_MSGTYPES", - "RTM_OIFINFO", - "RTM_OLDADD", - "RTM_OLDDEL", - "RTM_OOIFINFO", - "RTM_REDIRECT", - "RTM_RESOLVE", - "RTM_RTTUNIT", - "RTM_SETDCB", - "RTM_SETGATE", - "RTM_SETLINK", - "RTM_SETNEIGHTBL", - "RTM_VERSION", - "RTNH_ALIGNTO", - "RTNH_F_DEAD", - "RTNH_F_ONLINK", - "RTNH_F_PERVASIVE", - "RTNLGRP_IPV4_IFADDR", - "RTNLGRP_IPV4_MROUTE", - "RTNLGRP_IPV4_ROUTE", - "RTNLGRP_IPV4_RULE", - "RTNLGRP_IPV6_IFADDR", - "RTNLGRP_IPV6_IFINFO", - "RTNLGRP_IPV6_MROUTE", - "RTNLGRP_IPV6_PREFIX", - "RTNLGRP_IPV6_ROUTE", - "RTNLGRP_IPV6_RULE", - "RTNLGRP_LINK", - "RTNLGRP_ND_USEROPT", - "RTNLGRP_NEIGH", - "RTNLGRP_NONE", - "RTNLGRP_NOTIFY", - "RTNLGRP_TC", - "RTN_ANYCAST", - "RTN_BLACKHOLE", - "RTN_BROADCAST", - "RTN_LOCAL", - "RTN_MAX", - "RTN_MULTICAST", - "RTN_NAT", - "RTN_PROHIBIT", - "RTN_THROW", - "RTN_UNICAST", - "RTN_UNREACHABLE", - "RTN_UNSPEC", - "RTN_XRESOLVE", - "RTPROT_BIRD", - "RTPROT_BOOT", - "RTPROT_DHCP", - "RTPROT_DNROUTED", - "RTPROT_GATED", - "RTPROT_KERNEL", - "RTPROT_MRT", - "RTPROT_NTK", - "RTPROT_RA", - "RTPROT_REDIRECT", - "RTPROT_STATIC", - "RTPROT_UNSPEC", - "RTPROT_XORP", - "RTPROT_ZEBRA", - "RTV_EXPIRE", - "RTV_HOPCOUNT", - "RTV_MTU", - "RTV_RPIPE", - "RTV_RTT", - "RTV_RTTVAR", - "RTV_SPIPE", - "RTV_SSTHRESH", - "RTV_WEIGHT", - "RT_CACHING_CONTEXT", - "RT_CLASS_DEFAULT", - "RT_CLASS_LOCAL", - "RT_CLASS_MAIN", - "RT_CLASS_MAX", - "RT_CLASS_UNSPEC", - "RT_DEFAULT_FIB", - "RT_NORTREF", - "RT_SCOPE_HOST", - "RT_SCOPE_LINK", - "RT_SCOPE_NOWHERE", - "RT_SCOPE_SITE", - "RT_SCOPE_UNIVERSE", - "RT_TABLEID_MAX", - "RT_TABLE_COMPAT", - "RT_TABLE_DEFAULT", - "RT_TABLE_LOCAL", - "RT_TABLE_MAIN", - "RT_TABLE_MAX", - "RT_TABLE_UNSPEC", - "RUSAGE_CHILDREN", - "RUSAGE_SELF", - "RUSAGE_THREAD", - "Radvisory_t", - "RawConn", - "RawSockaddr", - "RawSockaddrAny", - "RawSockaddrDatalink", - "RawSockaddrInet4", - "RawSockaddrInet6", - "RawSockaddrLinklayer", - "RawSockaddrNetlink", - "RawSockaddrUnix", - "RawSyscall", - "RawSyscall6", - "Read", - "ReadConsole", - "ReadDirectoryChanges", - "ReadDirent", - "ReadFile", - "Readlink", - "Reboot", - "Recvfrom", - "Recvmsg", - "RegCloseKey", - "RegEnumKeyEx", - "RegOpenKeyEx", - "RegQueryInfoKey", - "RegQueryValueEx", - "RemoveDirectory", - "Removexattr", - "Rename", - "Renameat", - "Revoke", - "Rlimit", - "Rmdir", - "RouteMessage", - "RouteRIB", - "RoutingMessage", - "RtAttr", - "RtGenmsg", - "RtMetrics", - "RtMsg", - "RtMsghdr", - "RtNexthop", - "Rusage", - "SCM_BINTIME", - "SCM_CREDENTIALS", - "SCM_CREDS", - "SCM_RIGHTS", - "SCM_TIMESTAMP", - "SCM_TIMESTAMPING", - "SCM_TIMESTAMPNS", - "SCM_TIMESTAMP_MONOTONIC", - "SHUT_RD", - "SHUT_RDWR", - "SHUT_WR", - "SID", - "SIDAndAttributes", - "SIGABRT", - "SIGALRM", - "SIGBUS", - "SIGCHLD", - "SIGCLD", - "SIGCONT", - "SIGEMT", - "SIGFPE", - "SIGHUP", - "SIGILL", - "SIGINFO", - "SIGINT", - "SIGIO", - "SIGIOT", - "SIGKILL", - "SIGLIBRT", - "SIGLWP", - "SIGPIPE", - "SIGPOLL", - "SIGPROF", - "SIGPWR", - "SIGQUIT", - "SIGSEGV", - "SIGSTKFLT", - "SIGSTOP", - "SIGSYS", - "SIGTERM", - "SIGTHR", - "SIGTRAP", - "SIGTSTP", - "SIGTTIN", - "SIGTTOU", - "SIGUNUSED", - "SIGURG", - "SIGUSR1", - "SIGUSR2", - "SIGVTALRM", - "SIGWINCH", - "SIGXCPU", - "SIGXFSZ", - "SIOCADDDLCI", - "SIOCADDMULTI", - "SIOCADDRT", - "SIOCAIFADDR", - "SIOCAIFGROUP", - "SIOCALIFADDR", - "SIOCARPIPLL", - "SIOCATMARK", - "SIOCAUTOADDR", - "SIOCAUTONETMASK", - "SIOCBRDGADD", - "SIOCBRDGADDS", - "SIOCBRDGARL", - "SIOCBRDGDADDR", - "SIOCBRDGDEL", - "SIOCBRDGDELS", - "SIOCBRDGFLUSH", - "SIOCBRDGFRL", - "SIOCBRDGGCACHE", - "SIOCBRDGGFD", - "SIOCBRDGGHT", - "SIOCBRDGGIFFLGS", - "SIOCBRDGGMA", - "SIOCBRDGGPARAM", - "SIOCBRDGGPRI", - "SIOCBRDGGRL", - "SIOCBRDGGSIFS", - "SIOCBRDGGTO", - "SIOCBRDGIFS", - "SIOCBRDGRTS", - "SIOCBRDGSADDR", - "SIOCBRDGSCACHE", - "SIOCBRDGSFD", - "SIOCBRDGSHT", - "SIOCBRDGSIFCOST", - "SIOCBRDGSIFFLGS", - "SIOCBRDGSIFPRIO", - "SIOCBRDGSMA", - "SIOCBRDGSPRI", - "SIOCBRDGSPROTO", - "SIOCBRDGSTO", - "SIOCBRDGSTXHC", - "SIOCDARP", - "SIOCDELDLCI", - "SIOCDELMULTI", - "SIOCDELRT", - "SIOCDEVPRIVATE", - "SIOCDIFADDR", - "SIOCDIFGROUP", - "SIOCDIFPHYADDR", - "SIOCDLIFADDR", - "SIOCDRARP", - "SIOCGARP", - "SIOCGDRVSPEC", - "SIOCGETKALIVE", - "SIOCGETLABEL", - "SIOCGETPFLOW", - "SIOCGETPFSYNC", - "SIOCGETSGCNT", - "SIOCGETVIFCNT", - "SIOCGETVLAN", - "SIOCGHIWAT", - "SIOCGIFADDR", - "SIOCGIFADDRPREF", - "SIOCGIFALIAS", - "SIOCGIFALTMTU", - "SIOCGIFASYNCMAP", - "SIOCGIFBOND", - "SIOCGIFBR", - "SIOCGIFBRDADDR", - "SIOCGIFCAP", - "SIOCGIFCONF", - "SIOCGIFCOUNT", - "SIOCGIFDATA", - "SIOCGIFDESCR", - "SIOCGIFDEVMTU", - "SIOCGIFDLT", - "SIOCGIFDSTADDR", - "SIOCGIFENCAP", - "SIOCGIFFIB", - "SIOCGIFFLAGS", - "SIOCGIFGATTR", - "SIOCGIFGENERIC", - "SIOCGIFGMEMB", - "SIOCGIFGROUP", - "SIOCGIFHARDMTU", - "SIOCGIFHWADDR", - "SIOCGIFINDEX", - "SIOCGIFKPI", - "SIOCGIFMAC", - "SIOCGIFMAP", - "SIOCGIFMEDIA", - "SIOCGIFMEM", - "SIOCGIFMETRIC", - "SIOCGIFMTU", - "SIOCGIFNAME", - "SIOCGIFNETMASK", - "SIOCGIFPDSTADDR", - "SIOCGIFPFLAGS", - "SIOCGIFPHYS", - "SIOCGIFPRIORITY", - "SIOCGIFPSRCADDR", - "SIOCGIFRDOMAIN", - "SIOCGIFRTLABEL", - "SIOCGIFSLAVE", - "SIOCGIFSTATUS", - "SIOCGIFTIMESLOT", - "SIOCGIFTXQLEN", - "SIOCGIFVLAN", - "SIOCGIFWAKEFLAGS", - "SIOCGIFXFLAGS", - "SIOCGLIFADDR", - "SIOCGLIFPHYADDR", - "SIOCGLIFPHYRTABLE", - "SIOCGLIFPHYTTL", - "SIOCGLINKSTR", - "SIOCGLOWAT", - "SIOCGPGRP", - "SIOCGPRIVATE_0", - "SIOCGPRIVATE_1", - "SIOCGRARP", - "SIOCGSPPPPARAMS", - "SIOCGSTAMP", - "SIOCGSTAMPNS", - "SIOCGVH", - "SIOCGVNETID", - "SIOCIFCREATE", - "SIOCIFCREATE2", - "SIOCIFDESTROY", - "SIOCIFGCLONERS", - "SIOCINITIFADDR", - "SIOCPROTOPRIVATE", - "SIOCRSLVMULTI", - "SIOCRTMSG", - "SIOCSARP", - "SIOCSDRVSPEC", - "SIOCSETKALIVE", - "SIOCSETLABEL", - "SIOCSETPFLOW", - "SIOCSETPFSYNC", - "SIOCSETVLAN", - "SIOCSHIWAT", - "SIOCSIFADDR", - "SIOCSIFADDRPREF", - "SIOCSIFALTMTU", - "SIOCSIFASYNCMAP", - "SIOCSIFBOND", - "SIOCSIFBR", - "SIOCSIFBRDADDR", - "SIOCSIFCAP", - "SIOCSIFDESCR", - "SIOCSIFDSTADDR", - "SIOCSIFENCAP", - "SIOCSIFFIB", - "SIOCSIFFLAGS", - "SIOCSIFGATTR", - "SIOCSIFGENERIC", - "SIOCSIFHWADDR", - "SIOCSIFHWBROADCAST", - "SIOCSIFKPI", - "SIOCSIFLINK", - "SIOCSIFLLADDR", - "SIOCSIFMAC", - "SIOCSIFMAP", - "SIOCSIFMEDIA", - "SIOCSIFMEM", - "SIOCSIFMETRIC", - "SIOCSIFMTU", - "SIOCSIFNAME", - "SIOCSIFNETMASK", - "SIOCSIFPFLAGS", - "SIOCSIFPHYADDR", - "SIOCSIFPHYS", - "SIOCSIFPRIORITY", - "SIOCSIFRDOMAIN", - "SIOCSIFRTLABEL", - "SIOCSIFRVNET", - "SIOCSIFSLAVE", - "SIOCSIFTIMESLOT", - "SIOCSIFTXQLEN", - "SIOCSIFVLAN", - "SIOCSIFVNET", - "SIOCSIFXFLAGS", - "SIOCSLIFPHYADDR", - "SIOCSLIFPHYRTABLE", - "SIOCSLIFPHYTTL", - "SIOCSLINKSTR", - "SIOCSLOWAT", - "SIOCSPGRP", - "SIOCSRARP", - "SIOCSSPPPPARAMS", - "SIOCSVH", - "SIOCSVNETID", - "SIOCZIFDATA", - "SIO_GET_EXTENSION_FUNCTION_POINTER", - "SIO_GET_INTERFACE_LIST", - "SIO_KEEPALIVE_VALS", - "SIO_UDP_CONNRESET", - "SOCK_CLOEXEC", - "SOCK_DCCP", - "SOCK_DGRAM", - "SOCK_FLAGS_MASK", - "SOCK_MAXADDRLEN", - "SOCK_NONBLOCK", - "SOCK_NOSIGPIPE", - "SOCK_PACKET", - "SOCK_RAW", - "SOCK_RDM", - "SOCK_SEQPACKET", - "SOCK_STREAM", - "SOL_AAL", - "SOL_ATM", - "SOL_DECNET", - "SOL_ICMPV6", - "SOL_IP", - "SOL_IPV6", - "SOL_IRDA", - "SOL_PACKET", - "SOL_RAW", - "SOL_SOCKET", - "SOL_TCP", - "SOL_X25", - "SOMAXCONN", - "SO_ACCEPTCONN", - "SO_ACCEPTFILTER", - "SO_ATTACH_FILTER", - "SO_BINDANY", - "SO_BINDTODEVICE", - "SO_BINTIME", - "SO_BROADCAST", - "SO_BSDCOMPAT", - "SO_DEBUG", - "SO_DETACH_FILTER", - "SO_DOMAIN", - "SO_DONTROUTE", - "SO_DONTTRUNC", - "SO_ERROR", - "SO_KEEPALIVE", - "SO_LABEL", - "SO_LINGER", - "SO_LINGER_SEC", - "SO_LISTENINCQLEN", - "SO_LISTENQLEN", - "SO_LISTENQLIMIT", - "SO_MARK", - "SO_NETPROC", - "SO_NKE", - "SO_NOADDRERR", - "SO_NOHEADER", - "SO_NOSIGPIPE", - "SO_NOTIFYCONFLICT", - "SO_NO_CHECK", - "SO_NO_DDP", - "SO_NO_OFFLOAD", - "SO_NP_EXTENSIONS", - "SO_NREAD", - "SO_NUMRCVPKT", - "SO_NWRITE", - "SO_OOBINLINE", - "SO_OVERFLOWED", - "SO_PASSCRED", - "SO_PASSSEC", - "SO_PEERCRED", - "SO_PEERLABEL", - "SO_PEERNAME", - "SO_PEERSEC", - "SO_PRIORITY", - "SO_PROTOCOL", - "SO_PROTOTYPE", - "SO_RANDOMPORT", - "SO_RCVBUF", - "SO_RCVBUFFORCE", - "SO_RCVLOWAT", - "SO_RCVTIMEO", - "SO_RESTRICTIONS", - "SO_RESTRICT_DENYIN", - "SO_RESTRICT_DENYOUT", - "SO_RESTRICT_DENYSET", - "SO_REUSEADDR", - "SO_REUSEPORT", - "SO_REUSESHAREUID", - "SO_RTABLE", - "SO_RXQ_OVFL", - "SO_SECURITY_AUTHENTICATION", - "SO_SECURITY_ENCRYPTION_NETWORK", - "SO_SECURITY_ENCRYPTION_TRANSPORT", - "SO_SETFIB", - "SO_SNDBUF", - "SO_SNDBUFFORCE", - "SO_SNDLOWAT", - "SO_SNDTIMEO", - "SO_SPLICE", - "SO_TIMESTAMP", - "SO_TIMESTAMPING", - "SO_TIMESTAMPNS", - "SO_TIMESTAMP_MONOTONIC", - "SO_TYPE", - "SO_UPCALLCLOSEWAIT", - "SO_UPDATE_ACCEPT_CONTEXT", - "SO_UPDATE_CONNECT_CONTEXT", - "SO_USELOOPBACK", - "SO_USER_COOKIE", - "SO_VENDOR", - "SO_WANTMORE", - "SO_WANTOOBFLAG", - "SSLExtraCertChainPolicyPara", - "STANDARD_RIGHTS_ALL", - "STANDARD_RIGHTS_EXECUTE", - "STANDARD_RIGHTS_READ", - "STANDARD_RIGHTS_REQUIRED", - "STANDARD_RIGHTS_WRITE", - "STARTF_USESHOWWINDOW", - "STARTF_USESTDHANDLES", - "STD_ERROR_HANDLE", - "STD_INPUT_HANDLE", - "STD_OUTPUT_HANDLE", - "SUBLANG_ENGLISH_US", - "SW_FORCEMINIMIZE", - "SW_HIDE", - "SW_MAXIMIZE", - "SW_MINIMIZE", - "SW_NORMAL", - "SW_RESTORE", - "SW_SHOW", - "SW_SHOWDEFAULT", - "SW_SHOWMAXIMIZED", - "SW_SHOWMINIMIZED", - "SW_SHOWMINNOACTIVE", - "SW_SHOWNA", - "SW_SHOWNOACTIVATE", - "SW_SHOWNORMAL", - "SYMBOLIC_LINK_FLAG_DIRECTORY", - "SYNCHRONIZE", - "SYSCTL_VERSION", - "SYSCTL_VERS_0", - "SYSCTL_VERS_1", - "SYSCTL_VERS_MASK", - "SYS_ABORT2", - "SYS_ACCEPT", - "SYS_ACCEPT4", - "SYS_ACCEPT_NOCANCEL", - "SYS_ACCESS", - "SYS_ACCESS_EXTENDED", - "SYS_ACCT", - "SYS_ADD_KEY", - "SYS_ADD_PROFIL", - "SYS_ADJFREQ", - "SYS_ADJTIME", - "SYS_ADJTIMEX", - "SYS_AFS_SYSCALL", - "SYS_AIO_CANCEL", - "SYS_AIO_ERROR", - "SYS_AIO_FSYNC", - "SYS_AIO_MLOCK", - "SYS_AIO_READ", - "SYS_AIO_RETURN", - "SYS_AIO_SUSPEND", - "SYS_AIO_SUSPEND_NOCANCEL", - "SYS_AIO_WAITCOMPLETE", - "SYS_AIO_WRITE", - "SYS_ALARM", - "SYS_ARCH_PRCTL", - "SYS_ARM_FADVISE64_64", - "SYS_ARM_SYNC_FILE_RANGE", - "SYS_ATGETMSG", - "SYS_ATPGETREQ", - "SYS_ATPGETRSP", - "SYS_ATPSNDREQ", - "SYS_ATPSNDRSP", - "SYS_ATPUTMSG", - "SYS_ATSOCKET", - "SYS_AUDIT", - "SYS_AUDITCTL", - "SYS_AUDITON", - "SYS_AUDIT_SESSION_JOIN", - "SYS_AUDIT_SESSION_PORT", - "SYS_AUDIT_SESSION_SELF", - "SYS_BDFLUSH", - "SYS_BIND", - "SYS_BINDAT", - "SYS_BREAK", - "SYS_BRK", - "SYS_BSDTHREAD_CREATE", - "SYS_BSDTHREAD_REGISTER", - "SYS_BSDTHREAD_TERMINATE", - "SYS_CAPGET", - "SYS_CAPSET", - "SYS_CAP_ENTER", - "SYS_CAP_FCNTLS_GET", - "SYS_CAP_FCNTLS_LIMIT", - "SYS_CAP_GETMODE", - "SYS_CAP_GETRIGHTS", - "SYS_CAP_IOCTLS_GET", - "SYS_CAP_IOCTLS_LIMIT", - "SYS_CAP_NEW", - "SYS_CAP_RIGHTS_GET", - "SYS_CAP_RIGHTS_LIMIT", - "SYS_CHDIR", - "SYS_CHFLAGS", - "SYS_CHFLAGSAT", - "SYS_CHMOD", - "SYS_CHMOD_EXTENDED", - "SYS_CHOWN", - "SYS_CHOWN32", - "SYS_CHROOT", - "SYS_CHUD", - "SYS_CLOCK_ADJTIME", - "SYS_CLOCK_GETCPUCLOCKID2", - "SYS_CLOCK_GETRES", - "SYS_CLOCK_GETTIME", - "SYS_CLOCK_NANOSLEEP", - "SYS_CLOCK_SETTIME", - "SYS_CLONE", - "SYS_CLOSE", - "SYS_CLOSEFROM", - "SYS_CLOSE_NOCANCEL", - "SYS_CONNECT", - "SYS_CONNECTAT", - "SYS_CONNECT_NOCANCEL", - "SYS_COPYFILE", - "SYS_CPUSET", - "SYS_CPUSET_GETAFFINITY", - "SYS_CPUSET_GETID", - "SYS_CPUSET_SETAFFINITY", - "SYS_CPUSET_SETID", - "SYS_CREAT", - "SYS_CREATE_MODULE", - "SYS_CSOPS", - "SYS_CSOPS_AUDITTOKEN", - "SYS_DELETE", - "SYS_DELETE_MODULE", - "SYS_DUP", - "SYS_DUP2", - "SYS_DUP3", - "SYS_EACCESS", - "SYS_EPOLL_CREATE", - "SYS_EPOLL_CREATE1", - "SYS_EPOLL_CTL", - "SYS_EPOLL_CTL_OLD", - "SYS_EPOLL_PWAIT", - "SYS_EPOLL_WAIT", - "SYS_EPOLL_WAIT_OLD", - "SYS_EVENTFD", - "SYS_EVENTFD2", - "SYS_EXCHANGEDATA", - "SYS_EXECVE", - "SYS_EXIT", - "SYS_EXIT_GROUP", - "SYS_EXTATTRCTL", - "SYS_EXTATTR_DELETE_FD", - "SYS_EXTATTR_DELETE_FILE", - "SYS_EXTATTR_DELETE_LINK", - "SYS_EXTATTR_GET_FD", - "SYS_EXTATTR_GET_FILE", - "SYS_EXTATTR_GET_LINK", - "SYS_EXTATTR_LIST_FD", - "SYS_EXTATTR_LIST_FILE", - "SYS_EXTATTR_LIST_LINK", - "SYS_EXTATTR_SET_FD", - "SYS_EXTATTR_SET_FILE", - "SYS_EXTATTR_SET_LINK", - "SYS_FACCESSAT", - "SYS_FADVISE64", - "SYS_FADVISE64_64", - "SYS_FALLOCATE", - "SYS_FANOTIFY_INIT", - "SYS_FANOTIFY_MARK", - "SYS_FCHDIR", - "SYS_FCHFLAGS", - "SYS_FCHMOD", - "SYS_FCHMODAT", - "SYS_FCHMOD_EXTENDED", - "SYS_FCHOWN", - "SYS_FCHOWN32", - "SYS_FCHOWNAT", - "SYS_FCHROOT", - "SYS_FCNTL", - "SYS_FCNTL64", - "SYS_FCNTL_NOCANCEL", - "SYS_FDATASYNC", - "SYS_FEXECVE", - "SYS_FFCLOCK_GETCOUNTER", - "SYS_FFCLOCK_GETESTIMATE", - "SYS_FFCLOCK_SETESTIMATE", - "SYS_FFSCTL", - "SYS_FGETATTRLIST", - "SYS_FGETXATTR", - "SYS_FHOPEN", - "SYS_FHSTAT", - "SYS_FHSTATFS", - "SYS_FILEPORT_MAKEFD", - "SYS_FILEPORT_MAKEPORT", - "SYS_FKTRACE", - "SYS_FLISTXATTR", - "SYS_FLOCK", - "SYS_FORK", - "SYS_FPATHCONF", - "SYS_FREEBSD6_FTRUNCATE", - "SYS_FREEBSD6_LSEEK", - "SYS_FREEBSD6_MMAP", - "SYS_FREEBSD6_PREAD", - "SYS_FREEBSD6_PWRITE", - "SYS_FREEBSD6_TRUNCATE", - "SYS_FREMOVEXATTR", - "SYS_FSCTL", - "SYS_FSETATTRLIST", - "SYS_FSETXATTR", - "SYS_FSGETPATH", - "SYS_FSTAT", - "SYS_FSTAT64", - "SYS_FSTAT64_EXTENDED", - "SYS_FSTATAT", - "SYS_FSTATAT64", - "SYS_FSTATFS", - "SYS_FSTATFS64", - "SYS_FSTATV", - "SYS_FSTATVFS1", - "SYS_FSTAT_EXTENDED", - "SYS_FSYNC", - "SYS_FSYNC_NOCANCEL", - "SYS_FSYNC_RANGE", - "SYS_FTIME", - "SYS_FTRUNCATE", - "SYS_FTRUNCATE64", - "SYS_FUTEX", - "SYS_FUTIMENS", - "SYS_FUTIMES", - "SYS_FUTIMESAT", - "SYS_GETATTRLIST", - "SYS_GETAUDIT", - "SYS_GETAUDIT_ADDR", - "SYS_GETAUID", - "SYS_GETCONTEXT", - "SYS_GETCPU", - "SYS_GETCWD", - "SYS_GETDENTS", - "SYS_GETDENTS64", - "SYS_GETDIRENTRIES", - "SYS_GETDIRENTRIES64", - "SYS_GETDIRENTRIESATTR", - "SYS_GETDTABLECOUNT", - "SYS_GETDTABLESIZE", - "SYS_GETEGID", - "SYS_GETEGID32", - "SYS_GETEUID", - "SYS_GETEUID32", - "SYS_GETFH", - "SYS_GETFSSTAT", - "SYS_GETFSSTAT64", - "SYS_GETGID", - "SYS_GETGID32", - "SYS_GETGROUPS", - "SYS_GETGROUPS32", - "SYS_GETHOSTUUID", - "SYS_GETITIMER", - "SYS_GETLCID", - "SYS_GETLOGIN", - "SYS_GETLOGINCLASS", - "SYS_GETPEERNAME", - "SYS_GETPGID", - "SYS_GETPGRP", - "SYS_GETPID", - "SYS_GETPMSG", - "SYS_GETPPID", - "SYS_GETPRIORITY", - "SYS_GETRESGID", - "SYS_GETRESGID32", - "SYS_GETRESUID", - "SYS_GETRESUID32", - "SYS_GETRLIMIT", - "SYS_GETRTABLE", - "SYS_GETRUSAGE", - "SYS_GETSGROUPS", - "SYS_GETSID", - "SYS_GETSOCKNAME", - "SYS_GETSOCKOPT", - "SYS_GETTHRID", - "SYS_GETTID", - "SYS_GETTIMEOFDAY", - "SYS_GETUID", - "SYS_GETUID32", - "SYS_GETVFSSTAT", - "SYS_GETWGROUPS", - "SYS_GETXATTR", - "SYS_GET_KERNEL_SYMS", - "SYS_GET_MEMPOLICY", - "SYS_GET_ROBUST_LIST", - "SYS_GET_THREAD_AREA", - "SYS_GSSD_SYSCALL", - "SYS_GTTY", - "SYS_IDENTITYSVC", - "SYS_IDLE", - "SYS_INITGROUPS", - "SYS_INIT_MODULE", - "SYS_INOTIFY_ADD_WATCH", - "SYS_INOTIFY_INIT", - "SYS_INOTIFY_INIT1", - "SYS_INOTIFY_RM_WATCH", - "SYS_IOCTL", - "SYS_IOPERM", - "SYS_IOPL", - "SYS_IOPOLICYSYS", - "SYS_IOPRIO_GET", - "SYS_IOPRIO_SET", - "SYS_IO_CANCEL", - "SYS_IO_DESTROY", - "SYS_IO_GETEVENTS", - "SYS_IO_SETUP", - "SYS_IO_SUBMIT", - "SYS_IPC", - "SYS_ISSETUGID", - "SYS_JAIL", - "SYS_JAIL_ATTACH", - "SYS_JAIL_GET", - "SYS_JAIL_REMOVE", - "SYS_JAIL_SET", - "SYS_KAS_INFO", - "SYS_KDEBUG_TRACE", - "SYS_KENV", - "SYS_KEVENT", - "SYS_KEVENT64", - "SYS_KEXEC_LOAD", - "SYS_KEYCTL", - "SYS_KILL", - "SYS_KLDFIND", - "SYS_KLDFIRSTMOD", - "SYS_KLDLOAD", - "SYS_KLDNEXT", - "SYS_KLDSTAT", - "SYS_KLDSYM", - "SYS_KLDUNLOAD", - "SYS_KLDUNLOADF", - "SYS_KMQ_NOTIFY", - "SYS_KMQ_OPEN", - "SYS_KMQ_SETATTR", - "SYS_KMQ_TIMEDRECEIVE", - "SYS_KMQ_TIMEDSEND", - "SYS_KMQ_UNLINK", - "SYS_KQUEUE", - "SYS_KQUEUE1", - "SYS_KSEM_CLOSE", - "SYS_KSEM_DESTROY", - "SYS_KSEM_GETVALUE", - "SYS_KSEM_INIT", - "SYS_KSEM_OPEN", - "SYS_KSEM_POST", - "SYS_KSEM_TIMEDWAIT", - "SYS_KSEM_TRYWAIT", - "SYS_KSEM_UNLINK", - "SYS_KSEM_WAIT", - "SYS_KTIMER_CREATE", - "SYS_KTIMER_DELETE", - "SYS_KTIMER_GETOVERRUN", - "SYS_KTIMER_GETTIME", - "SYS_KTIMER_SETTIME", - "SYS_KTRACE", - "SYS_LCHFLAGS", - "SYS_LCHMOD", - "SYS_LCHOWN", - "SYS_LCHOWN32", - "SYS_LEDGER", - "SYS_LGETFH", - "SYS_LGETXATTR", - "SYS_LINK", - "SYS_LINKAT", - "SYS_LIO_LISTIO", - "SYS_LISTEN", - "SYS_LISTXATTR", - "SYS_LLISTXATTR", - "SYS_LOCK", - "SYS_LOOKUP_DCOOKIE", - "SYS_LPATHCONF", - "SYS_LREMOVEXATTR", - "SYS_LSEEK", - "SYS_LSETXATTR", - "SYS_LSTAT", - "SYS_LSTAT64", - "SYS_LSTAT64_EXTENDED", - "SYS_LSTATV", - "SYS_LSTAT_EXTENDED", - "SYS_LUTIMES", - "SYS_MAC_SYSCALL", - "SYS_MADVISE", - "SYS_MADVISE1", - "SYS_MAXSYSCALL", - "SYS_MBIND", - "SYS_MIGRATE_PAGES", - "SYS_MINCORE", - "SYS_MINHERIT", - "SYS_MKCOMPLEX", - "SYS_MKDIR", - "SYS_MKDIRAT", - "SYS_MKDIR_EXTENDED", - "SYS_MKFIFO", - "SYS_MKFIFOAT", - "SYS_MKFIFO_EXTENDED", - "SYS_MKNOD", - "SYS_MKNODAT", - "SYS_MLOCK", - "SYS_MLOCKALL", - "SYS_MMAP", - "SYS_MMAP2", - "SYS_MODCTL", - "SYS_MODFIND", - "SYS_MODFNEXT", - "SYS_MODIFY_LDT", - "SYS_MODNEXT", - "SYS_MODSTAT", - "SYS_MODWATCH", - "SYS_MOUNT", - "SYS_MOVE_PAGES", - "SYS_MPROTECT", - "SYS_MPX", - "SYS_MQUERY", - "SYS_MQ_GETSETATTR", - "SYS_MQ_NOTIFY", - "SYS_MQ_OPEN", - "SYS_MQ_TIMEDRECEIVE", - "SYS_MQ_TIMEDSEND", - "SYS_MQ_UNLINK", - "SYS_MREMAP", - "SYS_MSGCTL", - "SYS_MSGGET", - "SYS_MSGRCV", - "SYS_MSGRCV_NOCANCEL", - "SYS_MSGSND", - "SYS_MSGSND_NOCANCEL", - "SYS_MSGSYS", - "SYS_MSYNC", - "SYS_MSYNC_NOCANCEL", - "SYS_MUNLOCK", - "SYS_MUNLOCKALL", - "SYS_MUNMAP", - "SYS_NAME_TO_HANDLE_AT", - "SYS_NANOSLEEP", - "SYS_NEWFSTATAT", - "SYS_NFSCLNT", - "SYS_NFSSERVCTL", - "SYS_NFSSVC", - "SYS_NFSTAT", - "SYS_NICE", - "SYS_NLM_SYSCALL", - "SYS_NLSTAT", - "SYS_NMOUNT", - "SYS_NSTAT", - "SYS_NTP_ADJTIME", - "SYS_NTP_GETTIME", - "SYS_NUMA_GETAFFINITY", - "SYS_NUMA_SETAFFINITY", - "SYS_OABI_SYSCALL_BASE", - "SYS_OBREAK", - "SYS_OLDFSTAT", - "SYS_OLDLSTAT", - "SYS_OLDOLDUNAME", - "SYS_OLDSTAT", - "SYS_OLDUNAME", - "SYS_OPEN", - "SYS_OPENAT", - "SYS_OPENBSD_POLL", - "SYS_OPEN_BY_HANDLE_AT", - "SYS_OPEN_DPROTECTED_NP", - "SYS_OPEN_EXTENDED", - "SYS_OPEN_NOCANCEL", - "SYS_OVADVISE", - "SYS_PACCEPT", - "SYS_PATHCONF", - "SYS_PAUSE", - "SYS_PCICONFIG_IOBASE", - "SYS_PCICONFIG_READ", - "SYS_PCICONFIG_WRITE", - "SYS_PDFORK", - "SYS_PDGETPID", - "SYS_PDKILL", - "SYS_PERF_EVENT_OPEN", - "SYS_PERSONALITY", - "SYS_PID_HIBERNATE", - "SYS_PID_RESUME", - "SYS_PID_SHUTDOWN_SOCKETS", - "SYS_PID_SUSPEND", - "SYS_PIPE", - "SYS_PIPE2", - "SYS_PIVOT_ROOT", - "SYS_PMC_CONTROL", - "SYS_PMC_GET_INFO", - "SYS_POLL", - "SYS_POLLTS", - "SYS_POLL_NOCANCEL", - "SYS_POSIX_FADVISE", - "SYS_POSIX_FALLOCATE", - "SYS_POSIX_OPENPT", - "SYS_POSIX_SPAWN", - "SYS_PPOLL", - "SYS_PRCTL", - "SYS_PREAD", - "SYS_PREAD64", - "SYS_PREADV", - "SYS_PREAD_NOCANCEL", - "SYS_PRLIMIT64", - "SYS_PROCCTL", - "SYS_PROCESS_POLICY", - "SYS_PROCESS_VM_READV", - "SYS_PROCESS_VM_WRITEV", - "SYS_PROC_INFO", - "SYS_PROF", - "SYS_PROFIL", - "SYS_PSELECT", - "SYS_PSELECT6", - "SYS_PSET_ASSIGN", - "SYS_PSET_CREATE", - "SYS_PSET_DESTROY", - "SYS_PSYNCH_CVBROAD", - "SYS_PSYNCH_CVCLRPREPOST", - "SYS_PSYNCH_CVSIGNAL", - "SYS_PSYNCH_CVWAIT", - "SYS_PSYNCH_MUTEXDROP", - "SYS_PSYNCH_MUTEXWAIT", - "SYS_PSYNCH_RW_DOWNGRADE", - "SYS_PSYNCH_RW_LONGRDLOCK", - "SYS_PSYNCH_RW_RDLOCK", - "SYS_PSYNCH_RW_UNLOCK", - "SYS_PSYNCH_RW_UNLOCK2", - "SYS_PSYNCH_RW_UPGRADE", - "SYS_PSYNCH_RW_WRLOCK", - "SYS_PSYNCH_RW_YIELDWRLOCK", - "SYS_PTRACE", - "SYS_PUTPMSG", - "SYS_PWRITE", - "SYS_PWRITE64", - "SYS_PWRITEV", - "SYS_PWRITE_NOCANCEL", - "SYS_QUERY_MODULE", - "SYS_QUOTACTL", - "SYS_RASCTL", - "SYS_RCTL_ADD_RULE", - "SYS_RCTL_GET_LIMITS", - "SYS_RCTL_GET_RACCT", - "SYS_RCTL_GET_RULES", - "SYS_RCTL_REMOVE_RULE", - "SYS_READ", - "SYS_READAHEAD", - "SYS_READDIR", - "SYS_READLINK", - "SYS_READLINKAT", - "SYS_READV", - "SYS_READV_NOCANCEL", - "SYS_READ_NOCANCEL", - "SYS_REBOOT", - "SYS_RECV", - "SYS_RECVFROM", - "SYS_RECVFROM_NOCANCEL", - "SYS_RECVMMSG", - "SYS_RECVMSG", - "SYS_RECVMSG_NOCANCEL", - "SYS_REMAP_FILE_PAGES", - "SYS_REMOVEXATTR", - "SYS_RENAME", - "SYS_RENAMEAT", - "SYS_REQUEST_KEY", - "SYS_RESTART_SYSCALL", - "SYS_REVOKE", - "SYS_RFORK", - "SYS_RMDIR", - "SYS_RTPRIO", - "SYS_RTPRIO_THREAD", - "SYS_RT_SIGACTION", - "SYS_RT_SIGPENDING", - "SYS_RT_SIGPROCMASK", - "SYS_RT_SIGQUEUEINFO", - "SYS_RT_SIGRETURN", - "SYS_RT_SIGSUSPEND", - "SYS_RT_SIGTIMEDWAIT", - "SYS_RT_TGSIGQUEUEINFO", - "SYS_SBRK", - "SYS_SCHED_GETAFFINITY", - "SYS_SCHED_GETPARAM", - "SYS_SCHED_GETSCHEDULER", - "SYS_SCHED_GET_PRIORITY_MAX", - "SYS_SCHED_GET_PRIORITY_MIN", - "SYS_SCHED_RR_GET_INTERVAL", - "SYS_SCHED_SETAFFINITY", - "SYS_SCHED_SETPARAM", - "SYS_SCHED_SETSCHEDULER", - "SYS_SCHED_YIELD", - "SYS_SCTP_GENERIC_RECVMSG", - "SYS_SCTP_GENERIC_SENDMSG", - "SYS_SCTP_GENERIC_SENDMSG_IOV", - "SYS_SCTP_PEELOFF", - "SYS_SEARCHFS", - "SYS_SECURITY", - "SYS_SELECT", - "SYS_SELECT_NOCANCEL", - "SYS_SEMCONFIG", - "SYS_SEMCTL", - "SYS_SEMGET", - "SYS_SEMOP", - "SYS_SEMSYS", - "SYS_SEMTIMEDOP", - "SYS_SEM_CLOSE", - "SYS_SEM_DESTROY", - "SYS_SEM_GETVALUE", - "SYS_SEM_INIT", - "SYS_SEM_OPEN", - "SYS_SEM_POST", - "SYS_SEM_TRYWAIT", - "SYS_SEM_UNLINK", - "SYS_SEM_WAIT", - "SYS_SEM_WAIT_NOCANCEL", - "SYS_SEND", - "SYS_SENDFILE", - "SYS_SENDFILE64", - "SYS_SENDMMSG", - "SYS_SENDMSG", - "SYS_SENDMSG_NOCANCEL", - "SYS_SENDTO", - "SYS_SENDTO_NOCANCEL", - "SYS_SETATTRLIST", - "SYS_SETAUDIT", - "SYS_SETAUDIT_ADDR", - "SYS_SETAUID", - "SYS_SETCONTEXT", - "SYS_SETDOMAINNAME", - "SYS_SETEGID", - "SYS_SETEUID", - "SYS_SETFIB", - "SYS_SETFSGID", - "SYS_SETFSGID32", - "SYS_SETFSUID", - "SYS_SETFSUID32", - "SYS_SETGID", - "SYS_SETGID32", - "SYS_SETGROUPS", - "SYS_SETGROUPS32", - "SYS_SETHOSTNAME", - "SYS_SETITIMER", - "SYS_SETLCID", - "SYS_SETLOGIN", - "SYS_SETLOGINCLASS", - "SYS_SETNS", - "SYS_SETPGID", - "SYS_SETPRIORITY", - "SYS_SETPRIVEXEC", - "SYS_SETREGID", - "SYS_SETREGID32", - "SYS_SETRESGID", - "SYS_SETRESGID32", - "SYS_SETRESUID", - "SYS_SETRESUID32", - "SYS_SETREUID", - "SYS_SETREUID32", - "SYS_SETRLIMIT", - "SYS_SETRTABLE", - "SYS_SETSGROUPS", - "SYS_SETSID", - "SYS_SETSOCKOPT", - "SYS_SETTID", - "SYS_SETTID_WITH_PID", - "SYS_SETTIMEOFDAY", - "SYS_SETUID", - "SYS_SETUID32", - "SYS_SETWGROUPS", - "SYS_SETXATTR", - "SYS_SET_MEMPOLICY", - "SYS_SET_ROBUST_LIST", - "SYS_SET_THREAD_AREA", - "SYS_SET_TID_ADDRESS", - "SYS_SGETMASK", - "SYS_SHARED_REGION_CHECK_NP", - "SYS_SHARED_REGION_MAP_AND_SLIDE_NP", - "SYS_SHMAT", - "SYS_SHMCTL", - "SYS_SHMDT", - "SYS_SHMGET", - "SYS_SHMSYS", - "SYS_SHM_OPEN", - "SYS_SHM_UNLINK", - "SYS_SHUTDOWN", - "SYS_SIGACTION", - "SYS_SIGALTSTACK", - "SYS_SIGNAL", - "SYS_SIGNALFD", - "SYS_SIGNALFD4", - "SYS_SIGPENDING", - "SYS_SIGPROCMASK", - "SYS_SIGQUEUE", - "SYS_SIGQUEUEINFO", - "SYS_SIGRETURN", - "SYS_SIGSUSPEND", - "SYS_SIGSUSPEND_NOCANCEL", - "SYS_SIGTIMEDWAIT", - "SYS_SIGWAIT", - "SYS_SIGWAITINFO", - "SYS_SOCKET", - "SYS_SOCKETCALL", - "SYS_SOCKETPAIR", - "SYS_SPLICE", - "SYS_SSETMASK", - "SYS_SSTK", - "SYS_STACK_SNAPSHOT", - "SYS_STAT", - "SYS_STAT64", - "SYS_STAT64_EXTENDED", - "SYS_STATFS", - "SYS_STATFS64", - "SYS_STATV", - "SYS_STATVFS1", - "SYS_STAT_EXTENDED", - "SYS_STIME", - "SYS_STTY", - "SYS_SWAPCONTEXT", - "SYS_SWAPCTL", - "SYS_SWAPOFF", - "SYS_SWAPON", - "SYS_SYMLINK", - "SYS_SYMLINKAT", - "SYS_SYNC", - "SYS_SYNCFS", - "SYS_SYNC_FILE_RANGE", - "SYS_SYSARCH", - "SYS_SYSCALL", - "SYS_SYSCALL_BASE", - "SYS_SYSFS", - "SYS_SYSINFO", - "SYS_SYSLOG", - "SYS_TEE", - "SYS_TGKILL", - "SYS_THREAD_SELFID", - "SYS_THR_CREATE", - "SYS_THR_EXIT", - "SYS_THR_KILL", - "SYS_THR_KILL2", - "SYS_THR_NEW", - "SYS_THR_SELF", - "SYS_THR_SET_NAME", - "SYS_THR_SUSPEND", - "SYS_THR_WAKE", - "SYS_TIME", - "SYS_TIMERFD_CREATE", - "SYS_TIMERFD_GETTIME", - "SYS_TIMERFD_SETTIME", - "SYS_TIMER_CREATE", - "SYS_TIMER_DELETE", - "SYS_TIMER_GETOVERRUN", - "SYS_TIMER_GETTIME", - "SYS_TIMER_SETTIME", - "SYS_TIMES", - "SYS_TKILL", - "SYS_TRUNCATE", - "SYS_TRUNCATE64", - "SYS_TUXCALL", - "SYS_UGETRLIMIT", - "SYS_ULIMIT", - "SYS_UMASK", - "SYS_UMASK_EXTENDED", - "SYS_UMOUNT", - "SYS_UMOUNT2", - "SYS_UNAME", - "SYS_UNDELETE", - "SYS_UNLINK", - "SYS_UNLINKAT", - "SYS_UNMOUNT", - "SYS_UNSHARE", - "SYS_USELIB", - "SYS_USTAT", - "SYS_UTIME", - "SYS_UTIMENSAT", - "SYS_UTIMES", - "SYS_UTRACE", - "SYS_UUIDGEN", - "SYS_VADVISE", - "SYS_VFORK", - "SYS_VHANGUP", - "SYS_VM86", - "SYS_VM86OLD", - "SYS_VMSPLICE", - "SYS_VM_PRESSURE_MONITOR", - "SYS_VSERVER", - "SYS_WAIT4", - "SYS_WAIT4_NOCANCEL", - "SYS_WAIT6", - "SYS_WAITEVENT", - "SYS_WAITID", - "SYS_WAITID_NOCANCEL", - "SYS_WAITPID", - "SYS_WATCHEVENT", - "SYS_WORKQ_KERNRETURN", - "SYS_WORKQ_OPEN", - "SYS_WRITE", - "SYS_WRITEV", - "SYS_WRITEV_NOCANCEL", - "SYS_WRITE_NOCANCEL", - "SYS_YIELD", - "SYS__LLSEEK", - "SYS__LWP_CONTINUE", - "SYS__LWP_CREATE", - "SYS__LWP_CTL", - "SYS__LWP_DETACH", - "SYS__LWP_EXIT", - "SYS__LWP_GETNAME", - "SYS__LWP_GETPRIVATE", - "SYS__LWP_KILL", - "SYS__LWP_PARK", - "SYS__LWP_SELF", - "SYS__LWP_SETNAME", - "SYS__LWP_SETPRIVATE", - "SYS__LWP_SUSPEND", - "SYS__LWP_UNPARK", - "SYS__LWP_UNPARK_ALL", - "SYS__LWP_WAIT", - "SYS__LWP_WAKEUP", - "SYS__NEWSELECT", - "SYS__PSET_BIND", - "SYS__SCHED_GETAFFINITY", - "SYS__SCHED_GETPARAM", - "SYS__SCHED_SETAFFINITY", - "SYS__SCHED_SETPARAM", - "SYS__SYSCTL", - "SYS__UMTX_LOCK", - "SYS__UMTX_OP", - "SYS__UMTX_UNLOCK", - "SYS___ACL_ACLCHECK_FD", - "SYS___ACL_ACLCHECK_FILE", - "SYS___ACL_ACLCHECK_LINK", - "SYS___ACL_DELETE_FD", - "SYS___ACL_DELETE_FILE", - "SYS___ACL_DELETE_LINK", - "SYS___ACL_GET_FD", - "SYS___ACL_GET_FILE", - "SYS___ACL_GET_LINK", - "SYS___ACL_SET_FD", - "SYS___ACL_SET_FILE", - "SYS___ACL_SET_LINK", - "SYS___CAP_RIGHTS_GET", - "SYS___CLONE", - "SYS___DISABLE_THREADSIGNAL", - "SYS___GETCWD", - "SYS___GETLOGIN", - "SYS___GET_TCB", - "SYS___MAC_EXECVE", - "SYS___MAC_GETFSSTAT", - "SYS___MAC_GET_FD", - "SYS___MAC_GET_FILE", - "SYS___MAC_GET_LCID", - "SYS___MAC_GET_LCTX", - "SYS___MAC_GET_LINK", - "SYS___MAC_GET_MOUNT", - "SYS___MAC_GET_PID", - "SYS___MAC_GET_PROC", - "SYS___MAC_MOUNT", - "SYS___MAC_SET_FD", - "SYS___MAC_SET_FILE", - "SYS___MAC_SET_LCTX", - "SYS___MAC_SET_LINK", - "SYS___MAC_SET_PROC", - "SYS___MAC_SYSCALL", - "SYS___OLD_SEMWAIT_SIGNAL", - "SYS___OLD_SEMWAIT_SIGNAL_NOCANCEL", - "SYS___POSIX_CHOWN", - "SYS___POSIX_FCHOWN", - "SYS___POSIX_LCHOWN", - "SYS___POSIX_RENAME", - "SYS___PTHREAD_CANCELED", - "SYS___PTHREAD_CHDIR", - "SYS___PTHREAD_FCHDIR", - "SYS___PTHREAD_KILL", - "SYS___PTHREAD_MARKCANCEL", - "SYS___PTHREAD_SIGMASK", - "SYS___QUOTACTL", - "SYS___SEMCTL", - "SYS___SEMWAIT_SIGNAL", - "SYS___SEMWAIT_SIGNAL_NOCANCEL", - "SYS___SETLOGIN", - "SYS___SETUGID", - "SYS___SET_TCB", - "SYS___SIGACTION_SIGTRAMP", - "SYS___SIGTIMEDWAIT", - "SYS___SIGWAIT", - "SYS___SIGWAIT_NOCANCEL", - "SYS___SYSCTL", - "SYS___TFORK", - "SYS___THREXIT", - "SYS___THRSIGDIVERT", - "SYS___THRSLEEP", - "SYS___THRWAKEUP", - "S_ARCH1", - "S_ARCH2", - "S_BLKSIZE", - "S_IEXEC", - "S_IFBLK", - "S_IFCHR", - "S_IFDIR", - "S_IFIFO", - "S_IFLNK", - "S_IFMT", - "S_IFREG", - "S_IFSOCK", - "S_IFWHT", - "S_IREAD", - "S_IRGRP", - "S_IROTH", - "S_IRUSR", - "S_IRWXG", - "S_IRWXO", - "S_IRWXU", - "S_ISGID", - "S_ISTXT", - "S_ISUID", - "S_ISVTX", - "S_IWGRP", - "S_IWOTH", - "S_IWRITE", - "S_IWUSR", - "S_IXGRP", - "S_IXOTH", - "S_IXUSR", - "S_LOGIN_SET", - "SecurityAttributes", - "Seek", - "Select", - "Sendfile", - "Sendmsg", - "SendmsgN", - "Sendto", - "Servent", - "SetBpf", - "SetBpfBuflen", - "SetBpfDatalink", - "SetBpfHeadercmpl", - "SetBpfImmediate", - "SetBpfInterface", - "SetBpfPromisc", - "SetBpfTimeout", - "SetCurrentDirectory", - "SetEndOfFile", - "SetEnvironmentVariable", - "SetFileAttributes", - "SetFileCompletionNotificationModes", - "SetFilePointer", - "SetFileTime", - "SetHandleInformation", - "SetKevent", - "SetLsfPromisc", - "SetNonblock", - "Setdomainname", - "Setegid", - "Setenv", - "Seteuid", - "Setfsgid", - "Setfsuid", - "Setgid", - "Setgroups", - "Sethostname", - "Setlogin", - "Setpgid", - "Setpriority", - "Setprivexec", - "Setregid", - "Setresgid", - "Setresuid", - "Setreuid", - "Setrlimit", - "Setsid", - "Setsockopt", - "SetsockoptByte", - "SetsockoptICMPv6Filter", - "SetsockoptIPMreq", - "SetsockoptIPMreqn", - "SetsockoptIPv6Mreq", - "SetsockoptInet4Addr", - "SetsockoptInt", - "SetsockoptLinger", - "SetsockoptString", - "SetsockoptTimeval", - "Settimeofday", - "Setuid", - "Setxattr", - "Shutdown", - "SidTypeAlias", - "SidTypeComputer", - "SidTypeDeletedAccount", - "SidTypeDomain", - "SidTypeGroup", - "SidTypeInvalid", - "SidTypeLabel", - "SidTypeUnknown", - "SidTypeUser", - "SidTypeWellKnownGroup", - "Signal", - "SizeofBpfHdr", - "SizeofBpfInsn", - "SizeofBpfProgram", - "SizeofBpfStat", - "SizeofBpfVersion", - "SizeofBpfZbuf", - "SizeofBpfZbufHeader", - "SizeofCmsghdr", - "SizeofICMPv6Filter", - "SizeofIPMreq", - "SizeofIPMreqn", - "SizeofIPv6MTUInfo", - "SizeofIPv6Mreq", - "SizeofIfAddrmsg", - "SizeofIfAnnounceMsghdr", - "SizeofIfData", - "SizeofIfInfomsg", - "SizeofIfMsghdr", - "SizeofIfaMsghdr", - "SizeofIfmaMsghdr", - "SizeofIfmaMsghdr2", - "SizeofInet4Pktinfo", - "SizeofInet6Pktinfo", - "SizeofInotifyEvent", - "SizeofLinger", - "SizeofMsghdr", - "SizeofNlAttr", - "SizeofNlMsgerr", - "SizeofNlMsghdr", - "SizeofRtAttr", - "SizeofRtGenmsg", - "SizeofRtMetrics", - "SizeofRtMsg", - "SizeofRtMsghdr", - "SizeofRtNexthop", - "SizeofSockFilter", - "SizeofSockFprog", - "SizeofSockaddrAny", - "SizeofSockaddrDatalink", - "SizeofSockaddrInet4", - "SizeofSockaddrInet6", - "SizeofSockaddrLinklayer", - "SizeofSockaddrNetlink", - "SizeofSockaddrUnix", - "SizeofTCPInfo", - "SizeofUcred", - "SlicePtrFromStrings", - "SockFilter", - "SockFprog", - "Sockaddr", - "SockaddrDatalink", - "SockaddrGen", - "SockaddrInet4", - "SockaddrInet6", - "SockaddrLinklayer", - "SockaddrNetlink", - "SockaddrUnix", - "Socket", - "SocketControlMessage", - "SocketDisableIPv6", - "Socketpair", - "Splice", - "StartProcess", - "StartupInfo", - "Stat", - "Stat_t", - "Statfs", - "Statfs_t", - "Stderr", - "Stdin", - "Stdout", - "StringBytePtr", - "StringByteSlice", - "StringSlicePtr", - "StringToSid", - "StringToUTF16", - "StringToUTF16Ptr", - "Symlink", - "Sync", - "SyncFileRange", - "SysProcAttr", - "SysProcIDMap", - "Syscall", - "Syscall12", - "Syscall15", - "Syscall18", - "Syscall6", - "Syscall9", - "SyscallN", - "Sysctl", - "SysctlUint32", - "Sysctlnode", - "Sysinfo", - "Sysinfo_t", - "Systemtime", - "TCGETS", - "TCIFLUSH", - "TCIOFLUSH", - "TCOFLUSH", - "TCPInfo", - "TCPKeepalive", - "TCP_CA_NAME_MAX", - "TCP_CONGCTL", - "TCP_CONGESTION", - "TCP_CONNECTIONTIMEOUT", - "TCP_CORK", - "TCP_DEFER_ACCEPT", - "TCP_ENABLE_ECN", - "TCP_INFO", - "TCP_KEEPALIVE", - "TCP_KEEPCNT", - "TCP_KEEPIDLE", - "TCP_KEEPINIT", - "TCP_KEEPINTVL", - "TCP_LINGER2", - "TCP_MAXBURST", - "TCP_MAXHLEN", - "TCP_MAXOLEN", - "TCP_MAXSEG", - "TCP_MAXWIN", - "TCP_MAX_SACK", - "TCP_MAX_WINSHIFT", - "TCP_MD5SIG", - "TCP_MD5SIG_MAXKEYLEN", - "TCP_MINMSS", - "TCP_MINMSSOVERLOAD", - "TCP_MSS", - "TCP_NODELAY", - "TCP_NOOPT", - "TCP_NOPUSH", - "TCP_NOTSENT_LOWAT", - "TCP_NSTATES", - "TCP_QUICKACK", - "TCP_RXT_CONNDROPTIME", - "TCP_RXT_FINDROP", - "TCP_SACK_ENABLE", - "TCP_SENDMOREACKS", - "TCP_SYNCNT", - "TCP_VENDOR", - "TCP_WINDOW_CLAMP", - "TCSAFLUSH", - "TCSETS", - "TF_DISCONNECT", - "TF_REUSE_SOCKET", - "TF_USE_DEFAULT_WORKER", - "TF_USE_KERNEL_APC", - "TF_USE_SYSTEM_THREAD", - "TF_WRITE_BEHIND", - "TH32CS_INHERIT", - "TH32CS_SNAPALL", - "TH32CS_SNAPHEAPLIST", - "TH32CS_SNAPMODULE", - "TH32CS_SNAPMODULE32", - "TH32CS_SNAPPROCESS", - "TH32CS_SNAPTHREAD", - "TIME_ZONE_ID_DAYLIGHT", - "TIME_ZONE_ID_STANDARD", - "TIME_ZONE_ID_UNKNOWN", - "TIOCCBRK", - "TIOCCDTR", - "TIOCCONS", - "TIOCDCDTIMESTAMP", - "TIOCDRAIN", - "TIOCDSIMICROCODE", - "TIOCEXCL", - "TIOCEXT", - "TIOCFLAG_CDTRCTS", - "TIOCFLAG_CLOCAL", - "TIOCFLAG_CRTSCTS", - "TIOCFLAG_MDMBUF", - "TIOCFLAG_PPS", - "TIOCFLAG_SOFTCAR", - "TIOCFLUSH", - "TIOCGDEV", - "TIOCGDRAINWAIT", - "TIOCGETA", - "TIOCGETD", - "TIOCGFLAGS", - "TIOCGICOUNT", - "TIOCGLCKTRMIOS", - "TIOCGLINED", - "TIOCGPGRP", - "TIOCGPTN", - "TIOCGQSIZE", - "TIOCGRANTPT", - "TIOCGRS485", - "TIOCGSERIAL", - "TIOCGSID", - "TIOCGSIZE", - "TIOCGSOFTCAR", - "TIOCGTSTAMP", - "TIOCGWINSZ", - "TIOCINQ", - "TIOCIXOFF", - "TIOCIXON", - "TIOCLINUX", - "TIOCMBIC", - "TIOCMBIS", - "TIOCMGDTRWAIT", - "TIOCMGET", - "TIOCMIWAIT", - "TIOCMODG", - "TIOCMODS", - "TIOCMSDTRWAIT", - "TIOCMSET", - "TIOCM_CAR", - "TIOCM_CD", - "TIOCM_CTS", - "TIOCM_DCD", - "TIOCM_DSR", - "TIOCM_DTR", - "TIOCM_LE", - "TIOCM_RI", - "TIOCM_RNG", - "TIOCM_RTS", - "TIOCM_SR", - "TIOCM_ST", - "TIOCNOTTY", - "TIOCNXCL", - "TIOCOUTQ", - "TIOCPKT", - "TIOCPKT_DATA", - "TIOCPKT_DOSTOP", - "TIOCPKT_FLUSHREAD", - "TIOCPKT_FLUSHWRITE", - "TIOCPKT_IOCTL", - "TIOCPKT_NOSTOP", - "TIOCPKT_START", - "TIOCPKT_STOP", - "TIOCPTMASTER", - "TIOCPTMGET", - "TIOCPTSNAME", - "TIOCPTYGNAME", - "TIOCPTYGRANT", - "TIOCPTYUNLK", - "TIOCRCVFRAME", - "TIOCREMOTE", - "TIOCSBRK", - "TIOCSCONS", - "TIOCSCTTY", - "TIOCSDRAINWAIT", - "TIOCSDTR", - "TIOCSERCONFIG", - "TIOCSERGETLSR", - "TIOCSERGETMULTI", - "TIOCSERGSTRUCT", - "TIOCSERGWILD", - "TIOCSERSETMULTI", - "TIOCSERSWILD", - "TIOCSER_TEMT", - "TIOCSETA", - "TIOCSETAF", - "TIOCSETAW", - "TIOCSETD", - "TIOCSFLAGS", - "TIOCSIG", - "TIOCSLCKTRMIOS", - "TIOCSLINED", - "TIOCSPGRP", - "TIOCSPTLCK", - "TIOCSQSIZE", - "TIOCSRS485", - "TIOCSSERIAL", - "TIOCSSIZE", - "TIOCSSOFTCAR", - "TIOCSTART", - "TIOCSTAT", - "TIOCSTI", - "TIOCSTOP", - "TIOCSTSTAMP", - "TIOCSWINSZ", - "TIOCTIMESTAMP", - "TIOCUCNTL", - "TIOCVHANGUP", - "TIOCXMTFRAME", - "TOKEN_ADJUST_DEFAULT", - "TOKEN_ADJUST_GROUPS", - "TOKEN_ADJUST_PRIVILEGES", - "TOKEN_ADJUST_SESSIONID", - "TOKEN_ALL_ACCESS", - "TOKEN_ASSIGN_PRIMARY", - "TOKEN_DUPLICATE", - "TOKEN_EXECUTE", - "TOKEN_IMPERSONATE", - "TOKEN_QUERY", - "TOKEN_QUERY_SOURCE", - "TOKEN_READ", - "TOKEN_WRITE", - "TOSTOP", - "TRUNCATE_EXISTING", - "TUNATTACHFILTER", - "TUNDETACHFILTER", - "TUNGETFEATURES", - "TUNGETIFF", - "TUNGETSNDBUF", - "TUNGETVNETHDRSZ", - "TUNSETDEBUG", - "TUNSETGROUP", - "TUNSETIFF", - "TUNSETLINK", - "TUNSETNOCSUM", - "TUNSETOFFLOAD", - "TUNSETOWNER", - "TUNSETPERSIST", - "TUNSETSNDBUF", - "TUNSETTXFILTER", - "TUNSETVNETHDRSZ", - "Tee", - "TerminateProcess", - "Termios", - "Tgkill", - "Time", - "Time_t", - "Times", - "Timespec", - "TimespecToNsec", - "Timeval", - "Timeval32", - "TimevalToNsec", - "Timex", - "Timezoneinformation", - "Tms", - "Token", - "TokenAccessInformation", - "TokenAuditPolicy", - "TokenDefaultDacl", - "TokenElevation", - "TokenElevationType", - "TokenGroups", - "TokenGroupsAndPrivileges", - "TokenHasRestrictions", - "TokenImpersonationLevel", - "TokenIntegrityLevel", - "TokenLinkedToken", - "TokenLogonSid", - "TokenMandatoryPolicy", - "TokenOrigin", - "TokenOwner", - "TokenPrimaryGroup", - "TokenPrivileges", - "TokenRestrictedSids", - "TokenSandBoxInert", - "TokenSessionId", - "TokenSessionReference", - "TokenSource", - "TokenStatistics", - "TokenType", - "TokenUIAccess", - "TokenUser", - "TokenVirtualizationAllowed", - "TokenVirtualizationEnabled", - "Tokenprimarygroup", - "Tokenuser", - "TranslateAccountName", - "TranslateName", - "TransmitFile", - "TransmitFileBuffers", - "Truncate", - "UNIX_PATH_MAX", - "USAGE_MATCH_TYPE_AND", - "USAGE_MATCH_TYPE_OR", - "UTF16FromString", - "UTF16PtrFromString", - "UTF16ToString", - "Ucred", - "Umask", - "Uname", - "Undelete", - "UnixCredentials", - "UnixRights", - "Unlink", - "Unlinkat", - "UnmapViewOfFile", - "Unmount", - "Unsetenv", - "Unshare", - "UserInfo10", - "Ustat", - "Ustat_t", - "Utimbuf", - "Utime", - "Utimes", - "UtimesNano", - "Utsname", - "VDISCARD", - "VDSUSP", - "VEOF", - "VEOL", - "VEOL2", - "VERASE", - "VERASE2", - "VINTR", - "VKILL", - "VLNEXT", - "VMIN", - "VQUIT", - "VREPRINT", - "VSTART", - "VSTATUS", - "VSTOP", - "VSUSP", - "VSWTC", - "VT0", - "VT1", - "VTDLY", - "VTIME", - "VWERASE", - "VirtualLock", - "VirtualUnlock", - "WAIT_ABANDONED", - "WAIT_FAILED", - "WAIT_OBJECT_0", - "WAIT_TIMEOUT", - "WALL", - "WALLSIG", - "WALTSIG", - "WCLONE", - "WCONTINUED", - "WCOREFLAG", - "WEXITED", - "WLINUXCLONE", - "WNOHANG", - "WNOTHREAD", - "WNOWAIT", - "WNOZOMBIE", - "WOPTSCHECKED", - "WORDSIZE", - "WSABuf", - "WSACleanup", - "WSADESCRIPTION_LEN", - "WSAData", - "WSAEACCES", - "WSAECONNABORTED", - "WSAECONNRESET", - "WSAEnumProtocols", - "WSAID_CONNECTEX", - "WSAIoctl", - "WSAPROTOCOL_LEN", - "WSAProtocolChain", - "WSAProtocolInfo", - "WSARecv", - "WSARecvFrom", - "WSASYS_STATUS_LEN", - "WSASend", - "WSASendTo", - "WSASendto", - "WSAStartup", - "WSTOPPED", - "WTRAPPED", - "WUNTRACED", - "Wait4", - "WaitForSingleObject", - "WaitStatus", - "Win32FileAttributeData", - "Win32finddata", - "Write", - "WriteConsole", - "WriteFile", - "X509_ASN_ENCODING", - "XCASE", - "XP1_CONNECTIONLESS", - "XP1_CONNECT_DATA", - "XP1_DISCONNECT_DATA", - "XP1_EXPEDITED_DATA", - "XP1_GRACEFUL_CLOSE", - "XP1_GUARANTEED_DELIVERY", - "XP1_GUARANTEED_ORDER", - "XP1_IFS_HANDLES", - "XP1_MESSAGE_ORIENTED", - "XP1_MULTIPOINT_CONTROL_PLANE", - "XP1_MULTIPOINT_DATA_PLANE", - "XP1_PARTIAL_MESSAGE", - "XP1_PSEUDO_STREAM", - "XP1_QOS_SUPPORTED", - "XP1_SAN_SUPPORT_SDP", - "XP1_SUPPORT_BROADCAST", - "XP1_SUPPORT_MULTIPOINT", - "XP1_UNI_RECV", - "XP1_UNI_SEND", - }, - "syscall/js": { - "CopyBytesToGo", - "CopyBytesToJS", - "Error", - "Func", - "FuncOf", - "Global", - "Null", - "Type", - "TypeBoolean", - "TypeFunction", - "TypeNull", - "TypeNumber", - "TypeObject", - "TypeString", - "TypeSymbol", - "TypeUndefined", - "Undefined", - "Value", - "ValueError", - "ValueOf", - }, - "testing": { - "AllocsPerRun", - "B", - "Benchmark", - "BenchmarkResult", - "Cover", - "CoverBlock", - "CoverMode", - "Coverage", - "F", - "Init", - "InternalBenchmark", - "InternalExample", - "InternalFuzzTarget", - "InternalTest", - "M", - "Main", - "MainStart", - "PB", - "RegisterCover", - "RunBenchmarks", - "RunExamples", - "RunTests", - "Short", - "T", - "TB", - "Testing", - "Verbose", - }, - "testing/fstest": { - "MapFS", - "MapFile", - "TestFS", - }, - "testing/iotest": { - "DataErrReader", - "ErrReader", - "ErrTimeout", - "HalfReader", - "NewReadLogger", - "NewWriteLogger", - "OneByteReader", - "TestReader", - "TimeoutReader", - "TruncateWriter", - }, - "testing/quick": { - "Check", - "CheckEqual", - "CheckEqualError", - "CheckError", - "Config", - "Generator", - "SetupError", - "Value", - }, - "testing/slogtest": { - "TestHandler", - }, - "text/scanner": { - "Char", - "Comment", - "EOF", - "Float", - "GoTokens", - "GoWhitespace", - "Ident", - "Int", - "Position", - "RawString", - "ScanChars", - "ScanComments", - "ScanFloats", - "ScanIdents", - "ScanInts", - "ScanRawStrings", - "ScanStrings", - "Scanner", - "SkipComments", - "String", - "TokenString", - }, - "text/tabwriter": { - "AlignRight", - "Debug", - "DiscardEmptyColumns", - "Escape", - "FilterHTML", - "NewWriter", - "StripEscape", - "TabIndent", - "Writer", - }, - "text/template": { - "ExecError", - "FuncMap", - "HTMLEscape", - "HTMLEscapeString", - "HTMLEscaper", - "IsTrue", - "JSEscape", - "JSEscapeString", - "JSEscaper", - "Must", - "New", - "ParseFS", - "ParseFiles", - "ParseGlob", - "Template", - "URLQueryEscaper", - }, - "text/template/parse": { - "ActionNode", - "BoolNode", - "BranchNode", - "BreakNode", - "ChainNode", - "CommandNode", - "CommentNode", - "ContinueNode", - "DotNode", - "FieldNode", - "IdentifierNode", - "IfNode", - "IsEmptyTree", - "ListNode", - "Mode", - "New", - "NewIdentifier", - "NilNode", - "Node", - "NodeAction", - "NodeBool", - "NodeBreak", - "NodeChain", - "NodeCommand", - "NodeComment", - "NodeContinue", - "NodeDot", - "NodeField", - "NodeIdentifier", - "NodeIf", - "NodeList", - "NodeNil", - "NodeNumber", - "NodePipe", - "NodeRange", - "NodeString", - "NodeTemplate", - "NodeText", - "NodeType", - "NodeVariable", - "NodeWith", - "NumberNode", - "Parse", - "ParseComments", - "PipeNode", - "Pos", - "RangeNode", - "SkipFuncCheck", - "StringNode", - "TemplateNode", - "TextNode", - "Tree", - "VariableNode", - "WithNode", - }, - "time": { - "ANSIC", - "After", - "AfterFunc", - "April", - "August", - "Date", - "DateOnly", - "DateTime", - "December", - "Duration", - "February", - "FixedZone", - "Friday", - "Hour", - "January", - "July", - "June", - "Kitchen", - "Layout", - "LoadLocation", - "LoadLocationFromTZData", - "Local", - "Location", - "March", - "May", - "Microsecond", - "Millisecond", - "Minute", - "Monday", - "Month", - "Nanosecond", - "NewTicker", - "NewTimer", - "November", - "Now", - "October", - "Parse", - "ParseDuration", - "ParseError", - "ParseInLocation", - "RFC1123", - "RFC1123Z", - "RFC3339", - "RFC3339Nano", - "RFC822", - "RFC822Z", - "RFC850", - "RubyDate", - "Saturday", - "Second", - "September", - "Since", - "Sleep", - "Stamp", - "StampMicro", - "StampMilli", - "StampNano", - "Sunday", - "Thursday", - "Tick", - "Ticker", - "Time", - "TimeOnly", - "Timer", - "Tuesday", - "UTC", - "Unix", - "UnixDate", - "UnixMicro", - "UnixMilli", - "Until", - "Wednesday", - "Weekday", - }, - "unicode": { - "ASCII_Hex_Digit", - "Adlam", - "Ahom", - "Anatolian_Hieroglyphs", - "Arabic", - "Armenian", - "Avestan", - "AzeriCase", - "Balinese", - "Bamum", - "Bassa_Vah", - "Batak", - "Bengali", - "Bhaiksuki", - "Bidi_Control", - "Bopomofo", - "Brahmi", - "Braille", - "Buginese", - "Buhid", - "C", - "Canadian_Aboriginal", - "Carian", - "CaseRange", - "CaseRanges", - "Categories", - "Caucasian_Albanian", - "Cc", - "Cf", - "Chakma", - "Cham", - "Cherokee", - "Chorasmian", - "Co", - "Common", - "Coptic", - "Cs", - "Cuneiform", - "Cypriot", - "Cypro_Minoan", - "Cyrillic", - "Dash", - "Deprecated", - "Deseret", - "Devanagari", - "Diacritic", - "Digit", - "Dives_Akuru", - "Dogra", - "Duployan", - "Egyptian_Hieroglyphs", - "Elbasan", - "Elymaic", - "Ethiopic", - "Extender", - "FoldCategory", - "FoldScript", - "Georgian", - "Glagolitic", - "Gothic", - "Grantha", - "GraphicRanges", - "Greek", - "Gujarati", - "Gunjala_Gondi", - "Gurmukhi", - "Han", - "Hangul", - "Hanifi_Rohingya", - "Hanunoo", - "Hatran", - "Hebrew", - "Hex_Digit", - "Hiragana", - "Hyphen", - "IDS_Binary_Operator", - "IDS_Trinary_Operator", - "Ideographic", - "Imperial_Aramaic", - "In", - "Inherited", - "Inscriptional_Pahlavi", - "Inscriptional_Parthian", - "Is", - "IsControl", - "IsDigit", - "IsGraphic", - "IsLetter", - "IsLower", - "IsMark", - "IsNumber", - "IsOneOf", - "IsPrint", - "IsPunct", - "IsSpace", - "IsSymbol", - "IsTitle", - "IsUpper", - "Javanese", - "Join_Control", - "Kaithi", - "Kannada", - "Katakana", - "Kawi", - "Kayah_Li", - "Kharoshthi", - "Khitan_Small_Script", - "Khmer", - "Khojki", - "Khudawadi", - "L", - "Lao", - "Latin", - "Lepcha", - "Letter", - "Limbu", - "Linear_A", - "Linear_B", - "Lisu", - "Ll", - "Lm", - "Lo", - "Logical_Order_Exception", - "Lower", - "LowerCase", - "Lt", - "Lu", - "Lycian", - "Lydian", - "M", - "Mahajani", - "Makasar", - "Malayalam", - "Mandaic", - "Manichaean", - "Marchen", - "Mark", - "Masaram_Gondi", - "MaxASCII", - "MaxCase", - "MaxLatin1", - "MaxRune", - "Mc", - "Me", - "Medefaidrin", - "Meetei_Mayek", - "Mende_Kikakui", - "Meroitic_Cursive", - "Meroitic_Hieroglyphs", - "Miao", - "Mn", - "Modi", - "Mongolian", - "Mro", - "Multani", - "Myanmar", - "N", - "Nabataean", - "Nag_Mundari", - "Nandinagari", - "Nd", - "New_Tai_Lue", - "Newa", - "Nko", - "Nl", - "No", - "Noncharacter_Code_Point", - "Number", - "Nushu", - "Nyiakeng_Puachue_Hmong", - "Ogham", - "Ol_Chiki", - "Old_Hungarian", - "Old_Italic", - "Old_North_Arabian", - "Old_Permic", - "Old_Persian", - "Old_Sogdian", - "Old_South_Arabian", - "Old_Turkic", - "Old_Uyghur", - "Oriya", - "Osage", - "Osmanya", - "Other", - "Other_Alphabetic", - "Other_Default_Ignorable_Code_Point", - "Other_Grapheme_Extend", - "Other_ID_Continue", - "Other_ID_Start", - "Other_Lowercase", - "Other_Math", - "Other_Uppercase", - "P", - "Pahawh_Hmong", - "Palmyrene", - "Pattern_Syntax", - "Pattern_White_Space", - "Pau_Cin_Hau", - "Pc", - "Pd", - "Pe", - "Pf", - "Phags_Pa", - "Phoenician", - "Pi", - "Po", - "Prepended_Concatenation_Mark", - "PrintRanges", - "Properties", - "Ps", - "Psalter_Pahlavi", - "Punct", - "Quotation_Mark", - "Radical", - "Range16", - "Range32", - "RangeTable", - "Regional_Indicator", - "Rejang", - "ReplacementChar", - "Runic", - "S", - "STerm", - "Samaritan", - "Saurashtra", - "Sc", - "Scripts", - "Sentence_Terminal", - "Sharada", - "Shavian", - "Siddham", - "SignWriting", - "SimpleFold", - "Sinhala", - "Sk", - "Sm", - "So", - "Soft_Dotted", - "Sogdian", - "Sora_Sompeng", - "Soyombo", - "Space", - "SpecialCase", - "Sundanese", - "Syloti_Nagri", - "Symbol", - "Syriac", - "Tagalog", - "Tagbanwa", - "Tai_Le", - "Tai_Tham", - "Tai_Viet", - "Takri", - "Tamil", - "Tangsa", - "Tangut", - "Telugu", - "Terminal_Punctuation", - "Thaana", - "Thai", - "Tibetan", - "Tifinagh", - "Tirhuta", - "Title", - "TitleCase", - "To", - "ToLower", - "ToTitle", - "ToUpper", - "Toto", - "TurkishCase", - "Ugaritic", - "Unified_Ideograph", - "Upper", - "UpperCase", - "UpperLower", - "Vai", - "Variation_Selector", - "Version", - "Vithkuqi", - "Wancho", - "Warang_Citi", - "White_Space", - "Yezidi", - "Yi", - "Z", - "Zanabazar_Square", - "Zl", - "Zp", - "Zs", - }, - "unicode/utf16": { - "AppendRune", - "Decode", - "DecodeRune", - "Encode", - "EncodeRune", - "IsSurrogate", - }, - "unicode/utf8": { - "AppendRune", - "DecodeLastRune", - "DecodeLastRuneInString", - "DecodeRune", - "DecodeRuneInString", - "EncodeRune", - "FullRune", - "FullRuneInString", - "MaxRune", - "RuneCount", - "RuneCountInString", - "RuneError", - "RuneLen", - "RuneSelf", - "RuneStart", - "UTFMax", - "Valid", - "ValidRune", - "ValidString", - }, - "unsafe": { - "Add", - "Alignof", - "Offsetof", - "Pointer", - "Sizeof", - "Slice", - "SliceData", - "String", - "StringData", - }, -} diff --git a/vendor/modules.txt b/vendor/modules.txt index bea5402e7e..400e9acfb7 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,22 +1,6 @@ # dario.cat/mergo v1.0.0 ## explicit; go 1.13 dario.cat/mergo -# github.com/99designs/gqlgen v0.17.20 -## explicit; go 1.16 -github.com/99designs/gqlgen/api -github.com/99designs/gqlgen/codegen -github.com/99designs/gqlgen/codegen/config -github.com/99designs/gqlgen/codegen/templates -github.com/99designs/gqlgen/graphql -github.com/99designs/gqlgen/graphql/introspection -github.com/99designs/gqlgen/internal/code -github.com/99designs/gqlgen/internal/imports -github.com/99designs/gqlgen/internal/rewrite -github.com/99designs/gqlgen/plugin -github.com/99designs/gqlgen/plugin/federation -github.com/99designs/gqlgen/plugin/federation/fieldset -github.com/99designs/gqlgen/plugin/modelgen -github.com/99designs/gqlgen/plugin/resolvergen # github.com/DATA-DOG/go-sqlmock v1.5.0 ## explicit github.com/DATA-DOG/go-sqlmock @@ -79,7 +63,7 @@ github.com/actiontech/dms/pkg/dms-common/register ## explicit; go 1.19 github.com/actiontech/java-sql-extractor/java_antlr github.com/actiontech/java-sql-extractor/parser -# github.com/actiontech/mybatis-mapper-2-sql v0.4.0 +# github.com/actiontech/mybatis-mapper-2-sql v0.5.0 ## explicit; go 1.14 github.com/actiontech/mybatis-mapper-2-sql github.com/actiontech/mybatis-mapper-2-sql/ast @@ -87,9 +71,6 @@ github.com/actiontech/mybatis-mapper-2-sql/sqlfmt # github.com/agiledragon/gomonkey v2.0.2+incompatible ## explicit github.com/agiledragon/gomonkey -# github.com/agnivade/levenshtein v1.1.1 -## explicit; go 1.13 -github.com/agnivade/levenshtein # github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 ## explicit github.com/alecthomas/template @@ -664,15 +645,6 @@ github.com/valyala/bytebufferpool # github.com/valyala/fasttemplate v1.2.2 ## explicit; go 1.12 github.com/valyala/fasttemplate -# github.com/vektah/gqlparser/v2 v2.5.1 -## explicit; go 1.16 -github.com/vektah/gqlparser/v2 -github.com/vektah/gqlparser/v2/ast -github.com/vektah/gqlparser/v2/gqlerror -github.com/vektah/gqlparser/v2/lexer -github.com/vektah/gqlparser/v2/parser -github.com/vektah/gqlparser/v2/validator -github.com/vektah/gqlparser/v2/validator/rules # github.com/xanzy/ssh-agent v0.3.3 ## explicit; go 1.16 github.com/xanzy/ssh-agent @@ -730,8 +702,6 @@ golang.org/x/exp/constraints golang.org/x/exp/slices # golang.org/x/mod v0.12.0 ## explicit; go 1.17 -golang.org/x/mod/internal/lazyregexp -golang.org/x/mod/module golang.org/x/mod/semver # golang.org/x/net v0.15.0 ## explicit; go 1.17 @@ -795,17 +765,13 @@ golang.org/x/tools/go/internal/packagesdriver golang.org/x/tools/go/loader golang.org/x/tools/go/packages golang.org/x/tools/go/types/objectpath -golang.org/x/tools/imports golang.org/x/tools/internal/event golang.org/x/tools/internal/event/core golang.org/x/tools/internal/event/keys golang.org/x/tools/internal/event/label golang.org/x/tools/internal/event/tag -golang.org/x/tools/internal/fastwalk golang.org/x/tools/internal/gcimporter golang.org/x/tools/internal/gocommand -golang.org/x/tools/internal/gopathwalk -golang.org/x/tools/internal/imports golang.org/x/tools/internal/packagesinternal golang.org/x/tools/internal/pkgbits golang.org/x/tools/internal/tokeninternal From d8420f5a57ea98e45e55a0f9021e589de4b0292e Mon Sep 17 00:00:00 2001 From: luowei Date: Tue, 5 Dec 2023 17:09:50 +0800 Subject: [PATCH 07/10] fix unittest --- sqle/server/sqled_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqle/server/sqled_test.go b/sqle/server/sqled_test.go index a71047ad5c..f0ba502009 100644 --- a/sqle/server/sqled_test.go +++ b/sqle/server/sqled_test.go @@ -170,7 +170,7 @@ func Test_action_audit_UpdateTask(t *testing.T) { mock.ExpectBegin() mock.ExpectExec(regexp.QuoteMeta("INSERT INTO `execute_sql_detail`")). - WithArgs(model.MockTime, model.MockTime, nil, 0, 0, act.task.ExecuteSQLs[0].Content, "", "", 0, "", 0, 0, "", "", model.SQLAuditStatusFinished, `[{"level":"normal","message":"白名单","rule_name":""}]`, "2882fdbb7d5bcda7b49ea0803493467e", "normal"). + WithArgs(model.MockTime, model.MockTime, nil, 0, 0, act.task.ExecuteSQLs[0].Content, "", "", 0, "", 0, 0, "", "", "", model.SQLAuditStatusFinished, `[{"level":"normal","message":"白名单","rule_name":""}]`, "2882fdbb7d5bcda7b49ea0803493467e", "normal"). WillReturnResult(sqlmock.NewResult(1, 1)) mock.ExpectCommit() From 64686e957771ee40e38df8197b1ff5de3cf71413 Mon Sep 17 00:00:00 2001 From: luowei Date: Wed, 6 Dec 2023 13:29:13 +0800 Subject: [PATCH 08/10] reuse code --- sqle/api/controller/v1/sql_audit_record.go | 63 ++++++++++------------ sqle/api/controller/v1/task.go | 4 +- 2 files changed, 31 insertions(+), 36 deletions(-) diff --git a/sqle/api/controller/v1/sql_audit_record.go b/sqle/api/controller/v1/sql_audit_record.go index 97e1d9d32f..30756de4df 100644 --- a/sqle/api/controller/v1/sql_audit_record.go +++ b/sqle/api/controller/v1/sql_audit_record.go @@ -21,6 +21,7 @@ import ( "github.com/actiontech/sqle/sqle/api/controller" "github.com/actiontech/sqle/sqle/common" "github.com/actiontech/sqle/sqle/dms" + "github.com/actiontech/sqle/sqle/driver" driverV2 "github.com/actiontech/sqle/sqle/driver/v2" "github.com/actiontech/sqle/sqle/errors" "github.com/actiontech/sqle/sqle/log" @@ -175,6 +176,27 @@ type SQLsFromFile struct { SQLs string } +func addSQLsFromFileToTasks(sqls getSQLFromFileResp, task *model.Task, plugin driver.Plugin) error { + var num uint = 1 + for _, sqlsFromOneFile := range sqls.SQLs { + nodes, err := plugin.Parse(context.TODO(), sqlsFromOneFile.SQLs) + if err != nil { + return fmt.Errorf("parse sqls failed: %v", err) + } + for _, node := range nodes { + task.ExecuteSQLs = append(task.ExecuteSQLs, &model.ExecuteSQL{ + BaseSQL: model.BaseSQL{ + Number: num, + Content: node.Text, + SourceFile: sqlsFromOneFile.FilePath, + }, + }) + num++ + } + } + return nil +} + func buildOnlineTaskForAudit(c echo.Context, s *model.Storage, userId uint64, instanceName, instanceSchema, projectUid string, sqls getSQLFromFileResp) (*model.Task, error) { instance, exist, err := dms.GetInstanceInProjectByName(c.Request().Context(), projectUid, instanceName) if err != nil { @@ -197,7 +219,7 @@ func buildOnlineTaskForAudit(c echo.Context, s *model.Storage, userId uint64, in } defer plugin.Close(context.TODO()) - if err := plugin.Ping(context.TODO()); err != nil { + if err = plugin.Ping(context.TODO()); err != nil { return nil, err } @@ -212,23 +234,9 @@ func buildOnlineTaskForAudit(c echo.Context, s *model.Storage, userId uint64, in } createAt := time.Now() task.CreatedAt = createAt - - var num uint = 1 - for _, sqlsFromOneFile := range sqls.SQLs { - nodes, err := plugin.Parse(context.TODO(), sqlsFromOneFile.SQLs) - if err != nil { - return nil, err - } - for _, node := range nodes { - task.ExecuteSQLs = append(task.ExecuteSQLs, &model.ExecuteSQL{ - BaseSQL: model.BaseSQL{ - Number: num, - Content: node.Text, - SourceFile: sqlsFromOneFile.FilePath, - }, - }) - num++ - } + err = addSQLsFromFileToTasks(sqls, task, plugin) + if err != nil { + return nil, err } return task, nil @@ -249,22 +257,9 @@ func buildOfflineTaskForAudit(userId uint64, dbType string, sqls getSQLFromFileR } defer plugin.Close(context.TODO()) - var num uint = 1 - for _, sqlsFromOneFile := range sqls.SQLs { - nodes, err = plugin.Parse(context.TODO(), sqlsFromOneFile.SQLs) - if err != nil { - return nil, fmt.Errorf("parse sqls failed: %v", err) - } - for _, node := range nodes { - task.ExecuteSQLs = append(task.ExecuteSQLs, &model.ExecuteSQL{ - BaseSQL: model.BaseSQL{ - Number: num, - Content: node.Text, - SourceFile: sqlsFromOneFile.FilePath, - }, - }) - num++ - } + err = addSQLsFromFileToTasks(sqls, task, plugin) + if err != nil { + return nil, err } createAt := time.Now() diff --git a/sqle/api/controller/v1/task.go b/sqle/api/controller/v1/task.go index 6b70a0f714..25f9a0d914 100644 --- a/sqle/api/controller/v1/task.go +++ b/sqle/api/controller/v1/task.go @@ -828,12 +828,12 @@ func AuditTaskGroupV1(c echo.Context) error { for _, task := range tasks { task.SQLSource = sqls.SourceType - num := 1 + var num uint = 1 for filePath, nodes := range allNodes { for _, node := range nodes { task.ExecuteSQLs = append(task.ExecuteSQLs, &model.ExecuteSQL{ BaseSQL: model.BaseSQL{ - Number: uint(num), + Number: num, Content: node.Text, SourceFile: filePath, }, From 06f7e03fefae7f8d1d0d2387dd2348ed8905d413 Mon Sep 17 00:00:00 2001 From: luowei Date: Wed, 6 Dec 2023 13:42:12 +0800 Subject: [PATCH 09/10] fix lint --- sqle/api/controller/v1/sql_audit_record.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/sqle/api/controller/v1/sql_audit_record.go b/sqle/api/controller/v1/sql_audit_record.go index 30756de4df..3f0cf7be30 100644 --- a/sqle/api/controller/v1/sql_audit_record.go +++ b/sqle/api/controller/v1/sql_audit_record.go @@ -22,7 +22,6 @@ import ( "github.com/actiontech/sqle/sqle/common" "github.com/actiontech/sqle/sqle/dms" "github.com/actiontech/sqle/sqle/driver" - driverV2 "github.com/actiontech/sqle/sqle/driver/v2" "github.com/actiontech/sqle/sqle/errors" "github.com/actiontech/sqle/sqle/log" "github.com/actiontech/sqle/sqle/model" @@ -250,7 +249,6 @@ func buildOfflineTaskForAudit(userId uint64, dbType string, sqls getSQLFromFileR DBType: dbType, } var err error - var nodes []driverV2.Node plugin, err := common.NewDriverManagerWithoutCfg(log.NewEntry(), dbType) if err != nil { return nil, fmt.Errorf("open plugin failed: %v", err) From 28f6e7b8e12386383e363c22c2dd046f36c3e3bd Mon Sep 17 00:00:00 2001 From: luowei Date: Wed, 6 Dec 2023 14:07:31 +0800 Subject: [PATCH 10/10] reuse code --- sqle/api/controller/v1/sql_audit.go | 30 ++++++++++++++++++----------- sqle/api/controller/v2/sql_audit.go | 14 +------------- 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/sqle/api/controller/v1/sql_audit.go b/sqle/api/controller/v1/sql_audit.go index 714511d3f7..de6fceb0c1 100644 --- a/sqle/api/controller/v1/sql_audit.go +++ b/sqle/api/controller/v1/sql_audit.go @@ -195,20 +195,10 @@ func DirectAuditFiles(c echo.Context) error { sqls := "" if req.SQLType == SQLTypeMyBatis { - data := make([]parser.XmlFile, len(req.FileContents)) - for i, content := range req.FileContents { - data[i] = parser.XmlFile{Content: content} - } - sqlsInfo, err := parser.ParseXMLs(data, false) + sqls, err = ConvertXmlFileContentToSQLs(req.FileContents) if err != nil { return controller.JSONBaseErrorReq(c, err) } - buf := bytes.Buffer{} - for _, info := range sqlsInfo { - buf.WriteString(info.SQL) - buf.WriteString(";") - } - sqls = strings.TrimSuffix(buf.String(), ";") } else { // sql文件暂时只支持一次解析一个文件 sqls = req.FileContents[0] @@ -250,6 +240,24 @@ func DirectAuditFiles(c echo.Context) error { }) } +func ConvertXmlFileContentToSQLs(fileContent []string) (sqls string, err error) { + data := make([]parser.XmlFile, len(fileContent)) + for i, content := range fileContent { + data[i] = parser.XmlFile{Content: content} + } + sqlsInfo, err := parser.ParseXMLs(data, false) + if err != nil { + return "", err + } + buf := bytes.Buffer{} + for _, info := range sqlsInfo { + buf.WriteString(info.SQL) + buf.WriteString(";") + } + sqls = strings.TrimSuffix(buf.String(), ";") + return sqls, nil +} + type GetSQLAnalysisReq struct { ProjectName string `json:"project_name" query:"project_name" example:"default" valid:"required"` InstanceName string `json:"instance_name" query:"instance_name" example:"MySQL" valid:"required"` diff --git a/sqle/api/controller/v2/sql_audit.go b/sqle/api/controller/v2/sql_audit.go index b43cd23d8b..7b629d6ab9 100644 --- a/sqle/api/controller/v2/sql_audit.go +++ b/sqle/api/controller/v2/sql_audit.go @@ -1,10 +1,8 @@ package v2 import ( - "bytes" e "errors" "net/http" - "strings" parser "github.com/actiontech/mybatis-mapper-2-sql" "github.com/actiontech/sqle/sqle/api/controller" @@ -157,20 +155,10 @@ func DirectAuditFiles(c echo.Context) error { sqls := "" if req.SQLType == v1.SQLTypeMyBatis { - data := make([]parser.XmlFile, len(req.FileContents)) - for i, content := range req.FileContents { - data[i] = parser.XmlFile{Content: content} - } - sqlsInfo, err := parser.ParseXMLs(data, false) + sqls, err = v1.ConvertXmlFileContentToSQLs(req.FileContents) if err != nil { return controller.JSONBaseErrorReq(c, err) } - buf := bytes.Buffer{} - for _, info := range sqlsInfo { - buf.WriteString(info.SQL) - buf.WriteString(";") - } - sqls = strings.TrimSuffix(buf.String(), ";") } else { // sql文件暂时只支持一次解析一个文件 sqls = req.FileContents[0]