Граф коммитов

517 Коммитов

Автор SHA1 Сообщение Дата
Francesc Campoy df5e519e8a talksapp: use https for the compile url
Fixes golang/gddo#418

Change-Id: I8ec374a74765d751a714dcf61c7caec534c8333d
Reviewed-on: https://go-review.googlesource.com/26653
Reviewed-by: Chris Broadfoot <cbro@golang.org>
2016-08-10 15:21:21 +00:00
Chris Broadfoot ef57c45546 gddo-server: fix typos/compile errors from previous commit
Change-Id: Id322ec04be435dc5cccf9e43e527504d0508db76
Reviewed-on: https://go-review.googlesource.com/25542
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-05 16:35:51 +00:00
Chris Broadfoot 4485304693 gddo-server: forward the X-AppEngine-Country header for play links
Also return better errors when play.golang.org returns an non-OK error.

Fixes golang/go#16617.

Change-Id: Ie027482ef924d687db8662d0cb96dd30ba41e22e
Reviewed-on: https://go-review.googlesource.com/25540
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-05 16:19:10 +00:00
Jaana Burcu Dogan 0cc236bad2 import the cloud package from the new path
Change-Id: Ibc1eb122a634fed43f6d7928545ccf3a0232515c
Reviewed-on: https://go-review.googlesource.com/25461
Reviewed-by: Dmitri Shuralyov <shurcool@gmail.com>
Reviewed-by: Dave Day <djd@golang.org>
2016-08-04 15:10:15 +00:00
Dave Day d49b49d600 gddo-server: remove call to cloud.NewContext
The logging client does not rely on the legacy cloud context behaviour
(it uses the project ID explicitly passed into the NewClient call), and
the cloud.NewContext function is due to be deleted.

Change-Id: I5a58dc0b8ab25d942a13b0386bccc7f3b2726b33
Reviewed-on: https://go-review.googlesource.com/25418
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-08-03 04:26:36 +00:00
Tuo Shan 2c827f8497 gddo-server: Forbid bot access to import-graph pages.
This CL blocks the access to import-graph pages for robotRequest, which
causes the recent outage since graphs are very expensive for CPU and
disk read I/O. This is a hot-fix that has already been deployed. We'll
work on something permanent later when we come up with some better plan
for robotRequest related issues.

Change-Id: I7e7fbc0538f3d8d26c1ca35cef51e828a79dc1c9
Reviewed-on: https://go-review.googlesource.com/25416
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-08-02 23:32:07 +00:00
Tuo Shan e0d34163be gddo-server: Remove the gae_search flag.
Use app engine's main function to start the server by default. GAE
search is also enabled by default. API search is also using the new
search algorithm.

Developers will need to install Google Cloud SDK to use dev_appserver
in order to run the search api locally. The development setup will be
updated as soon as this CL is submitted.

Change-Id: Idae7a88949b2757977d0ab33628564451a1dddd3
Reviewed-on: https://go-review.googlesource.com/25360
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-08-02 15:37:09 +00:00
Tuo Shan b828973d90 gosrc: Archive noise packages instead of deletion.
gddo should let users visit any go-gettable package. This change will
remove those noise packages from the search index but not the db.

This fixes #420

Change-Id: Ifb1d731655ca5e6d31bfc0bd4c7657ec165b9902
Reviewed-on: https://go-review.googlesource.com/24793
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-07-13 16:13:38 +00:00
Tuo Shan 52ed2801f7 doc: Update PackageVersion to force update all packages.
We are about to reindex the production search index. Update the version
number to force the crawler to crawl all packages without checking the
existing Etags.

Change-Id: I12d865188e23933344becb4449b37385a3e59a1a
Reviewed-on: https://go-review.googlesource.com/24701
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-07-06 14:28:28 +00:00
Tuo Shan 7f31cf313c gosrc: Remove noise packages.
A package will be removed if either it has no commits in two years and
no imports from other packages, or it is created for a quick bug fix,
which means it has one or two commits within a week of creation time and
no other activity since then.

This CL checks such packages from GitHub and BitBucket utilizing their
API to gather commits information.

This CL also removes the checks for references for GitHub repo, instead
it check the most recent commit from default branch.

This fixes #405

