| @@ -1,14 +1,23 @@ |
| 1 | 1 | module Docs |
| 2 | 2 | class Go < UrlScraper |
| 3 | 3 | self.type = 'go' |
| 4 | | − self.release = '1.16' |
| 4 | + self.release = '1.17.2' |
| 5 | 5 | self.base_url = 'https://golang.org/pkg/' |
| 6 | 6 | self.links = { |
| 7 | 7 | home: 'https://golang.org/', |
| 8 | 8 | code: 'https://go.googlesource.com/go' |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | + # Run godoc locally, since https://golang.org/pkg/ redirects to https://pkg.go.dev/std with rate limiting / scraping protection. |
| 12 | + |
| 13 | + # curl -LO https://golang.org/dl/go1.17.2.windows-amd64.zip |
| 14 | + # go install golang.org/x/tools/cmd/godoc@latest |
| 15 | + # go/bin/godoc -zip=go1.17.2.windows-amd64.zip -goroot=/go |
| 16 | + self.base_url = 'http://localhost:6060/pkg/' |
| 17 | + |
| 18 | + html_filters.push 'clean_local_urls' |
| 11 | 19 | html_filters.push 'go/clean_html', 'go/entries' |
| 20 | + text_filters.replace 'attribution', 'go/attribution' |
| 12 | 21 | |
| 13 | 22 | options[:trailing_slash] = true |
| 14 | 23 | options[:container] = '#page .container' |
| @@ -16,7 +25,7 @@ module Docs · 1 unmodified line |
| 16 | 25 | options[:skip_patterns] = [/\/\//] |
| 17 | 26 | |
| 18 | 27 | options[:fix_urls] = ->(url) do |
| 19 | | − url.sub 'https://golang.org/pkg//', 'https://golang.org/pkg/' |
| 28 | + url.sub '/pkg//', '/pkg/' |
| 20 | 29 | end |
| 21 | 30 | |
| 22 | 31 | options[:attribution] = <<-HTML |