1
0
mirror of https://github.com/golang/go synced 2024-10-04 05:21:22 -06:00
Commit Graph

46 Commits

Author SHA1 Message Date
Alex Brainman
9107b530d8 goinstall: use bash to execute gomake
R=golang-dev, r, adg
CC=golang-dev
https://golang.org/cl/4551074
2011-05-30 16:15:08 +10:00
Andrew Gerrand
ca8a055f5c goinstall: support GOPATH; building and installing outside the Go tree
For example, with GOPATH set like so
        GOPATH=/home/adg/gocode
And after creating some subdirectories
        mkdir /home/adg/gocode/{bin,pkg,src}

I can use goinstall to install the github.com/nf/goto web server,
which depends on the github.com/nf/stat package, with
        goinstall github.com/nf/goto

This downloads and installs all dependencies (that aren't already
installed) like so
        /home/adg/gocode/bin/goto
        /home/adg/gocode/pkg/darwin_amd64/github.com/nf/stat.a
        /home/adg/gocode/src/github.com/nf/goto/...
        /home/adg/gocode/src/github.com/nf/stat/...

R=rsc, niemeyer
CC=golang-dev
https://golang.org/cl/4438043
2011-04-27 11:00:34 +10:00
Andrew Gerrand
aaa6ce2301 goinstall: support building executable commands
This CL gives goinstall the ability to build commands,
not just packages.

"goinstall foo.googlecode.com/hg/bar" will build the command named
"bar" and install it to GOBIN. "goinstall ." will use the name of the
local directory as the command name.

R=rsc, niemeyer
CC=golang-dev
https://golang.org/cl/4426045
2011-04-20 12:02:29 +10:00
Russ Cox
de3aac609c gofix: don't rewrite O_APPEND opens
R=r, rog
CC=golang-dev
https://golang.org/cl/4364041
2011-04-05 11:12:02 -04:00
Rob Pike
8a90fd3c72 os: New Open API.
We replace the current Open with:
OpenFile(name, flag, perm) // same as old Open
Open(name) // same as old Open(name, O_RDONLY, 0)
Create(name) // same as old Open(name, O_RDWR|O_TRUNC|O_CREAT, 0666)

This CL includes a gofix module and full code updates: all.bash passes.
(There may be a few comments I missed.)

The interesting packages are:
        gofix
        os
Everything else is automatically generated except for hand tweaks to:
        src/pkg/io/ioutil/ioutil.go
        src/pkg/io/ioutil/tempfile.go
        src/pkg/crypto/tls/generate_cert.go
        src/cmd/goyacc/goyacc.go
        src/cmd/goyacc/units.y

R=golang-dev, bradfitzwork, rsc, r2
CC=golang-dev
https://golang.org/cl/4357052
2011-04-04 23:42:14 -07:00
Rob Pike
d406f8f650 testing: set up structure for faster testing using the new -test.short flag.
New make target "testshort" runs "gotest -test.short" and is invoked
by run.bash, which is invoked by all.bash.

Use -test.short to make one package (crypto ecdsa) run much faster.
More changes to come.

Once this is in, I will update the long-running tests to use the new flag.

R=rsc
CC=golang-dev
https://golang.org/cl/4317043
2011-03-25 14:50:44 -07:00
Andrew Gerrand
f91e677e12 goinstall: add -clean flag to docs
Fixes #1629.

R=rsc
CC=golang-dev
https://golang.org/cl/4291057
2011-03-21 14:18:12 +11:00
Gustavo Niemeyer
e08f0c18c9 goinstall: handle .c files with gc when cgo isn't used
As a data point, this enables goinstall to handle the standard
syscall package almost unchanged (there's one file with the _bsd
extension, and a .c file which isn't supposed to be compiled in).

R=rsc
CC=golang-dev
https://golang.org/cl/4259057
2011-03-07 12:53:39 -05:00
Gustavo Niemeyer
ff40deee62 goinstall: handle .s files with gc
As a data point, with this change goinstall is able to
fully build package big out of the box.

R=rsc
CC=golang-dev
https://golang.org/cl/4264049
2011-03-07 12:08:52 -05:00
Russ Cox
5946e46138 goinstall: fix build
func init runs *after* var declarations

TBR=niemeyer
CC=golang-dev
https://golang.org/cl/4260055
2011-03-07 11:33:26 -05:00
Gustavo Niemeyer
70f08b47a0 goinstall: handle $(GOOS) and $(GOARCH) in filenames
This enables goinstall to handle .go and .c files (for cgo)
which are named after the following patterns:

    name_$(GOOS).*
    name_$(GOARCH).*
    name_$(GOOS)_$(GOARCH).*

Files with those names are only included if the $(GOOS) and
$(GOARCH) match the current system.

R=rsc
CC=golang-dev
https://golang.org/cl/4172055
2011-03-07 10:54:53 -05:00
Gustavo Niemeyer
04ca4f8242 path/filepath: new OS-specific path support
The path package now contains only functions which
deal with slashed paths, sensible for any OS when dealing
with network paths or URLs.  OS-specific functionality
has been moved into the new path/filepath package.

This also includes fixes for godoc, goinstall and other
packages which were mixing slashed and OS-specific paths.

R=rsc, gri, mattn, brainman
CC=golang-dev
https://golang.org/cl/4252044
2011-03-06 17:33:23 -05:00
Roger Peppe
c1fdb6f156 goinstall: protect against malicious filenames.
It was possible to make package run arbitrary
commands when installing if its filenames contained
make metacharacters.

R=rsc, niemeyer
CC=golang-dev
https://golang.org/cl/4248041
2011-03-02 15:04:08 -05:00
Rob Pike
fb9e37cd9b template: reverse order of arguments to Execute
In line with other functions such as Fprintf, put the
thing to be written first.

Apologies for the breakages this is sure to cause.

R=rsc, gri, adg, eds, r2, aam
CC=golang-dev
https://golang.org/cl/4169042
2011-02-09 14:23:01 -08:00
Gustavo Niemeyer
59a47732dd exec: use custom error for LookPath
Make the error message and the needed action more obvious
when a command isn't found to obtain the source code
of a project.  Users seem to strugle with the existing
wording in practice.

R=rsc
CC=golang-dev
https://golang.org/cl/4058047
2011-02-01 12:12:51 -05:00
Gustavo Niemeyer
6f6b7e3a33 goinstall: Fix template to use exported fields
It's currently broken due to f6d5bac536c5.

R=r, r2
CC=golang-dev
https://golang.org/cl/3967041
2011-01-12 10:45:24 -08:00
Gustavo Niemeyer
03b46849f2 goinstall: preliminary support for cgo packages
Can handle cgo packages now but only if they
do not need to set CGO_LDFLAGS and CGO_CFLAGS.

R=adg, rsc
CC=golang-dev
https://golang.org/cl/3891042
2011-01-11 13:14:48 -05:00
Kyle Lemons
ddc2710d69 goinstall: add -clean flag
R=adg, rsc
CC=golang-dev
https://golang.org/cl/3821042
2011-01-05 14:34:59 -05:00
Gustavo Niemeyer
5530bf90cd goinstall: fix -u for bzr
Changeset 7012:65601d7cac9e broke goinstall -u for bzr
branches.  This will fix it.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/3852041
2011-01-04 14:22:18 +11:00
Caine Tighe
784788ba44 goinstall/download.go: Add checkout concept and helper functions to clean and fix implementation (Issue 1265)
R=rsc, niemeyer, adg
CC=golang-dev
https://golang.org/cl/3536041
2010-12-24 11:48:45 +11:00
Robert Griesemer
5a9ad8b9e3 go/ast: use token.Pos instead of token.Position; adjust all dependent code
Specifically:

	* lib/godoc:
	- provide file set (FSet) argument to formatters where needed

	* src/cmd:
	- cgo, ebnflint, godoc, gofmt, goinstall: provide file set (fset) where needed
	- godoc: remove local binary search with sort.Search (change by rsc),
	  extract file set for formatters

	* src/pkg:
	- exp/eval: remove embedded token.Position fields from nodes and replace
	  with named token.Pos fields; add corresponding Pos() accessor methods
	- go/token: added file.Line(), changed signature of File.Position()

	* test/fixedbugs/:
	- bug206.go: change test to not rely on token.Pos details

	* added various extra comments
	* Runs all.bash
	* gofmt formats all of src, misc w/o changes
	* godoc runs

	* performance:
	- The new version of godoc consumes about the same space after indexing
	  has completed, but indexing is half the speed. Significant space savings
	  are expected from smaller ASTs, but since they are thrown away after a
	  file has been indexed, this is not visible anymore. The slower indexing
	  time is due to the much more expensive computation of line information.
	  However, with the new compressed position information, indexing can be
	  rewritten and simplified. Furthermore, computing the line info can be
	  done more efficiently.

        New godoc, immediately after indexing completed (best of three runs):

	  PID COMMAND      %CPU   TIME   #TH #PRTS #MREGS RPRVT  RSHRD  RSIZE  VSIZE
	44381 godoc        0.0%  0:38.00   4    19    149  145M   184K   148M   176M

	2010/12/03 17:58:35 index updated (39.231s, 18505 unique words, 386387 spots)
	2010/12/03 17:58:35 bytes=90858456 footprint=199182584
	2010/12/03 17:58:36 bytes=47858568 footprint=167295224

	Old godoc, immediately after indexing completed (best of three runs):

	  PID COMMAND      %CPU   TIME   #TH #PRTS #MREGS RPRVT  RSHRD  RSIZE  VSIZE
	23167 godoc        0.0%  0:22.02   4    17    132  129M   184K   132M   173M

	2010/12/03 14:51:32 index updated (24.892s, 18765 unique words, 393830 spots)
	2010/12/03 14:51:32 bytes=66404528 footprint=163907832
	2010/12/03 14:51:32 bytes=46282224 footprint=163907832

	The different numbers for unique words/spots stem from the fact the the
	two workspaces are not exactly identical. The new godoc maintains a large
	file set data structure during indexing which (probably) is the reason
	for the larger heap (90858456 vs 66404528) before garbage collection.

R=rsc, r
CC=golang-dev
https://golang.org/cl/3050041
2010-12-06 14:23:18 -08:00
Brad Fitzpatrick
b0afb931a8 Use strings.Contains in src/cmd/...
R=r
CC=golang-dev, r2, rsc
https://golang.org/cl/2819041
2010-11-01 15:21:35 -07:00
Andrew Gerrand
ec8f8149d2 goinstall: display helpful message when encountering a cgo package.
R=rsc
CC=golang-dev
https://golang.org/cl/2701042
2010-10-26 10:59:30 +11:00
Fazlul Shahriar
ee065332dd goinstall: don't wrongly error out with "multiple package names"
Fixes #1215.

R=adg, rsc
CC=golang-dev
https://golang.org/cl/2695042
2010-10-25 13:13:00 +11:00
Fazlul Shahriar
3ee49850a0 goinstall: fix documentation typo
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/2585043
2010-10-21 10:47:02 +11:00
Rob Pike
12da5a90e0 log: new interface
New logging interface simplifies and generalizes.

1) Loggers now have only one output.
2) log.Stdout, Stderr, Crash and friends are gone.
	Logging is now always to standard error by default.
3) log.Panic* replaces log.Crash*.
4) Exiting and panicking are not part of the logger's state; instead
	the functions Exit* and Panic* simply call Exit or panic after
	printing.
5) There is now one 'standard logger'.  Instead of calling Stderr,
	use Print etc.  There are now triples, by analogy with fmt:
		Print, Println, Printf
	What was log.Stderr is now best represented by log.Println,
	since there are now separate Print and Println functions
	(and methods).
6) New functions SetOutput, SetFlags, and SetPrefix allow global
	editing of the standard logger's properties.   This is new
	functionality. For instance, one can call
		log.SetFlags(log.Lshortfile|log.Ltime|log.Lmicroseconds)
	to get all logging output to show file name, line number, and
	time stamp.

In short, for most purposes
	log.Stderr -> log.Println or log.Print
	log.Stderrf -> log.Printf
	log.Crash -> log.Panicln or log.Panic
	log.Crashf -> log.Panicf
	log.Exit -> log.Exitln or log.Exit
	log.Exitf -> log.Exitf (no change)

This has a slight breakage: since loggers now write only to one
output, existing calls to log.New() need to delete the second argument.
Also, custom loggers with exit or panic properties will need to be
reworked.

All package code updated to new interface.

The test has been reworked somewhat.

The old interface will be removed after the new release.
For now, its elements are marked 'deprecated' in their comments.

Fixes #1184.

R=rsc
CC=golang-dev
https://golang.org/cl/2419042
2010-10-12 12:59:18 -07:00
Scott Lawrence
25c8d4e932 goinstall: warn when http:// is found at beginning of package name
Fixes #860.

R=golang-dev, adg1, rsc, adg
CC=golang-dev
https://golang.org/cl/2124046
2010-09-13 12:59:59 +10:00
Russ Cox
a41db4318d goinstall: assume go binaries are in path
(Following new convention.)

Fixes #1063.

R=adg
CC=golang-dev
https://golang.org/cl/2115042
2010-09-03 15:37:45 -04:00
Scott Lawrence
ebe837d6eb goinstall: added -a flag to mean "all remote packages"
Fixes #897.

goinstall -a can be used to reinstall all packages after an upgrade
goinstall -a -u can be used to update all package
A history of remote package installs is stored in $GOROOT/goinstall.log

R=rsc, adg
CC=golang-dev
https://golang.org/cl/1947041
2010-09-02 13:48:28 -04:00
Russ Cox
dbc6d75315 goinstall: use https for Google Code checkouts
This way, if you later want to check things in,
you can (with appropriate authorization).
Using plain http leads to the cryptic error
abort: HTTP Method Not Allowed.

R=r
CC=golang-dev
https://golang.org/cl/1983050
2010-08-25 18:08:16 -04:00
Russ Cox
aafe474ec9 build: $GOBIN defaults to $GOROOT/bin
R=r
CC=golang-dev
https://golang.org/cl/1982049
2010-08-24 20:00:33 -04:00
Russ Cox
da392d9136 build: no required environment variables
R=adg, r, PeterGo
CC=golang-dev
https://golang.org/cl/1942044
2010-08-18 10:08:49 -04:00
Robert Griesemer
1f9dfa294f go AST: First step towards augmenting AST with full type information.
- change ast.Ident back to contain the name and adjust all dependent code
- identifier object information will be added again through an optional
  typechecker phase (in the works).
- remove tracking of scopes in parser - it's easier to do this in a separate
  phase (in the works)
- in godoc, generate popup info table directly instead of through a formatter
  for simpler data flow (at the expense of a little bit more code)

Runs all tests.

As a result of this change, the currently shown popup information
(const, var, type, func, followed by identifier name) will not be
shown anymore temporarily.

R=rsc
CC=golang-dev
https://golang.org/cl/1994041
2010-08-13 10:42:18 -07:00
Rob Pike
d31ee536e8 update the tree to use the new regexp methods
R=rsc
CC=golang-dev
https://golang.org/cl/1983043
2010-08-12 16:48:41 +10:00
Scott Lawrence
d5cfb3b3d5 goinstall docs: fixed typos
(Added mising closing quotes.)

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/1902049
2010-08-09 10:45:20 -07:00
Alex Brainman
12576f9e70 goinstall: check for error from exec.*Cmd.Wait() before using its result
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/1923043
2010-08-04 17:18:57 -07:00
Gustavo Niemeyer
ae33032893 goinstall: support for Bazaar+Launchpad
With these changes, goinstall is now able to use branches
maintained with Bazaar located in Launchpad.

Project aliases such as /project and /project/series are
supported in addition to specific user or team branches
such as /~user/project/branch.  Temporary branches under
the +junk special project are also supported.

As a curious side effect, since Launchpad is able to import
code from other locations, they can be indirectly
accessible too if desired.

R=rsc
CC=golang-dev
https://golang.org/cl/1699050
2010-06-30 23:33:49 -07:00
Roger Peppe
3ce29380d5 goinstall: process dependencies for package main
Currently to install a command, you have to manually
goinstall each of the remote packages that it depends on.
This patch lets goinstall P work where P is
contains files in package main.
It does not actually build the package, but
it installs all of its dependencies and prints a message
to that effect.

R=rsc
CC=golang-dev
https://golang.org/cl/1301043
2010-06-21 11:01:20 -07:00
Michael Hoisie
0c77ba96da goinstall: Use 'git pull' instead of 'git checkout' when updating a git repo.
R=rsc
CC=golang-dev
https://golang.org/cl/1395041
2010-06-01 14:27:45 -07:00
Russ Cox
c7122a3c58 simplify various code using new map index rule
R=r
CC=golang-dev
https://golang.org/cl/833044
2010-03-30 10:51:11 -07:00
Russ Cox
00f9f0c056 single argument panic
note that sortmain.go has been run through hg gofmt;
only the formatting of the day initializers changed.
i'm happy to revert that formatting if you'd prefer.

stop on error in doc/progs/run

R=r
CC=golang-dev
https://golang.org/cl/850041
2010-03-30 10:34:57 -07:00
Andrey Mirtchovski
456642adb5 cmd/goinstall: include command name in error reporting (usually missing software or incorrect $PATH)
R=rsc
CC=golang-dev
https://golang.org/cl/695041
2010-03-23 18:13:16 -07:00
Russ Cox
2e5fe5a14c goinstall: let git/hg/svn create the final directory element
R=r
CC=golang-dev
https://golang.org/cl/634044
2010-03-20 22:38:06 -07:00
Robert Griesemer
90f7209548 godoc: improved comment formatting: recognize URLs
and highlight special words, if provided. Also:

- related cleanups in src/pkg/go/doc/comment.go
- fix typos in src/cmd/goinstall/doc.go

Fixes #672.

R=rsc
CC=adg, golang-dev
https://golang.org/cl/601042
2010-03-19 13:01:45 -07:00
Andrew Gerrand
67148530d2 goinstall doc: fix link to godashboard/package
R=rsc
CC=golang-dev
https://golang.org/cl/607041
2010-03-17 11:40:05 +11:00
Russ Cox
3e4e4ec704 goinstall: an experiment in (external) package installation
R=adg, r
CC=cw, golang-dev
https://golang.org/cl/224043
2010-03-04 17:04:50 -08:00