Change-Id: I14b0f0133f31851511aaa63eee8acbfba63e13d2
Reviewed-on: https://go-review.googlesource.com/24513
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-06-30 21:47:52 +00:00
Tuo Shan f7243c4f72 database: Customize rank function for the search index.
database.PackageDocument is now merged into database.Package.
database.Package now implements search.FieldLoadSaver, which can
customize the Rank method to our default sorting algorithm. This allows
faster search queries by avoiding sorting. This also eliminates the
confusion of having two similar package structs in database.

Two admin handlers are used to reindex and purge index. These handlers
are restricted to be accessible to admin only in the yaml file.

Change-Id: I63929a50b08b9817e7d62020f9755fba9d4ec8f0
Reviewed-on: https://go-review.googlesource.com/24450
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-06-29 18:50:54 +00:00
Tuo Shan 8cf1eb70e8 gosrc: Update the paths for Go 1.6.2
The data we have now are still Go 1.6.1, which causes gddo not
recogonizing some of the std packages.

Change-Id: Ic06e11ac0b04aa2a60cd9376b70a637099bce9cf
Reviewed-on: https://go-review.googlesource.com/24432
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-06-24 17:54:34 +00:00
Tuo Shan b929b8ac8b gddo-server: Use memcache to cache HTTP transport.
The memcache underneath is using the gomemcache package, which can be
used both as a standalone app or in App Engine. The cache will reduce a
significant amount of HTTP requests we make when updating packages. Most
of the requests are to GitHub. So this change will save a lot against
GitHub rate limits.

Change-Id: I46c7c4bd658b7b2ab18ca67e8c8d25549181dfb4
Reviewed-on: https://go-review.googlesource.com/24326
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-06-23 20:18:50 +00:00
Dmitry Savintsev aaf246516d httputils: use pointer to CacheBusters in test to fix govet
Prevent 'govet' from complaining about copying
a lock value ("httputil.CacheBusters contains sync.Mutex").

Change-Id: If2d235f148e767ad0a9e6110ae1f38e69a32b1a9
Reviewed-on: https://go-review.googlesource.com/24260
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-06-21 02:42:43 +00:00
Tuo Shan 2979ca8fbf database: Fetch and index fork and stars for GitHub and BitBucket.
Store and show if a package is a fork, how many imports and stars
(followers in BitBucket) for each package in the search result list.
Currently we have over 90% packages coming from these two VCS's.
Corresponding UI change is made to show these additional information
under each package's import path.

Change-Id: I669755d4b905f360918d38e8600534a61a449ba4
Reviewed-on: https://go-review.googlesource.com/24173
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-06-20 18:21:06 +00:00
Tuo Shan dfb07a6b3f gddo-server: Group all flags into main package.
This CL moves the flags defined in database package into main and changes
them to exported variables.

Change-Id: I6c4c3287f20b506170375bbd30880d172fd39ea3
Reviewed-on: https://go-review.googlesource.com/24175
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-06-16 19:11:21 +00:00
Tuo Shan 9f798d6a0b database: Redesign search functions with GAE Search API.
This change includes the new indexing functions using GAE Search API
inside indexae.go. A flag in the main package gae_search is used to
control whether to use the new search functions.

The final goal is to replace index.go with the new methods and deprecate
the current stemming algorithm and use the one from Search API.
Functions to replace original ones are implemented and labeled "2" in
their names.

Local development is unaffected with gae_search flag turned off. Local
deployment with GAE Search API needs to use dev_appserver and an
app.yaml file, which is included. The instruction on how to do so will
be added to the wiki page when the code is submitted.

Change-Id: Ia889684176bafb2d6eac075061c06a733667c914
Reviewed-on: https://go-review.googlesource.com/23794
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-06-16 17:07:03 +00:00
Tuo Shan d2b6e246a1 gddo-server: Correct the order of the js path in template.
Change-Id: Ib9d9c5cb8977200470f7b5664ff2acc0560d5d9d
Reviewed-on: https://go-review.googlesource.com/23951
Reviewed-by: Dmitri Shuralyov <shurcool@gmail.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-06-13 13:59:36 +00:00
Tuo Shan e91d416507 gddo-server: Handle static files properly.
Add handlers for newly added Bootstrap and jQuery files. These files are
stored locally now instead of being fetched from CDN. But those static
files are not handled properly in our serve mux, causing the serve keeps
requesting them infinitely.

