gotests: Index | Files

package goparser

import ""

Package goparse contains logic for parsing Go files. Specifically it parses source and test files into domain models for generating tests.


Package Files



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

ErrEmptyFile represents an empty file error.

type Parser Uses

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

Parser can parse Go files.

func (*Parser) Parse Uses

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 Uses

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.

Package goparser imports 9 packages (graph) and is imported by 2 packages. Updated 2019-05-24. Refresh now. Tools for package owners.