Skip to content

Utility to extract JSON representation of declarations from a Go source file

License

Notifications You must be signed in to change notification settings

vitreuz/go-outline

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

Go Outline

Simple utility for extracting a JSON representation of the declarations in a Go source file.

Installing

go get -u github.com/lukehoban/go-outline

Using

> go-outline -f file.go
[{"label":"proc","type":"package",<...>}]

To parse and return only imports

> go-outline -f file.go -imports-only

Schema

type Declaration struct {
	Label        string        `json:"label"`
	Type         string        `json:"type"`
	ReceiverType string        `json:"receiverType,omitempty"`
	Start        token.Pos     `json:"start"`
	End          token.Pos     `json:"end"`
	Children     []Declaration `json:"children,omitempty"`
}

About

Utility to extract JSON representation of declarations from a Go source file

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%