Change-Id: Iddc680bb889f1327ec9265fa33eff94d9fa8dec4
Reviewed-on: https://go-review.googlesource.com/23721
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-06-09 02:27:09 +00:00
Antonio Bibiano f457f249c9 gddo: Removed dependency on CDN for Bootstrap and jQuery
Downloaded the linked version from the CDN and stored it in the
assets/ directory. Removed the Bootstrap.js Bootstra.css and jQuery.js
definition from common.html. Changed all the occurence of these
to staticPath commands in the other templates.

Fixes #410

Change-Id: Ica50da2b5c5df85d46181b77361e832128856ce9
Reviewed-on: https://go-review.googlesource.com/23335
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-05-30 00:57:00 +00:00
Quinn Slack a3e22dae8c gddo-server: add global "Uses" links (alongside permalinks)
Each definition's "Uses" link points to the definition's page on
Sourcegraph, which shows where the definition is used (across all
indexed open-source repositories). This lets library users see "usage
examples" and gives library authors information about how their
library's API is being used.

It is necessary to store the value of go/doc.Func.Orig (the original
receiver name, see https://godoc.org/go/doc#Func.Orig) when building
documentation. Previously, only go/doc.Func.Recv (actual receiver
name) was stored. The original receiver name can differ from actual
due to struct embedding.

This change was originally submitted and OK'd by adg at
https://github.com/golang/gddo/pull/259.

A gddo server with this change applied is temporarily available at
http://godoc.sgdev.org/.

Change-Id: Ifa7773b56ccc08c8f063730bdf1fa441d9728d5c
Reviewed-on: https://go-review.googlesource.com/23380
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-05-26 22:13:46 +00:00
Tuo Shan a9487c44c6 gddo-server: enable log when running on GCE.
This fixes error when deploying to local machine.

Change-Id: I5d61c31f0c815ab3dfcaaaedf51903f7e1ec4954
Reviewed-on: https://go-review.googlesource.com/22804
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-05-05 17:33:48 +00:00
Tuo Shan c784e22943 Revert "gosrc: include package updated time in the request header."
The current process to fetch GitHub packages check the reference first,
which is the API call I use in the change for timestamp check. It turns
out the last modified timestamp returned can be older than the most
recent commit.

This reverts commit 3abf761629.

Change-Id: I55d38f55ee118ed6069dd9b3231858cebcf95281
Reviewed-on: https://go-review.googlesource.com/22700
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-05-03 00:30:49 +00:00
Tuo Shan 3abf761629 gosrc: include package updated time in the request header.
gddo-server: pass pdoc instead of nil in the refresh call.

The package updated time is included in the header to check if it is
recently updated when requesting from VCS. Currently we use http ETag
as a general way to compare changes, which still consumes one API
request rate when requesting from Github. However, Github accepts
conditional requests using "If-Modified-Since" to check recent updates
time without counting against the rate limit if a 304 is received.

Package document is included in the refresh call to avoid unlimited
manual refreshing. The current design to allow such refresh to force
updating the package seems unnecessary.

These changes are targeting at reducing Github API request rate in order
to give us more head room when we do batch updates to do type analysis.

Change-Id: I4ec81c92662cd23dc96e5a5e141f1945b127db2c
Reviewed-on: https://go-review.googlesource.com/22506
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-04-29 03:37:44 +00:00
Tuo Shan 56fdb27532 gddo-server: add search results and referer to logging.
Log a list of package served to learn what user goes to when searching.
Log referer to learn where does user come from, such as Google search,
github reference link, etc.
Remove unnecessary handler and response writer wrapper since both are
handled by GAE request log.

This fixes golang/gddo#390.

Change-Id: I7ac049ad7723edb229cea0dc8d0c64295981d368
Reviewed-on: https://go-review.googlesource.com/22261
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-04-21 05:21:57 +00:00
Tuo Shan 75e3d37944 gddo-server: use X-Appengine-User-Ip to identify ip of requests.
When running on GAE, the X-Real-Ip in header is shielded as well.
X-Appengine-User-Ip contains the real ip address in this situation.

This fixes golang/gddo#393.

Change-Id: I64fc4aa0a16a613a4ce4727aa1425d081ce1f0c9
Reviewed-on: https://go-review.googlesource.com/22067
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-04-14 20:29:17 +00:00
Tuo Shan 562ac074ef gddo-server: add a trust proxy flag identify requests by real ip.
X-Real-Ip is used as the remote address to identify the original
address sent through the requests to detect robots.

This fixes golang/gddo#393

Change-Id: I322061dd355340d864376e656185bd84fbbc9432
Reviewed-on: https://go-review.googlesource.com/21996
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-04-14 00:33:16 +00:00
Tuo Shan 056da16a40 gddo-server: handle /_ah/ requests on GAE.
Request to /_ah/health will get 200 response. Requests to other /_ah/
will get 404.

Change-Id: I06b809b6ee3144d4a3d0983e132b954765c95c1b
Reviewed-on: https://go-review.googlesource.com/21997
Reviewed-by: Stephen Weinberg <stephenmw@google.com>
2016-04-13 21:16:02 +00:00
Francesc Campoy 0322aa6964 gddo: clean filepaths before fetching
Fixes #391

Change-Id: I190bb17e76f0f2cb84d9b8c3b7a1f69bc6486649
Reviewed-on: https://go-review.googlesource.com/21898
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-04-12 23:05:27 +00:00
Stephen Weinberg 4b6647e4ec gddo-server: enable redirects talks.godoc.org and www.godoc.org
With the move away from nginx, all redirects need to be reimplmented
in gddo-server. This implements the redirect to send talks.godoc.org
to the go-talks App Engine project and www.godoc.org to godoc.org. In
nginx these were 301 redirects. I am making them 302 redirects now
because in the future these redirects are likely to change.

go-talks is just a standard App Engine app. There is no reason we
cannot run go-talks directly from the the talks.godoc.org domain and
likely will in the future.

Change-Id: I4b3e8dda74d31daeba8bd961932f774c6ff1442f
Reviewed-on: https://go-review.googlesource.com/21588
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-07 19:15:21 +00:00
Stephen Weinberg aa04edd02b gddo-server: Remove https redirect for "godoc.org" domain
With the move of godoc.org to app engine, the TLS is being stripped
before it hits the gddo-server. This causes an infinite redirect as it
continuously tries to redirect to https even though https is already
being used.

HSTS headers were also removed. Strict TLS is really not needed for
this site. It is a security feature unlikely to provide much security
while at the same time getting in the way if we ever need to host
godoc.org in a non-https enviornment.

Change-Id: Id6f7fd2e1675320ec322077c19834bf4c135ffee
Reviewed-on: https://go-review.googlesource.com/21454
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-04-07 18:39:58 +00:00
Tuo Shan 309c9cd342 gddo-server: Adds logging to GCE.
This change handles logging to GCE on every user request to record
user's query term, the package we serve, the status, etc. Setting a log
name in GCE to enable this logging.

Change-Id: I6d22fcd391eccc76aa9ab1d81f00a10eaba48015
Reviewed-on: https://go-review.googlesource.com/21151
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-04-04 01:47:30 +00:00
Dmitri Shuralyov df07980128 Support {file} after '#' in go-source meta tag.
Due to the way LineFmt is currently used (see 309d40be40/gddo-server/template.go (L104)),
we need to split fileTemplate into two parts at a cut point.
Previously, the cut point has always been just before the first '#',
if present, or end of string otherwise. Now, we'll extend the cut
to include the last {file} segment, if it it appears beyond a '#'.

Some examples, where the '|' in the URL represents the cut:

                                            ↓
https://example.org/repo{/dir}/{file}?view=t|

                                            ↓
https://example.org/repo{/dir}/{file}?view=t|#L{line}

                                                   ↓
https://example.org/repo{/dir}/{file}?view=t#{file}|-L{line}

                                                            ↓
https://example.org/repo{/dir}/{file}?view=t#FileName-{file}|-and-LineNumber{line}-and-more

Add test for a case where {file} comes after '#'.

Fixes #385.

Also, remove unintended extra `<head>` before
`<!DOCTYPE html><html><head>` in test data.

Change-Id: Ia053602b566d8b7b61b4692be76d6b0cbf866325
Reviewed-on: https://go-review.googlesource.com/20749
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-03-18 00:42:36 +00:00
Andrew Gerrand 309d40be40 gddo-server: fetch Google Analytics account ID from metadata or env
Fixes #388

Change-Id: Ib57829af5b56636b29d7ac91293660d385401aa5
Reviewed-on: https://go-review.googlesource.com/20587
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-15 02:25:04 +00:00
Tuo Shan d0ea64afce gddo-server: show bugs link in package index section.
This fixes #387.

Change-Id: If6115257aeb1fcad6b6ccf9e840b91df50550407
Reviewed-on: https://go-review.googlesource.com/20702
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-03-14 22:08:24 +00:00
Andrew Gerrand 8e3052b95a doc: synchronize contribution instructions with readme
Change-Id: Ic3ad48c9f771589f60326bfa9a5cdb5315902b89
Reviewed-on: https://go-review.googlesource.com/20465
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-14 04:21:28 +00:00
Tuo Shan 850d0e32c1 database: match full import paths, don't split on periods.
For all projects we now index the full import path. So user can search
for example gddo/doc.

Handle urls and float numbers as one term, such as v.io, 0.8.

This fixes #366, and fixes #384.

Change-Id: Ia2c95ddcb64963590edc19d5fb4d4b06ea19e018
Reviewed-on: https://go-review.googlesource.com/20563
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-03-11 01:36:27 +00:00
Andy Finkenstadt b0d8f6a5c1 all: update code to satisfy golint
This silences all warnings except those about documentation.

Change-Id: I1d61bf871dcfd6d95b53f66d9e9378f4f648c3a0
Reviewed-on: https://go-review.googlesource.com/20464
Reviewed-by: Dmitri Shuralyov <shurcool@gmail.com>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-03-10 00:02:39 +00:00
Andrew Gerrand d5e22321f6 doc: use new Gerrit link and link to our instance of it
Change-Id: Ic07f9e5d9d37affbd6e4ffee5e1df8c807402f7b
Reviewed-on: https://go-review.googlesource.com/20463
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-09 00:51:38 +00:00
Andrew Gerrand c4526b92e8 doc: add CONTRIBUTING.md file
Change-Id: I0186ccf72b8a919456ff5d43ee3302395a6c7358
Reviewed-on: https://go-review.googlesource.com/20312
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-08 00:53:13 +00:00
Andrew Gerrand c2293cd10a Merge pull request #382 from lucidlime/i308
Remove play links for pkgs outside std lib
2016-03-07 14:44:02 +11:00
ryan 7eb2cbafe8 Remove play links for pkgs outside std lib
Fixes #308.
2016-03-02 21:33:33 -08:00
Andrew Gerrand 54beb575c6 Merge pull request #381 from lucidlime/i339
Return all packages from database.Packages
2016-03-02 14:46:19 +11:00
Andrew Gerrand a4600ea461 Merge pull request #383 from golang/fix-misspellings
Fix misspellings in comments.
2016-03-01 17:18:54 +11:00
ryan 927d2f29fe Return all packages from database.Packages
Don't remove directories when converting the output from the Redis script to
[]Package.

Fixes #339
2016-02-29 21:59:30 -08:00
Dmitri Shuralyov b442ec7a91 Fix misspellings in comments.
Found "retunred" with eyes, the rest with github.com/client9/misspell
tool.
2016-02-29 21:44:56 -08:00
Andrew Gerrand eb44e37ce2 Merge pull request #380 from lucidlime/master
Handle GitHub file as not found
2016-03-01 16:11:35 +11:00
ryan 2970df05a3 Handle GitHub file as not found
Fixes #345
2016-02-29 08:54:23 -08:00
Andrew Gerrand 96926d2758 Merge pull request #376 from dmage/master
Fallback for clonePath if `<repo>.<vcs><dir>` pattern matched
2016-02-16 08:20:53 +11:00
Oleg Bulatov feea9ae500 Fallback for clonePath if `<repo>.<vcs><dir>` pattern matched 2016-02-15 12:32:32 +03:00