Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(12018)

Issue 43490043: go.tools: godoc/vfs -> buildfs

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 4 months ago by crawshaw1
Modified:
10 years, 3 months ago
Reviewers:
gri, adonovan
Visibility:
Public.

Description

go.tools: godoc/vfs -> buildfs Turn godoc's vfs into a general build system fs for go.tools. Major API changes: - Add a Context method buildfs.FileSystem that returns a *build.Context. This lets programs carry around a single buildfs.FileSystem containing all file context. - gcimporter no longer automatically hooks itself up to the types package, instead it must be initialized. This is because all tools must add their own FileSystem to gcimporter, if those tools are to be easily extended with a custom file system. Suggested reading order: 1. buildfs/vfs.go - new method on FileSystem 2. go/gcimporter/gcimporter.go - manual initialization 3. go/types/api.go - no major changes 4. cmd/vet/main.go - a simple worked example 5. everything else is just deck chair rearrangement This CL can be divided into smaller components, but if it is it becomes hard to see the purpose of the API changes.

Patch Set 1 #

Patch Set 2 : diff -r 139f5d7a1e02 https://code.google.com/p/go.tools #

Patch Set 3 : diff -r 139f5d7a1e02 https://code.google.com/p/go.tools #

Total comments: 9

Patch Set 4 : diff -r 139f5d7a1e02 https://code.google.com/p/go.tools #

Total comments: 6

Patch Set 5 : diff -r 32340194fa90 https://code.google.com/p/go.tools #

Total comments: 18
Unified diffs Side-by-side diffs Delta from patch set Stats (+250 lines, -132 lines) Patch
A buildfs/build.go View 1 2 3 4 1 chunk +57 lines, -0 lines 3 comments Download
M buildfs/gatefs/gatefs.go View 1 2 3 4 3 chunks +8 lines, -5 lines 3 comments Download
M buildfs/httpfs/httpfs.go View 1 2 3 4 3 chunks +12 lines, -7 lines 1 comment Download
buildfs/mapfs/mapfs.go View 1 3 chunks +6 lines, -3 lines 1 comment Download
M buildfs/mapfs/mapfs_test.go View 1 0 chunks +-1 lines, --1 lines 0 comments Download
M buildfs/namespace.go View 1 2 chunks +11 lines, -1 line 1 comment Download
M buildfs/os.go View 1 2 chunks +4 lines, -1 line 1 comment Download
M buildfs/vfs.go View 1 2 3 4 2 chunks +10 lines, -3 lines 3 comments Download
M buildfs/zipfs/zipfs.go View 1 5 chunks +6 lines, -3 lines 1 comment Download
M cmd/godoc/blog.go View 1 1 chunk +1 line, -1 line 0 comments Download
M cmd/godoc/codewalk.go View 1 3 chunks +3 lines, -3 lines 0 comments Download
M cmd/godoc/handlers.go View 1 2 chunks +3 lines, -3 lines 0 comments Download
cmd/godoc/main.go View 1 3 chunks +9 lines, -9 lines 0 comments Download
M cmd/gotype/gotype.go View 1 2 chunks +5 lines, -1 line 1 comment Download
M cmd/vet/main.go View 1 6 chunks +10 lines, -7 lines 0 comments Download
M go/gcimporter/gcimporter.go View 1 2 3 4 7 chunks +25 lines, -21 lines 0 comments Download
go/gcimporter/gcimporter_test.go View 1 2 3 4 5 chunks +12 lines, -4 lines 0 comments Download
go/importer/import_test.go View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
go/types/api.go View 1 2 3 4 1 chunk +4 lines, -2 lines 0 comments Download
M go/types/api_test.go View 1 2 3 1 chunk +0 lines, -1 line 0 comments Download
go/types/builtins_test.go View 1 2 3 1 chunk +0 lines, -1 line 0 comments Download
M go/types/check_test.go View 1 2 3 1 chunk +0 lines, -1 line 0 comments Download
go/types/eval_test.go View 1 2 3 1 chunk +0 lines, -1 line 0 comments Download
M go/types/issues_test.go View 1 2 3 1 chunk +0 lines, -1 line 0 comments Download
M go/types/resolver.go View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
go/types/resolver_test.go View 1 2 3 1 chunk +3 lines, -1 line 0 comments Download
M go/types/self_test.go View 1 2 3 1 chunk +0 lines, -1 line 0 comments Download
M go/types/stdlib_test.go View 1 2 3 1 chunk +0 lines, -1 line 0 comments Download
M go/types/typestring_test.go View 1 2 3 1 chunk +0 lines, -1 line 0 comments Download
godoc/cmdline.go View 1 3 chunks +6 lines, -6 lines 0 comments Download
godoc/cmdline_test.go View 1 3 chunks +5 lines, -5 lines 0 comments Download
M godoc/corpus.go View 1 3 chunks +3 lines, -3 lines 0 comments Download
godoc/index.go View 1 2 chunks +2 lines, -2 lines 0 comments Download
M godoc/index_test.go View 1 1 chunk +1 line, -1 line 0 comments Download
M godoc/meta.go View 1 2 chunks +2 lines, -2 lines 0 comments Download
M godoc/parser.go View 1 1 chunk +2 lines, -2 lines 0 comments Download
godoc/pres.go View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
godoc/server.go View 1 4 chunks +4 lines, -4 lines 0 comments Download
M godoc/template.go View 1 2 chunks +2 lines, -2 lines 0 comments Download
M godoc/util/util.go View 1 2 chunks +2 lines, -2 lines 0 comments Download
importer/importer.go View 1 2 8 chunks +17 lines, -9 lines 2 comments Download
M importer/importer_test.go View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
M oracle/oracle.go View 1 2 3 4 4 chunks +4 lines, -3 lines 1 comment Download
M oracle/oracle_test.go View 1 2 3 4 2 chunks +2 lines, -1 line 0 comments Download
pointer/example_test.go View 1 2 3 4 2 chunks +2 lines, -2 lines 0 comments Download
pointer/pointer_test.go View 1 2 3 4 3 chunks +2 lines, -2 lines 0 comments Download

