Go-Callvis เป็นเครื่องมือพัฒนาเพื่อช่วยให้เห็นภาพกราฟการโทรของโปรแกรม GO โดยใช้มุมมองแบบโต้ตอบ
จุดประสงค์ของเครื่องมือนี้คือการให้ภาพรวมภาพของนักพัฒนาซอฟต์แวร์ของโปรแกรม GO โดยใช้ข้อมูลจากกราฟการโทรและความสัมพันธ์กับแพ็คเกจและประเภท สิ่งนี้มีประโยชน์อย่างยิ่งในโครงการขนาดใหญ่ที่ความซับซ้อนของรหัสสูงขึ้นมากหรือเมื่อคุณเพียงแค่พยายามเข้าใจรหัสของคนอื่น

ตรวจสอบซอร์สโค้ดสำหรับภาพด้านบน
มันรันการวิเคราะห์ตัวชี้เพื่อสร้างกราฟการโทรของโปรแกรมและใช้ข้อมูลเพื่อสร้างผลลัพธ์ในรูปแบบ DOT ซึ่งสามารถแสดงผลด้วยเครื่องมือ GraphViz
-graphviz Flag เท่านั้น)ในการติดตั้ง go-callvis, Run:
# Latest release
go install github.com/ofabry/go-callvis@latest
# Development version
go install github.com/ofabry/go-callvis@masterอีกทางเลือกหนึ่งโคลนที่เก็บและรวบรวมซอร์สโค้ด:
# Clone repository
git clone https://github.com/ofabry/go-callvis.git
cd go-callvis
# Compile and install
make installในการใช้มุมมองแบบโต้ตอบที่จัดทำโดยเว็บเซิร์ฟเวอร์ที่ให้บริการภาพ SVG ของแพ็คเกจที่เน้นคุณสามารถเรียกใช้ได้เพียง:
go-callvis <target package>
เซิร์ฟเวอร์ HTTP กำลังฟังบน http: // localhost: 7878/โดยค่าเริ่มต้นให้ใช้ตัวเลือก -http="ADDR:PORT" เพื่อเปลี่ยนที่อยู่เซิร์ฟเวอร์ HTTP
ในการสร้างตัวเลือกการใช้ไฟล์เอาต์พุตเดียว -file=<file path> เพื่อเลือกปลายทางไฟล์เอาต์พุต
รูปแบบเอาต์พุตเริ่มต้นเป็น svg , ใช้ตัวเลือก -format=<svg|png|jpg|...> เพื่อเลือกรูปแบบเอาต์พุตที่แตกต่างกัน
Usage of go-callvis:
-debug
Enable verbose log.
-file string
output filename - omit to use server mode
-cacheDir string
Enable caching to avoid unnecessary re-rendering.
-focus string
Focus specific package using name or import path. (default "main")
-format string
output file format [svg | png | jpg | ...] (default "svg")
-graphviz
Use Graphviz's dot program to render images.
-group string
Grouping functions by packages and/or types [pkg, type] (separated by comma) (default "pkg")
-http string
HTTP service address. (default ":7878")
-ignore string
Ignore package paths containing given prefixes (separated by comma)
-include string
Include package paths with given prefixes (separated by comma)
-limit string
Limit package paths to given prefixes (separated by comma)
-minlen uint
Minimum edge length (for wider output). (default 2)
-nodesep float
Minimum space between two adjacent nodes in the same rank (for taller output). (default 0.35)
-nointer
Omit calls to unexported functions.
-nostd
Omit calls to/from packages in standard library.
-rankdir
Direction of graph layout [LR | RL | TB | BT] (default "LR")
-skipbrowser
Skip opening browser.
-tags build tags
a list of build tags to consider satisfied during the build. For more information about build tags, see the description of build constraints in the documentation for the go/build package
-tests
Include test code.
-version
Show version and exit.
เรียกใช้ go-callvis -h เพื่อแสดงรายการตัวเลือกที่รองรับทั้งหมด
ที่นี่คุณสามารถค้นหาคำอธิบายสำหรับเอาต์พุตประเภทต่างๆ
| แสดง | สไตล์ |
|---|---|
focused | สี ฟ้า |
stdlib | สี เขียว |
other | สี เหลือง |
| แสดง | สไตล์ |
|---|---|
exported | เส้นขอบ หนา |
unexported | เส้นขอบ ปกติ |
anonymous | เส้น ขอบ |
| แสดง | สไตล์ |
|---|---|
internal | สี ดำ |
external | สี น้ำตาล |
static | เส้น ทึบ |
dynamic | เส้น ประ |
regular | ลูกศร เรียบง่าย |
concurrent | ลูกศรด้วย วงกลม |
deferred | ลูกศรด้วย เพชร |
นี่คือตัวอย่างสำหรับการซิงค์โครงการ

ตรวจสอบตัวอย่างเพิ่มเติมและตัวเลือกคำสั่งที่ใช้แล้ว
เข้าร่วม #go-callvis channel ที่ gophers.slack.com ( ยังไม่ได้รับคำ เชิญ)
คุณพบข้อบกพร่องหรือมีคำแนะนำบ้างไหม?
คุณต้องการมีส่วนร่วมในโครงการหรือไม่?
เป้าหมายในอุดมคติของโครงการนี้คือการสร้างเว็บแอปที่จะเก็บข้อมูลกราฟการโทรในพื้นที่จากนั้นให้การเข้าถึงกราฟการโทรอย่างรวดเร็วสำหรับแพ็คเกจใด ๆ ของแผนผังการพึ่งพาของคุณ ในตอนแรกมันจะแสดงแผนที่แบบโต้ตอบของการพึ่งพาโดยรวมระหว่างแพ็คเกจและจากนั้นโดยการเลือกแพ็คเกจเฉพาะมันจะแสดงกราฟการโทรและให้ตัวเลือกต่าง ๆ เพื่อเปลี่ยนเอาต์พุตแบบไดนามิก