|
6 | 6 | "context" |
7 | 7 | "encoding/json" |
8 | 8 | "fmt" |
9 | | - "io/ioutil" |
| 9 | + "io" |
10 | 10 | "log" |
11 | 11 | "net/http" |
12 | 12 | "net/url" |
@@ -36,7 +36,7 @@ func siteFromFlags() (*docsite.Site, *docsiteConfig, error) { |
36 | 36 |
|
37 | 37 | paths := filepath.SplitList(*configPath) |
38 | 38 | for _, path := range paths { |
39 | | - data, err := ioutil.ReadFile(path) |
| 39 | + data, err := os.ReadFile(path) |
40 | 40 | if os.IsNotExist(err) { |
41 | 41 | continue |
42 | 42 | } else if err != nil { |
@@ -324,7 +324,7 @@ func (fs *versionedFileSystemURL) fetchAndCacheVersion(version string) (http.Fil |
324 | 324 | if strings.Contains(urlStr, "$VERSION") && strings.Contains(urlStr, "github") && !strings.Contains(urlStr, "refs/heads/$VERSION") { |
325 | 325 | return nil, fmt.Errorf("refusing to use insecure docsite configuration for multi-version-aware GitHub URLs: the URL pattern %q must include \"refs/heads/$VERSION\", not just \"$VERSION\" (see docsite README.md for more information)", urlStr) |
326 | 326 | } |
327 | | - urlStr = strings.Replace(fs.url, "$VERSION", version, -1) |
| 327 | + urlStr = strings.ReplaceAll(fs.url, "$VERSION", version) |
328 | 328 |
|
329 | 329 | // HACK: Workaround for https://github.com/sourcegraph/sourcegraph-public-snapshot/issues/3030. This assumes |
330 | 330 | // that tags all begin with "vN" where N is some number. |
@@ -363,7 +363,7 @@ func zipFileSystemAtURL(url, dir string) (http.FileSystem, error) { |
363 | 363 | } else if resp.StatusCode != http.StatusOK { |
364 | 364 | return nil, &os.PathError{Op: "Get", Path: url, Err: fmt.Errorf("HTTP response status code %d", resp.StatusCode)} |
365 | 365 | } |
366 | | - body, err := ioutil.ReadAll(resp.Body) |
| 366 | + body, err := io.ReadAll(resp.Body) |
367 | 367 | if err != nil { |
368 | 368 | return nil, err |
369 | 369 | } |
@@ -397,7 +397,7 @@ func mapFromZipArchive(z *zip.Reader, dir string) (map[string]string, error) { |
397 | 397 | if err != nil { |
398 | 398 | return nil, errors.WithMessagef(err, "open %q", zf.Name) |
399 | 399 | } |
400 | | - data, err := ioutil.ReadAll(f) |
| 400 | + data, err := io.ReadAll(f) |
401 | 401 | f.Close() |
402 | 402 | if err != nil { |
403 | 403 | return nil, errors.WithMessagef(err, "read %q", zf.Name) |
|
0 commit comments