tree

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2018 License: MIT Imports: 6 Imported by: 0

README

tree CircleCI Go Report Card MIT Licensed

Simple go project to tree structure. It supports only go files.

???

alt text

package main

import (
	"fmt"

	"github.com/andream16/tree"
)

func main() {

	out, err := tree.Get("examples/example", &tree.Node{})
	if err != nil {
		panic(err)
	}

	fmt.Println(out.Name)              // example
	fmt.Println(out.Leafs[0])          // somefile.go
	fmt.Println(out.Nodes[0].Name)     // example/subexample
	fmt.Println(out.Nodes[0].Leafs[0]) // someotherfile.go

}

Todo get AST per each file.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Getter

type Getter interface {
	Get(string, *Node) (*Node, error)
}

Getter allows third party mocking

type Leaf

type Leaf string

Leaf represents a go file.

type Node

type Node struct {
	Name  string
	Nodes []*Node
	Leafs []Leaf
}

Node represents a package (directory) that can contain other sub-packages.

func Get

func Get(path string, node *Node) (*Node, error)

Get returns all go files in the repository by directory name

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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