Permalink
Browse files

go: skeleton implementation

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/5141051
  • Loading branch information...
rsc committed Sep 29, 2011
1 parent f17e3d2 commit b74136984dc04d3f0025f3eaf55c0ecdf3c38857
Showing with 743 additions and 0 deletions.
  1. +21 −0 src/cmd/go/Makefile
  2. +57 −0 src/cmd/go/build.go
  3. +31 −0 src/cmd/go/clean.go
  4. +33 −0 src/cmd/go/doc.go
  5. +27 −0 src/cmd/go/fix.go
  6. +27 −0 src/cmd/go/fmt.go
  7. +39 −0 src/cmd/go/get.go
  8. +178 −0 src/cmd/go/help.go
  9. +49 −0 src/cmd/go/list.go
  10. +174 −0 src/cmd/go/main.go
  11. +23 −0 src/cmd/go/script
  12. +32 −0 src/cmd/go/test.go
  13. +25 −0 src/cmd/go/version.go
  14. +27 −0 src/cmd/go/vet.go
@@ -0,0 +1,21 @@
# Copyright 2009 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.

include ../../Make.inc

TARG=go
GOFILES=\
build.go\
clean.go\
fix.go\
get.go\
fmt.go\
help.go\
list.go\
main.go\
test.go\
version.go\
vet.go\

include ../../Make.cmd
@@ -0,0 +1,57 @@
// 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.

package main

var cmdBuild = &Command{
Run: runBuild,
UsageLine: "build [-n] [-v] [importpath...]",
Short: "compile and install packages and dependencies",
Long: `
Build compiles the packages named by the import paths,
along with their dependencies, but it does not install the results.
The -n flag prints the commands but does not run them.
The -v flag prints the commands.
For more about import paths, see 'go help importpath'.
See also: go install, go get, go clean.
`,
}

var buildN = cmdBuild.Flag.Bool("n", false, "")
var buildV = cmdBuild.Flag.Bool("v", false, "")

func runBuild(cmd *Command, args []string) {
args = importPaths(args)
_ = args
panic("build not implemented")
}

var cmdInstall = &Command{
Run: runInstall,
UsageLine: "install [-n] [-v] [importpath...]",
Short: "install packages and dependencies",
Long: `
Install compiles and installs the packages named by the import paths,
along with their dependencies.
The -n flag prints the commands but does not run them.
The -v flag prints the commands.
For more about import paths, see 'go help importpath'.
See also: go build, go get, go clean.
`,
}

var installN = cmdInstall.Flag.Bool("n", false, "")
var installV = cmdInstall.Flag.Bool("v", false, "")

func runInstall(cmd *Command, args []string) {
args = importPaths(args)
_ = args
panic("install not implemented")
}
@@ -0,0 +1,31 @@
// 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.

package main

var cmdClean = &Command{
Run: runClean,
UsageLine: "clean [-nuke] [importpath...]",
Short: "remove intermediate objects",
Long: `
Clean removes intermediate object files generated during
the compilation of the packages named by the import paths,
but by default it does not remove the installed package binaries.
The -nuke flag causes clean to remove the installed package binaries too.
TODO: Clean does not clean dependencies of the packages.
TODO: Rename -nuke.
For more about import paths, see 'go help importpath'.
`,
}

var cleanNuke = cmdClean.Flag.Bool("nuke", false, "")

func runClean(cmd *Command, args []string) {
args = importPaths(args)
_ = args
panic("nuke not implemented")
}
@@ -0,0 +1,33 @@
// 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.

/*
Go is a tool for managing Go source code.
Usage: go command [arguments]
The commands are:
build compile and install packages and dependencies
clean remove intermediate objects
fix run gofix on packages
fmt run gofmt -w on packages
get download and install packages and dependencies
install install packages and dependencies
list list packages
test test packages
version print Go version
vet run govet on packages
Use "go help [command]" for more information about a command.
Additional help topics:
gopath GOPATH environment variable
importpath description of import paths
remote remote import path syntax
Use "go help [topic]" for more information about that topic.
*/
package documentation
@@ -0,0 +1,27 @@
// 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.

package main

var cmdFix = &Command{
Run: runFix,
UsageLine: "fix [importpath...]",
Short: "run gofix on packages",
Long: `
Fix runs the gofix command on the packages named by the import paths.
For more about gofix, see 'godoc gofix'.
For more about import paths, see 'go help importpath'.
To run gofix with specific options, run gofix itself.
See also: go fmt, go vet.
`,
}

func runFix(cmd *Command, args []string) {
args = importPaths(args)
_ = args
panic("fix not implemented")
}
@@ -0,0 +1,27 @@
// 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.

package main

var cmdFmt = &Command{
Run: runFmt,
UsageLine: "fmt [importpath...]",
Short: "run gofmt -w on packages",
Long: `
Fmt runs the command 'gofmt -w' on the packages named by the import paths.
For more about gofmt, see 'godoc gofmt'.
For more about import paths, see 'go help importpath'.
To run gofmt with specific options, run gofmt itself.
See also: go fix, go vet.
`,
}

func runFmt(cmd *Command, args []string) {
args = importPaths(args)
_ = args
panic("fmt not implemented")
}
@@ -0,0 +1,39 @@
// 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.

package main

var cmdGet = &Command{
Run: runGet,
UsageLine: "get [importpath...]",
Short: "download and install packages and dependencies",
Long: `
Get downloads and installs the packages named by the import paths,
along with their dependencies.
After downloading the code, 'go get' looks for a tag beginning
with "go." that corresponds to the local Go version.
For Go "release.r58" it looks for a tag named "go.r58".
For "weekly.2011-06-03" it looks for "go.weekly.2011-06-03".
If the specific "go.X" tag is not found, it uses the latest earlier
version it can find. Otherwise, it uses the default version for
the version control system: HEAD for git, tip for Mercurial,
and so on.
TODO: Explain versions better.
For more about import paths, see 'go help importpath'.
For more about how 'go get' finds source code to
download, see 'go help remote'.
See also: go build, go install, go clean.
`,
}

func runGet(cmd *Command, args []string) {
args = importPaths(args)
_ = args
panic("get not implemented")
}
Oops, something went wrong.

0 comments on commit b741369

Please sign in to comment.