1
0
mirror of https://github.com/golang/go synced 2024-10-01 01:28:32 -06:00
Commit Graph

462 Commits

Author SHA1 Message Date
Heschi Kreinick
654e6e76cd gopathwalk: don't log for nonexistant root dirs
If users don't have a module cache yet, or put a nonexistant directory
in their GOPATH, it doesn't make sense to print an error. Just ignore it
and move on.

No tests; I don't think it makes sense to set up log scraping for this.

Change-Id: I90719297ade37999e8b401767a0a37c940828c27
Reviewed-on: https://go-review.googlesource.com/c/142977
Run-TryBot: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2018-10-17 18:30:23 +00:00
Heschi Kreinick
63d31665e3 go/packages: add name= query
Add an implementation of name= for go list. It will be used to
implement goimports and godoc-like lookups by package name.

Imported a copy of the semver package from the stdlib to do version
comparison, and tweaked the gopathwalk API to include a hint about what
kind of source directory is being traversed.

Note that the tests, despite my best efforts, are not hermetic: go list
insists on doing version lookups in situations where it seems to me like
it shouldn't need to.

I think this implementation is ready for serious use. The one thing I'm
nervous about is that it currently does a substring match when looking
for a package name, so if you look up a package named "a" you will get
a huge number of results. This matches goimports' behavior but I don't
know if it's suitable for general use.

Change-Id: I2b7f823b74571fe30d3bd9c7dfafb4e6a40df5d3
Reviewed-on: https://go-review.googlesource.com/c/138878
Run-TryBot: Heschi Kreinick <heschi@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2018-10-16 20:20:09 +00:00
Yuval Pavel Zholkover
5e66757b83 internal/fastwalk: don't cross Dirent.Reclen boundry while looking for NULL in parseDirEnt
Crossing Dirent.Reclen boundry was manifested in golang/go#28131 as garbaled filenames,
when Dirent.Name was not NULL terminated on FreeBSD due to a bug (parseDirEnt would find a NULL
in the following Dirent's Fileno/Reclen fields).

Only search for NULL on linux, when the Namlen field is available use it directly instead.

Updates golang/go#28131

Change-Id: I64090576c8bad2bd246d1561432bf73d5caee2a9
Reviewed-on: https://go-review.googlesource.com/c/141801
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-13 18:20:35 +00:00
Heschi Kreinick
19e2aca3fd internal/gopathwalk: create
Extract goimports' logic for walking Go source directories into a
separate package, suitable for use in go/packages. No functional
changes. Added a convenience feature to fastwalk, allowing the user to
say that they're done with a directory and stop receiving callbacks for
it.

Testing is a little light; I expect goimports' tests to cover most
everything we care about.

Change-Id: If047ada4414f5f282637d11fd07e8342fadc9c33
Reviewed-on: https://go-review.googlesource.com/c/138877
Run-TryBot: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-12 18:13:39 +00:00
Brad Fitzpatrick
cd09f19c2f godoc: move third-party godoc deps behind build tag
Fixes golang/go#27970

Change-Id: I6de10c260f31721bf83073ef5b140442c3ef7eb0
Reviewed-on: https://go-review.googlesource.com/c/139197
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Chris Broadfoot <cbro@golang.org>
2018-10-02 22:38:33 +00:00
Chris Broadfoot
ee6b03148c godoc: migrate to App Engine flexible
See bug for more details on exactly what was migrated.

Notably:
* No more Google-internal deployment scripts; see README.godoc-app and
  the Makefile for details.
* Build tag "golangorg" is used for the godoc configuration used for
  golang.org.
* Use of App Engine libraries replaced with GCP client libraries.
* Redis is used to replace App Engine memcache.
* Google analytics is controlled by an environment variable.
* Regression tests have been migrated from Google-internal.
* hg -> git hash map is moved from Google-internal.

Updates golang/go#27205.

Change-Id: Ia0a983f239c50eda8be2363494c8b784f60c2c6d
Reviewed-on: https://go-review.googlesource.com/133355
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-02 04:34:10 +00:00
Rebecca Stambler
8deeabbe2e internal/lsp: support range formatting
Refactor code a bit to support range formatting as well document
formatting. Also, separate view from server to clean up.

Change-Id: Ica397c7a0fb92a7708ea247c2d5de83e5528d8d4
Reviewed-on: https://go-review.googlesource.com/138275
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-10-01 16:29:50 +00:00
Rebecca Stambler
d457fc8054 cmd/golsp: support formatting in golsp
This commit adds support for some basic commands necessary for
integration with VSCode. It also adds support for the
"textDocument/format" method.

Change-Id: I8fd0e33ca544ab65d3233efe2fef9716446ad4ff
Reviewed-on: https://go-review.googlesource.com/138135
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-09-27 17:02:42 +00:00
Ian Cottrell
ef04bbebd8 cmd/golsp: An empty shell of an lsp server for the go language
Change-Id: I51ef556048c2d10537ad90fa5284939e09bc31fd
Reviewed-on: https://go-review.googlesource.com/137097
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-09-27 15:24:00 +00:00
Ian Cottrell
ff3f684ce0 internal/lsp: the core lsp protocol
This is not intended to be a user friendly package, just the rawest correct
implemenation of the protocol as a building block

Change-Id: Ib672b7f1e2fd8284be422dc7964f1876e94c9578
Reviewed-on: https://go-review.googlesource.com/136676
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2018-09-25 15:17:08 +00:00
Ian Cottrell
e93be7f42f internal/jsonrpc2: a basic json rpc library to build an lsp on top of
Change-Id: I6aa47fffcb29842e3194231e4ad4b6be4386d329
Reviewed-on: https://go-review.googlesource.com/136675
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2018-09-24 17:56:01 +00:00
Ian Cottrell
94b14834a2 imports: extract fastWalk into new package internal/fastwalk
It is going to be used by a new tool.
Moved to an internal package so it does not become a publicly supported
api.
Modified the tests so they don't depend on the fix_test infrastructure.

Change-Id: Ib8ebef24dc23e180960af04aa3d06b5f41a7c02b
Reviewed-on: https://go-review.googlesource.com/99678
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-04-16 19:53:52 +00:00