コード例 #1
0
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
}
コード例 #2
0
ファイル: sort.go プロジェクト: vpavkin/GoRefactor
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
}
コード例 #3
0
ファイル: rename.go プロジェクト: vpavkin/GoRefactor
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
}
コード例 #4
0
ファイル: inlineMethod.go プロジェクト: vpavkin/GoRefactor
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
}
コード例 #5
0
ファイル: extractMethod.go プロジェクト: vpavkin/GoRefactor
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
}
コード例 #6
0
ファイル: program.go プロジェクト: vpavkin/GoRefactor
func isPackageDir(fileInIt *os.FileInfo) bool {
	return !fileInIt.IsDirectory() && utils.IsGoFile(fileInIt.Name)
}