github.com/bgentry/go@v0.0.0-20150121062915-6cf5a733d54d/src/cmd/go/script.txt (about)

     1  ---  go help
     2  usage: go command [arguments]
     3  
     4  go manages Go source code.
     5  
     6  The commands are:
     7  
     8      build       compile and install packages and dependencies
     9      clean       remove intermediate objects
    10      fix         run gofix on packages
    11      fmt         run gofmt -w on packages
    12      get         download and install packages and dependencies
    13      install     install packages and dependencies
    14      list        list packages
    15      test        test packages
    16      version     print Go version
    17      vet         run govet on packages
    18  
    19  Use "go help [command]" for more information about a command.
    20  
    21  Additional help topics:
    22  
    23      gopath      GOPATH environment variable
    24      importpath  description of import paths
    25      remote      remote import path syntax
    26  
    27  Use "go help [topic]" for more information about that topic.
    28  
    29  ---
    30  
    31  ---  go help build
    32  usage: go build [-n] [-v] [importpath...]
    33  
    34  Build compiles the packages named by the import paths,
    35  along with their dependencies, but it does not install the results.
    36  
    37  The -n flag prints the commands but does not run them.
    38  The -v flag prints the commands.
    39  
    40  For more about import paths, see 'go help importpath'.
    41  
    42  See also: go install, go get, go clean.
    43  ---
    44  
    45  ---  go help clean
    46  usage: go clean [-nuke] [importpath...]
    47  
    48  Clean removes intermediate object files generated during
    49  the compilation of the packages named by the import paths,
    50  but by default it does not remove the installed package binaries.
    51  
    52  The -nuke flag causes clean to remove the installed package binaries too.
    53  
    54  TODO: Clean does not clean dependencies of the packages.
    55  
    56  For more about import paths, see 'go help importpath'.
    57  ---
    58  
    59  ---  go help install
    60  usage: go install [-n] [-v] [importpath...]
    61  
    62  Install compiles and installs the packages named by the import paths,
    63  along with their dependencies.
    64  
    65  The -n flag prints the commands but does not run them.
    66  The -v flag prints the commands.
    67  
    68  For more about import paths, see 'go help importpath'.
    69  
    70  See also: go build, go get, go clean.
    71  ---
    72  
    73  ---  go help fix
    74  usage: go fix [importpath...]
    75  
    76  Fix runs the gofix command on the packages named by the import paths.
    77  
    78  For more about gofix, see 'godoc gofix'.
    79  For more about import paths, see 'go help importpath'.
    80  
    81  To run gofix with specific options, run gofix itself.
    82  
    83  See also: go fmt, go vet.
    84  ---
    85  
    86  ---  go help fmt
    87  usage: go fmt [importpath...]
    88  
    89  Fmt runs the command 'gofmt -w' on the packages named by the import paths.
    90  
    91  For more about gofmt, see 'godoc gofmt'.
    92  For more about import paths, see 'go help importpath'.
    93  
    94  To run gofmt with specific options, run gofmt itself.
    95  
    96  See also: go fix, go vet.
    97  ---
    98  
    99  ---  go help get
   100  usage: go get [importpath...]
   101  
   102  Get downloads and installs the packages named by the import paths,
   103  along with their dependencies.
   104  
   105  After downloading the code, 'go get' looks for a tag beginning
   106  with "go." that corresponds to the local Go version.
   107  For Go "release.r58" it looks for a tag named "go.r58".
   108  For "weekly.2011-06-03" it looks for "go.weekly.2011-06-03".
   109  If the specific "go.X" tag is not found, it uses the latest earlier
   110  version it can find.  Otherwise, it uses the default version for
   111  the version control system: HEAD for git, tip for Mercurial,
   112  and so on.
   113  
   114  TODO: Explain versions better.
   115  
   116  For more about import paths, see 'go help importpath'.
   117  
   118  For more about how 'go get' finds source code to
   119  download, see 'go help remote'.
   120  
   121  See also: go build, go install, go clean.
   122  ---
   123  
   124  ---  go help list
   125  usage: go list [-f format] [-json] [importpath...]
   126  
   127  List lists the packages named by the import paths.
   128  
   129  The default output shows the package name and file system location:
   130  
   131      books /home/you/src/google-api-go-client.googlecode.com/hg/books/v1
   132      oauth /home/you/src/goauth2.googlecode.com/hg/oauth
   133      sqlite /home/you/src/gosqlite.googlecode.com/hg/sqlite
   134  
   135  The -f flag specifies an alternate format for the list,
   136  using the syntax of package template.  The default output
   137  is equivalent to -f '{{.Name}} {{.Dir}}'  The struct
   138  being passed to the template is:
   139  
   140      type Package struct {
   141          Name string         // package name
   142          Doc string          // package documentation string
   143          GoFiles []string    // names of Go source files in package
   144          ImportPath string   // import path denoting package
   145          Imports []string    // import paths used by this package
   146          Deps []string       // all (recursively) imported dependencies
   147          Dir string          // directory containing package sources
   148          Version string      // version of installed package
   149      }
   150  
   151  The -json flag causes the package data to be printed in JSON format.
   152  
   153  For more about import paths, see 'go help importpath'.
   154  ---
   155  
   156  ---  go help test
   157  usage: go test [importpath...]
   158  
   159  Test runs gotest to test the packages named by the import paths.
   160  It prints a summary of the test results in the format:
   161  
   162  	test archive/tar
   163  	FAIL archive/zip
   164  	test compress/gzip
   165  	...
   166  
   167  followed by gotest output for each failed package.
   168  
   169  For more about import paths, see 'go help importpath'.
   170  
   171  See also: go build, go compile, go vet.
   172  ---
   173  
   174  ---  go help version
   175  usage: go version
   176  
   177  Version prints the Go version, as reported by runtime.Version.
   178  ---
   179  
   180  ---  go help vet
   181  usage: go vet [importpath...]
   182  
   183  Vet runs the govet command on the packages named by the import paths.
   184  
   185  For more about govet, see 'godoc govet'.
   186  For more about import paths, see 'go help importpath'.
   187  
   188  To run govet with specific options, run govet itself.
   189  
   190  See also: go fmt, go fix.
   191  ---
   192  
   193  ---  go help gopath
   194  The GOPATH environment variable lists places to look for Go code.
   195  On Unix, the value is a colon-separated string.
   196  On Windows, the value is a semicolon-separated string.
   197  On Plan 9, the value is a list.
   198  
   199  GOPATH must be set to build and install packages outside the
   200  standard Go tree.
   201  
   202  Each directory listed in GOPATH must have a prescribed structure:
   203  
   204  The src/ directory holds source code.  The path below 'src'
   205  determines the import path or executable name.
   206  
   207  The pkg/ directory holds installed package objects.
   208  As in the Go tree, each target operating system and
   209  architecture pair has its own subdirectory of pkg
   210  (pkg/GOOS_GOARCH).
   211  
   212  If DIR is a directory listed in the GOPATH, a package with
   213  source in DIR/src/foo/bar can be imported as "foo/bar" and
   214  has its compiled form installed to "DIR/pkg/GOOS_GOARCH/foo/bar.a".
   215  
   216  The bin/ directory holds compiled commands.
   217  Each command is named for its source directory, but only
   218  the final element, not the entire path.  That is, the
   219  command with source in DIR/src/foo/quux is installed into
   220  DIR/bin/quux, not DIR/bin/foo/quux.  The foo/ is stripped
   221  so that you can add DIR/bin to your PATH to get at the
   222  installed commands.
   223  
   224  Here's an example directory layout:
   225  
   226      GOPATH=/home/user/gocode
   227  
   228      /home/user/gocode/
   229          src/
   230              foo/
   231                  bar/               (go code in package bar)
   232                      x.go
   233                  quux/              (go code in package main)
   234                      y.go
   235          bin/
   236              quux                   (installed command)
   237  		pkg/
   238  		    linux_amd64/
   239  		        foo/
   240  		            bar.a          (installed package object)
   241  
   242  Go searches each directory listed in GOPATH to find source code,
   243  but new packages are always downloaded into the first directory 
   244  in the list.
   245  ---
   246  
   247  ---  go help importpath
   248  Many commands apply to a set of packages named by import paths:
   249  
   250  	go action [importpath...]
   251  
   252  An import path that is a rooted path or that begins with
   253  a . or .. element is interpreted as a file system path and
   254  denotes the package in that directory.
   255  
   256  Otherwise, the import path P denotes the package found in
   257  the directory DIR/src/P for some DIR listed in the GOPATH
   258  environment variable (see 'go help gopath'). 
   259  
   260  If no import paths are given, the action applies to the
   261  package in the current directory.
   262  
   263  The special import path "all" expands to all package directories
   264  found in all the GOPATH trees.  For example, 'go list all' 
   265  lists all the packages on the local system.
   266  
   267  An import path can also name a package to be downloaded from
   268  a remote repository.  Run 'go help remote' for details.
   269  
   270  Every package in a program must have a unique import path.
   271  By convention, this is arranged by starting each path with a
   272  unique prefix that belongs to you.  For example, paths used
   273  internally at Google all begin with 'google', and paths
   274  denoting remote repositories begin with the path to the code,
   275  such as 'project.googlecode.com/'.
   276  ---
   277  
   278  ---  go help remote
   279  An import path (see 'go help importpath') denotes a package
   280  stored in the local file system.  Certain import paths also
   281  describe how to obtain the source code for the package using
   282  a revision control system.
   283  
   284  A few common code hosting sites have special syntax:
   285  
   286  	BitBucket (Mercurial)
   287  
   288  		import "bitbucket.org/user/project"
   289  		import "bitbucket.org/user/project/sub/directory"
   290  
   291  	GitHub (Git)
   292  
   293  		import "github.com/user/project"
   294  		import "github.com/user/project/sub/directory"
   295  
   296  	Google Code Project Hosting (Git, Mercurial, Subversion)
   297  
   298  		import "project.googlecode.com/git"
   299  		import "project.googlecode.com/git/sub/directory"
   300  
   301  		import "project.googlecode.com/hg"
   302  		import "project.googlecode.com/hg/sub/directory"
   303  
   304  		import "project.googlecode.com/svn/trunk"
   305  		import "project.googlecode.com/svn/trunk/sub/directory"
   306  
   307  	Launchpad (Bazaar)
   308  
   309  		import "launchpad.net/project"
   310  		import "launchpad.net/project/series"
   311  		import "launchpad.net/project/series/sub/directory"
   312  
   313  		import "launchpad.net/~user/project/branch"
   314  		import "launchpad.net/~user/project/branch/sub/directory"
   315  
   316  For code hosted on other servers, an import path of the form
   317  
   318  	repository.vcs/path
   319  
   320  specifies the given repository, with or without the .vcs suffix,
   321  using the named version control system, and then the path inside
   322  that repository.  The supported version control systems are:
   323  
   324  	Bazaar      .bzr
   325  	Git         .git
   326  	Mercurial   .hg
   327  	Subversion  .svn
   328  
   329  For example,
   330  
   331  	import "example.org/user/foo.hg"
   332  
   333  denotes the root directory of the Mercurial repository at
   334  example.org/user/foo or foo.hg, and
   335  
   336  	import "example.org/repo.git/foo/bar"
   337  
   338  denotes the foo/bar directory of the Git repository at
   339  example.com/repo or repo.git.
   340  
   341  When a version control system supports multiple protocols,
   342  each is tried in turn when downloading.  For example, a Git
   343  download tries git://, then https://, then http://.
   344  
   345  New downloaded packages are written to the first directory
   346  listed in the GOPATH environment variable (see 'go help gopath').
   347  
   348  The go command attempts to download the version of the
   349  package appropriate for the Go release being used.
   350  Run 'go help install' for more.
   351  ---
   352