2013-05-17 14:20:39 -06:00
|
|
|
// Copyright 2011 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
/*
|
|
|
|
The gotype command does syntactic and semantic analysis of Go files
|
2013-10-31 11:01:58 -06:00
|
|
|
and packages like the front-end of a Go compiler. Errors are reported
|
|
|
|
if the analysis fails; otherwise gotype is quiet (unless -v is set).
|
2013-05-17 14:20:39 -06:00
|
|
|
|
2013-10-31 11:01:58 -06:00
|
|
|
Without a list of paths, gotype reads from standard input, which
|
|
|
|
must provide a single Go source file defining a complete package.
|
2013-05-17 14:20:39 -06:00
|
|
|
|
2013-10-31 11:01:58 -06:00
|
|
|
If a single path is specified that is a directory, gotype checks
|
|
|
|
the Go files in that directory; they must all belong to the same
|
|
|
|
package.
|
2013-05-17 14:20:39 -06:00
|
|
|
|
2013-10-31 11:01:58 -06:00
|
|
|
Otherwise, each path must be the filename of Go file belonging to
|
|
|
|
the same package.
|
2013-05-17 14:20:39 -06:00
|
|
|
|
|
|
|
Usage:
|
2013-10-31 11:01:58 -06:00
|
|
|
gotype [flags] [path...]
|
2013-05-17 14:20:39 -06:00
|
|
|
|
|
|
|
The flags are:
|
2013-10-31 11:01:58 -06:00
|
|
|
-a
|
|
|
|
use all (incl. _test.go) files when processing a directory
|
2013-05-17 14:20:39 -06:00
|
|
|
-e
|
2013-10-31 11:01:58 -06:00
|
|
|
report all errors (not just the first 10)
|
2013-05-17 14:20:39 -06:00
|
|
|
-v
|
2013-10-31 11:01:58 -06:00
|
|
|
verbose mode
|
2015-08-24 15:45:44 -06:00
|
|
|
-gccgo
|
|
|
|
use gccimporter instead of gcimporter
|
2013-05-17 14:20:39 -06:00
|
|
|
|
|
|
|
Debugging flags:
|
2013-11-07 14:32:02 -07:00
|
|
|
-seq
|
|
|
|
parse sequentially, rather than in parallel
|
2013-05-17 14:20:39 -06:00
|
|
|
-ast
|
2013-11-07 14:32:02 -07:00
|
|
|
print AST (forces -seq)
|
2013-05-17 14:20:39 -06:00
|
|
|
-trace
|
2013-11-07 14:32:02 -07:00
|
|
|
print parse trace (forces -seq)
|
2013-10-31 11:01:58 -06:00
|
|
|
-comments
|
|
|
|
parse comments (ignored unless -ast or -trace is provided)
|
|
|
|
|
|
|
|
Examples:
|
2013-05-17 14:20:39 -06:00
|
|
|
|
2013-10-31 11:01:58 -06:00
|
|
|
To check the files a.go, b.go, and c.go:
|
2013-05-17 14:20:39 -06:00
|
|
|
|
2013-10-31 11:01:58 -06:00
|
|
|
gotype a.go b.go c.go
|
2013-05-17 14:20:39 -06:00
|
|
|
|
2013-10-31 11:01:58 -06:00
|
|
|
To check an entire package in the directory dir and print the processed files:
|
2013-05-17 14:20:39 -06:00
|
|
|
|
2013-10-31 11:01:58 -06:00
|
|
|
gotype -v dir
|
2013-05-17 14:20:39 -06:00
|
|
|
|
2013-10-31 11:01:58 -06:00
|
|
|
To check an entire package including tests in the local directory:
|
2013-05-17 14:20:39 -06:00
|
|
|
|
2013-10-31 11:01:58 -06:00
|
|
|
gotype -a .
|
2013-05-17 14:20:39 -06:00
|
|
|
|
|
|
|
To verify the output of a pipe:
|
|
|
|
|
|
|
|
echo "package foo" | gotype
|
|
|
|
|
|
|
|
*/
|
2014-12-08 21:00:58 -07:00
|
|
|
package main // import "golang.org/x/tools/cmd/gotype"
|