func CheckImplementInterfaceParameters(filename string, line int, column int, varFile string, varLine int, varColumn int) (bool, *errors.GoRefactorError) { switch { case filename == "" || !utils.IsGoFile(filename): return false, errors.ArgumentError("filename", "It's not a valid go file name") case varFile == "" || !utils.IsGoFile(varFile): return false, errors.ArgumentError("varFile", "It's not a valid go file name") case line < 1: return false, errors.ArgumentError("line", "Must be > 1") case varLine < 1: return false, errors.ArgumentError("varLine", "Must be > 1") case column < 1: return false, errors.ArgumentError("column", "Must be > 1") case varColumn < 1: return false, errors.ArgumentError("varColumn", "Must be > 1") } return true, nil }
func CheckSortParameters(filename string, order string) (bool, *errors.GoRefactorError) { switch { case filename == "" || !utils.IsGoFile(filename): return false, errors.ArgumentError("filename", "It's not a valid go file name") case !isCorrectOrder(order): return false, errors.ArgumentError("order", "invalid order string, type \"goref sort\" to see usage") } return true, nil }
func CheckRenameParameters(filename string, line int, column int, newName string) (bool, *errors.GoRefactorError) { switch { case filename == "" || !utils.IsGoFile(filename): return false, errors.ArgumentError("filename", "It's not a valid go file name") case line < 1: return false, errors.ArgumentError("line", "Must be > 1") case column < 1: return false, errors.ArgumentError("column", "Must be > 1") case !IsGoIdent(newName): return false, errors.ArgumentError("newName", "It's not a valid go identifier") } return true, nil }
func CheckInlineMethodParameters(filename string, lineStart int, colStart int, lineEnd int, colEnd int) (bool, *errors.GoRefactorError) { switch { case filename == "" || !utils.IsGoFile(filename): return false, errors.ArgumentError("filename", "It's not a valid go file name") case lineStart < 1: return false, errors.ArgumentError("lineStart", "Must be > 1") case lineEnd < 1 || lineEnd < lineStart: return false, errors.ArgumentError("lineEnd", "Must be > 1 and >= lineStart") case colStart < 1: return false, errors.ArgumentError("colStart", "Must be > 1") case colEnd < 1: return false, errors.ArgumentError("colEnd", "Must be > 1") } return true, nil }
func CheckExtractMethodParameters(filename string, lineStart int, colStart int, lineEnd int, colEnd int, methodName string, recieverVarLine int, recieverVarCol int) (bool, *errors.GoRefactorError) { switch { case filename == "" || !utils.IsGoFile(filename): return false, errors.ArgumentError("filename", "It's not a valid go file name") case lineStart < 1: return false, errors.ArgumentError("lineStart", "Must be > 1") case lineEnd < 1 || lineEnd < lineStart: return false, errors.ArgumentError("lineEnd", "Must be > 1 and >= lineStart") case colStart < 1: return false, errors.ArgumentError("colStart", "Must be > 1") case colEnd < 1: return false, errors.ArgumentError("colEnd", "Must be > 1") case !IsGoIdent(methodName): return false, errors.ArgumentError("methodName", "It's not a valid go identifier") } return true, nil }
func isPackageDir(fileInIt *os.FileInfo) bool { return !fileInIt.IsDirectory() && utils.IsGoFile(fileInIt.Name) }