Skip to content

Commit

Permalink
go: skeleton implementation
Browse files Browse the repository at this point in the history
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 b741369
Show file tree
Hide file tree
Showing 14 changed files with 743 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/cmd/go/Makefile
@@ -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
57 changes: 57 additions & 0 deletions src/cmd/go/build.go
@@ -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")
}
31 changes: 31 additions & 0 deletions src/cmd/go/clean.go
@@ -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")
}
33 changes: 33 additions & 0 deletions src/cmd/go/doc.go
@@ -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
27 changes: 27 additions & 0 deletions src/cmd/go/fix.go
@@ -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")
}
27 changes: 27 additions & 0 deletions src/cmd/go/fmt.go
@@ -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")
}
39 changes: 39 additions & 0 deletions src/cmd/go/get.go
@@ -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")
}

0 comments on commit b741369

Please sign in to comment.