goparser

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 2, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

This file may have been modified by Bytedance Ltd. and/or its affiliates (“Bytedance's Modifications”). All Bytedance's Modifications are Copyright (2022) Bytedance Ltd. and/or its affiliates.

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyFile = errors.New("file is empty")

ErrEmptyFile represents an empty file error.

Functions

This section is empty.

Types

type Parser

type Parser struct {
	// The importer to resolve packages from import paths.
	Importer types.Importer
}

Parser can parse Go files.

func (*Parser) Parse

func (p *Parser) Parse(srcPath string, files []models.Path) (*Result, error)

Parse parses a given Go file at srcPath, along any files that share the same package, into a domain model for generating tests.

type Result

type Result struct {
	// The package name and imports of a Go file.
	Header *models.Header
	// All the functions and methods in a Go file.
	Funcs []*models.Function
}

Result representats a parsed Go file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL