GOTYPE(1)

πŸ’– GOTYPE(1) πŸ’–

okay bestie, so this is a page from the General Commands Manual and it's all about a lil tool called gotype. sit down, hydrate, let's go 🫢


✨ NAME ✨

gotype β€” syntatic and semantic analysis of Go files

yes, that says "syntatic", not "syntactic" β€” that's the original spelling, we do not touch it, periodt πŸ’…

🌸 SYNOPSIS 🌸

gotype [flags] [ path ...  ]

πŸ¦‹ DESCRIPTION πŸ¦‹

so basically gotype does syntactic and semantic analysis of Go files and packages, like it's the front-end of a Go compiler. it's giving compiler-energy, no cap. πŸ”₯

if the analysis fails, it reports errors. if the analysis succeeds? it says absolutely nothing. silent. quiet. a mystery. unless you set -v, then it finally starts talking. πŸ™ˆ

here's how it picks what to look at:

  • no paths at all? it reads from standard input, and that stdin has to provide a single Go source file that defines a complete package. one file. whole package. that's the vibe check.
  • one single path and it's a directory? it checks the Go files in that directory, and they must all belong to the same package.
  • anything else? then every path has to be the filename of a Go file, and they all have to belong to the same package too.

πŸ‘‘ OPTIONS πŸ‘‘

  • -a β€” use all files (incl. _test.go) when processing a directory
  • -ast β€” print the AST (and yeah, this forces -seq)
  • -comments β€” parse comments (lowkey ignored unless -ast or -trace is provided)
  • -e β€” report all errors, not just the first 10
  • -seq β€” parse sequentially, rather than in parallel
  • -trace β€” print parse trace (also forces -seq)
  • -v β€” verbose mode πŸ’¬

πŸŽ€ EXAMPLES πŸŽ€

want to check the files a.go, b.go, and c.go? say less:

gotype a.go b.go c.go

want to check an entire package in the directory dir and print the processed files? main character behaviour:

gotype -v dir

want to check an entire package including tests in the local directory? we love a thorough queen:

gotype -a .

want to verify the output of a pipe? iconic:

echo "package foo" | gotype

πŸ’œ AUTHOR πŸ’œ

this manual page was written by Michael Stapelberg <stapelberg@debian.org>, for the Debian project (and may be used by others). slay 🫢


that's the whole page bestie, you ate it up πŸ’… this was gotype, dated 2013-12-02, from the General Commands Manual β€” bye bestie, go run it, ilysm πŸ¦‹βœ¨πŸ’–