Skip to content

tmr232/go-overview-graph

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

go-overview-graph

A tool for displaying graph overviews of Go functions.

This is very early work-in-progress!!!

Example

// File: demo/demo.go
func Demo(flag bool, n int) {
	if flag {
		fmt.Println("Hello, World!")
	}
	fmt.Println("Oh no!")

	for _, x := range "Hello, World!" {
		fmt.Println(x)
	}

	if flag {
		fmt.Println("A")
	} else if n == 3 {
		fmt.Println("B")
	} else if n == 2 {
		fmt.Println("C")
	} else {
		fmt.Println("D")
	}

	switch n {
	case 1:
		return
	case 2:
		return
	case 3:
		return
	}
	fmt.Println("Yo")
}

Run the tool:

go run . --pkg ./demo --function Demo | dot -Tpng -o"media/demo.png"

And we get:

Graph showing the control flow of the Demo function

About

Generate IDA Pro-style graph overviews for Go functions

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages