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

151 Commits

Author SHA1 Message Date
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
Stephen Ma
fd9a5d22c6 http: revised http Handler interface
R=rsc
CC=golang-dev
https://golang.org/cl/1993043
2010-09-29 14:30:12 +10:00
Robert Griesemer
c20e024df3 godoc: default filter file name should be ""
R=rsc
CC=golang-dev
https://golang.org/cl/2241043
2010-09-20 16:19:17 -07:00
Robert Griesemer
b410be31b6 godoc: show "Last update" info for directory listings.
Use -timestamps=false flag to disable.

(This used to be shown on the front-page below the
build information with the old godoc. However, the
time stamps are directory-specific and should be
shown with the directory.)

R=rsc
CC=golang-dev
https://golang.org/cl/2233044
2010-09-16 13:45:40 -07:00
Robert Griesemer
599f758d42 godoc: don't use quadratic algorithm to filter paths
R=rsc
CC=golang-dev
https://golang.org/cl/2212042
2010-09-16 10:40:07 -07:00
Robert Griesemer
108f5c913c godoc: only show directories containing true package files
(ignore directories containing *.go files that don't
actually start with a package clause)

R=r
CC=golang-dev
https://golang.org/cl/2223041
2010-09-15 15:07:52 -07:00
Robert Griesemer
7f0ddd682a godoc: better handling of deep directory trees
also: fix a logic error with filter use at startup

R=rsc
CC=golang-dev
https://golang.org/cl/2184044
2010-09-14 18:58:09 -07:00
Robert Griesemer
4398768b84 godoc: atomically update filter file
R=rsc
CC=golang-dev
https://golang.org/cl/2206041
2010-09-14 16:54:38 -07:00
Robert Griesemer
bce8f51b2b godoc: use correct delay time (bug fix)
R=rsc
CC=golang-dev
https://golang.org/cl/2201041
2010-09-14 13:59:45 -07:00
Robert Griesemer
b6f294def3 godoc documentation: fixed typo, more precise comment
R=iant
CC=golang-dev
https://golang.org/cl/2184042
2010-09-14 12:03:26 -07:00
Robert Griesemer
ec81b1259b godoc: better support for directory trees for user-defined
file systems provided via -path

R=rsc
CC=golang-dev
https://golang.org/cl/2182041
2010-09-14 11:16:36 -07:00
Robert Griesemer
889377c572 godoc: moved package directory support code into separate file
- in prep. for some restructuring to be able to better deal
  with very large file systems
- moved a utility function into index.go
- no functionality changes, only code reorg.

R=r, adg1
CC=golang-dev
https://golang.org/cl/2098044
2010-09-07 17:21:00 -07:00
Robert Griesemer
c606b964a0 go/typechecker: 2nd step towards augmenting AST with full type information.
- refine/define Scope, Object, and Type structures
  (note: scope.go has the addition of types, the rest is only re-organized
  for better readability)
- implemented top-level of type checker:
  resolve global type declarations (deal with double decls, cycles, etc.)
- temporary hooks for checking of const/var declarations, function/method bodies
- test harness for fine-grained testing (exact error locations)
  with initial set of tests

This is a subset of the code for easier review.

R=rsc
CC=golang-dev
https://golang.org/cl/1967049
2010-08-26 14:36:13 -07: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
Robert Griesemer
10ae88f4ab partial correction for CL 1983043: fix various godoc-related regexp calls
R=rsc
CC=golang-dev
https://golang.org/cl/1987041
2010-08-12 11:28:50 -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
Robert Griesemer
d754309489 godoc: report Status 404 if a pkg or file is not found
Fixes #1005.

R=rsc, r
CC=golang-dev
https://golang.org/cl/1935041
2010-08-10 09:52:02 -07:00
Robert Griesemer
0b133d8ac1 godoc: accept '.', '!', and '?' as end of first sentence of package documentation
R=rsc
CC=golang-dev
https://golang.org/cl/1875049
2010-07-26 17:34:40 -07:00
Robert Griesemer
4188504f38 godoc: display synopses for all packages that have some kind of documentation.
Fixes #953.

R=rsc
CC=golang-dev
https://golang.org/cl/1862046
2010-07-26 15:27:42 -07:00
Rob Pike
38f1231f3e strings and bytes.Split: make count of 0 mean 0, not infinite.
Use a count of -1 for infinity.  Ditto for Replace.

R=rsc
CC=golang-dev
https://golang.org/cl/1704044
2010-07-01 14:08:14 -07:00
Andrew Gerrand
4f340f5051 godoc: canonicalize codewalk paths
R=rsc
CC=golang-dev
https://golang.org/cl/1729046
2010-06-30 17:56:51 +10:00
Russ Cox
bb84f4b5d2 changes &x -> x[0:] for array to slice conversion
R=gri
CC=golang-dev
https://golang.org/cl/1326042
2010-05-27 14:51:47 -07:00
Christopher Wedgwood
23c064452c godoc: use int64 for timestamps
This fixes a crash seen when viewing a directory list.

Fixes #747.

R=gri
CC=golang-dev, rsc
https://golang.org/cl/1010042
2010-04-27 10:45:33 -07:00
Russ Cox
2a591bdf8a godoc: add codewalk support
R=adg, gri
CC=golang-dev, r
https://golang.org/cl/1008042
2010-04-26 22:35:12 -07:00
Andrei Vieru
fffac8072e "godoc -src pkg_name" excludes duplicates entries
$ godoc xml | grep Copy\(\)
func (c CharData) Copy() CharData
func (c Comment) Copy() Comment
func (d Directive) Copy() Directive
func (p ProcInst) Copy() ProcInst
func (e StartElement) Copy() StartElement
--------------------------------------------
$ godoc -src xml | grep Copy\(\)
func (c CharData) Copy() CharData
--------------------------------------------
$ godoc -src xml Copy
func (c CharData) Copy() CharData { return CharData(makeCopy(c)) }
--------------------------------------------
The command "godoc -src pkg_name" should output the interface of the named package, but it excludes all duplicate entries. Also the command "godoc -src pkg_name method_name" will output the source code only for one method even if there are more of them with the same name in the same package. This patch set fixes this issue.

R=gri
CC=golang-dev
https://golang.org/cl/883051
2010-04-15 09:50:37 -07:00
Christopher Wedgwood
094732f7eb godoc: change od.Dir -> os.FileInfo in comments
R=gri, r
CC=golang-dev, rsc
https://golang.org/cl/819042
2010-04-11 10:17:45 -07:00
Rob Pike
3ddeef8153 rename os.Dir to os.FileInfo
R=rsc
CC=golang-dev
https://golang.org/cl/902042
2010-04-09 11:36:40 -07:00
Robert Griesemer
e8e4987ba3 godoc: support for title and subtitle headers when serving .html docs
and use it to show version (date) of go spec

Fixes #68.

R=rsc
CC=golang-dev, r
https://golang.org/cl/848042
2010-03-30 17:37:42 -07:00
Robert Griesemer
6a71a4639e godoc: don't print package clause in -src command-line mode with filtering
R=rsc
CC=golang-dev
https://golang.org/cl/844041
2010-03-30 11:19:58 -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
Robert Griesemer
671919d19a godoc: support for filtering of command-line output in -src mode
+ various minor cleanups

Usage: godoc -src math Sin

R=rsc
CC=golang-dev
https://golang.org/cl/791041
2010-03-29 18:06:53 -07:00
Russ Cox
bd1690ce5e fix build
R=gri
CC=golang-dev
https://golang.org/cl/837041
2010-03-29 13:30:32 -07:00
Russ Cox
a709876767 runtime: more malloc statistics
expvar: default publishings for cmdline, memstats
godoc: import expvar

R=r
CC=golang-dev
https://golang.org/cl/815041
2010-03-29 13:06:26 -07:00
Russ Cox
bc83042b07 godoc: export pprof debug information
R=gri
CC=golang-dev
https://golang.org/cl/784041
2010-03-26 14:48:04 -07:00
Robert Griesemer
acfd6d5f05 godoc: show relative file names without leading '/' (per r's request)
- change the various url-xxx formatters to return a relative URL path
- make the leading '/' for URLs explicit in the template
- on the way change some |html formatters to |html-esc
  (html should only be used for formatting AST nodes)

R=rsc, r
CC=golang-dev
https://golang.org/cl/740041
2010-03-24 16:28:59 -07:00
Robert Griesemer
60482f06d0 godoc: use http GET for remote search instead of rpc
(this will allow the use of golang.org for remote
searches)

R=rsc
CC=golang-dev
https://golang.org/cl/734041
2010-03-24 14:51:55 -07:00
Robert Griesemer
6c8fdbe8c7 godoc: line numbers for all remote search results
Instead of returning the index lookup result via
RPC which has to be corrected for the client,
simply render it on the server and return the
final output.

R=rsc, r
CC=golang-dev
https://golang.org/cl/669041
2010-03-19 22:48:08 -07:00
Russ Cox
e8fb0b014c godoc: revert change 5089, per gri's instructions
R=gri
CC=golang-dev
https://golang.org/cl/630043
2010-03-19 17:46:18 -07:00
Robert Griesemer
b037bfa684 godoc: proper file path conversion for remote search
R=rsc
CC=golang-dev
https://golang.org/cl/664041
2010-03-19 17:07:16 -07:00
Robert Griesemer
fa462f37e3 godoc: show (some) line numbers for remote search
- show build version
- use build goroot when possible

R=rsc
CC=golang-dev
https://golang.org/cl/656043
2010-03-19 15:20:20 -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
Robert Griesemer
17e0351404 godoc: implemented command-line search
The command-line search is using a running webserver
as index server; i.e., the search result is reflecting
the index at the server. See the documentation for
details.

Usage: godoc -q query1 query2 ...

Known issue: Results don't show the all-important
line numbers yet due to the way the index is organized.
Next CL.

R=rsc, r
CC=golang-dev
https://golang.org/cl/648041
2010-03-19 12:46:43 -07:00
Robert Griesemer
53f3d0733c gofmt: more consistent formatting of const/var decls
- gofmt -w src misc
- only manually modified file: src/pkg/go/printer/nodes.go

R=rsc
CC=golang-dev, r
https://golang.org/cl/606041
2010-03-16 16:45:54 -07:00
Robert Griesemer
74fac99d05 godoc: initial support for showing popup information
for identifiers in Go source code

- at the moment just show identifier kind (var, func, etc.) and name
  (eventually should show declaration, type, etc.)
- JavaScript parts by adg

R=rsc
CC=adg, golang-dev
https://golang.org/cl/578042
2010-03-16 14:17:42 -07:00
Robert Griesemer
226c2ec256 godoc: support for multiple packages in a directory
- smartly select the "right" package
- provide a list of other packages

R=rsc
CC=golang-dev
https://golang.org/cl/466042
2010-03-12 18:16:21 -08:00
Robert Griesemer
3e24f2d6df godoc: fix formatting of -src output
- go/filter.go: make MergePackageFiles smarter
- go/printer.go: handle positions from multiple files

R=rsc
CC=golang-dev
https://golang.org/cl/460042
2010-03-11 16:44:56 -08:00
Robert Griesemer
799609e0b4 godoc: change -x to -src, update doc.go (missed in previous CL)
R=rsc
CC=golang-dev
https://golang.org/cl/384044
2010-03-10 15:41:36 -08:00
Robert Griesemer
35aec6c7f7 godoc: provide mode which shows exported interface in "source form"
- on the commandline: godoc -x big
- in a webpage: provide form parameter ?m=src

Known issues:
- Positioning of comments incorrect in several cases. Separate CL.
- Need a link/menu to switch between different modes of presentation
  in the web view.

R=rsc
CC=golang-dev
https://golang.org/cl/376041
2010-03-10 15:22:22 -08:00