Messages

Total messages: 4
adonovan
LGTM This all seems pretty straightforward. I'm sure gri will have some suggestions about the ...
10 years, 4 months ago (2013-12-17 22:26:38 UTC) #1
crawshaw1
This still needs the path translation functions we have discussed (and some more documentation), but ...
10 years, 3 months ago (2014-01-08 22:20:32 UTC) #2
adonovan
> This still needs the path translation functions we have discussed (and some more documentation) ...
10 years, 3 months ago (2014-01-09 17:04:33 UTC) #3
gri
10 years, 3 months ago (2014-01-09 19:32:45 UTC) #4
https://codereview.appspot.com/43490043/diff/40001/buildfs/build.go
File buildfs/build.go (right):

https://codereview.appspot.com/43490043/diff/40001/buildfs/build.go#newcode26
buildfs/build.go:26: fs  FileSystem
embed FileSystem and then you don't need (some of) the manual forwarders below ?

https://codereview.appspot.com/43490043/diff/40001/buildfs/httpfs/httpfs.go
File buildfs/httpfs/httpfs.go (right):

https://codereview.appspot.com/43490043/diff/40001/buildfs/httpfs/httpfs.go#n...
buildfs/httpfs/httpfs.go:5: // Package httpfs implements http.FileSystem using a
godoc buildfs.FileSystem.
remove reference to godoc?

https://codereview.appspot.com/43490043/diff/40001/buildfs/vfs.go
File buildfs/vfs.go (right):

https://codereview.appspot.com/43490043/diff/40001/buildfs/vfs.go#newcode16
buildfs/vfs.go:16: // The FileSystem interface specifies the methods godoc is
using
this is not godoc-specific, eventually, I assume?

https://codereview.appspot.com/43490043/diff/40001/cmd/gotype/gotype.go
File cmd/gotype/gotype.go (right):

https://codereview.appspot.com/43490043/diff/40001/cmd/gotype/gotype.go#newco...
cmd/gotype/gotype.go:241: types.DefaultImport = gcimporter.Importer(fs, "")
The global DefaultImport is a really bad hack to avoid cycles in common cases.
Since there's an explicit Config provided (line 191), instead you should set the
Config.Import field.

https://codereview.appspot.com/43490043/diff/40001/cmd/vet/main.go
File cmd/vet/main.go (right):

https://codereview.appspot.com/43490043/diff/40001/cmd/vet/main.go#newcode103
cmd/vet/main.go:103: types.DefaultImport = gcimporter.Importer(fs, "")
Should probably also use a Config when calling types.Check.

https://codereview.appspot.com/43490043/diff/40001/go/gcimporter/gcimporter.go
File go/gcimporter/gcimporter.go (left):

https://codereview.appspot.com/43490043/diff/40001/go/gcimporter/gcimporter.g...
go/gcimporter/gcimporter.go:31: types.DefaultImport = Import
This might break some code...

https://codereview.appspot.com/43490043/diff/40001/go/gcimporter/gcimporter.go
File go/gcimporter/gcimporter.go (right):

https://codereview.appspot.com/43490043/diff/40001/go/gcimporter/gcimporter.g...
go/gcimporter/gcimporter.go:111: // If no FileSystem is specified,
buildfs.Default is used.
s/FileSystem/file system/ since there's no such parameter name (it's "fs"). And
later you refer to srcDir and not source directory.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b