зеркало из https://github.com/golang/build.git
all: clean up obsolete +build lines and io/ioutil uses [generated]
The module go directive is at 1.20, so modernize it a bit by applying changes generated by the script below with go1.21.1. [git-generate] go fix ./... gofmt -r 'ioutil.Discard -> io.Discard' -w . gofmt -r 'ioutil.NopCloser -> io.NopCloser' -w . gofmt -r 'ioutil.ReadAll -> io.ReadAll' -w . gofmt -r '"ioutil.ReadAll: %v" -> "io.ReadAll: %v"' -w . gofmt -r 'ioutil.ReadDir -> os.ReadDir' -w . gofmt -r 'ioutil.ReadFile -> os.ReadFile' -w . gofmt -r 'ioutil.TempDir -> os.MkdirTemp' -w . gofmt -r 'ioutil.TempFile -> os.CreateTemp' -w . gofmt -r 'ioutil.WriteFile -> os.WriteFile' -w . goimports -w . Change-Id: I145b27756e7c6101e992747ee822e7237df4cb91 Reviewed-on: https://go-review.googlesource.com/c/build/+/527016 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
This commit is contained in:
Родитель
3a081fc9ee
Коммит
1ee051bb32
|
@ -8,7 +8,7 @@ package autocertcache
|
|||
|
||||
import (
|
||||
"context"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
|
||||
"cloud.google.com/go/storage"
|
||||
"golang.org/x/crypto/acme/autocert"
|
||||
|
@ -40,7 +40,7 @@ func (c *gcsAutocertCache) Get(ctx context.Context, key string) ([]byte, error)
|
|||
return nil, err
|
||||
}
|
||||
defer rd.Close()
|
||||
return ioutil.ReadAll(rd)
|
||||
return io.ReadAll(rd)
|
||||
}
|
||||
|
||||
func (c *gcsAutocertCache) Put(ctx context.Context, key string, data []byte) error {
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"context"
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"time"
|
||||
|
@ -139,7 +139,7 @@ func probeBuildlet(ctx context.Context, buildletURL string, opts *VMOpts) error
|
|||
if err != nil {
|
||||
return fmt.Errorf("error probe buildlet %s: %w", buildletURL, err)
|
||||
}
|
||||
ioutil.ReadAll(res.Body)
|
||||
io.ReadAll(res.Body)
|
||||
res.Body.Close()
|
||||
if res.StatusCode != http.StatusOK {
|
||||
return fmt.Errorf("buildlet returned HTTP status code %d for %s", res.StatusCode, buildletURL)
|
||||
|
|
|
@ -11,7 +11,6 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
|
@ -279,7 +278,7 @@ func (c *client) ProxyTCP(port int) (io.ReadWriteCloser, error) {
|
|||
return nil, err
|
||||
}
|
||||
if res.StatusCode != http.StatusSwitchingProtocols {
|
||||
slurp, _ := ioutil.ReadAll(io.LimitReader(res.Body, 4<<10))
|
||||
slurp, _ := io.ReadAll(io.LimitReader(res.Body, 4<<10))
|
||||
res.Body.Close()
|
||||
return nil, fmt.Errorf("wanted 101 Switching Protocols; unexpected response: %v, %q", res.Status, slurp)
|
||||
}
|
||||
|
@ -397,7 +396,7 @@ func (c *client) doOK(req *http.Request) error {
|
|||
}
|
||||
defer res.Body.Close()
|
||||
if res.StatusCode != http.StatusOK {
|
||||
slurp, _ := ioutil.ReadAll(io.LimitReader(res.Body, 4<<10))
|
||||
slurp, _ := io.ReadAll(io.LimitReader(res.Body, 4<<10))
|
||||
return fmt.Errorf("%v; body: %s", res.Status, slurp)
|
||||
}
|
||||
return nil
|
||||
|
@ -459,7 +458,7 @@ func (c *client) GetTar(ctx context.Context, dir string) (io.ReadCloser, error)
|
|||
return nil, err
|
||||
}
|
||||
if res.StatusCode != http.StatusOK {
|
||||
slurp, _ := ioutil.ReadAll(io.LimitReader(res.Body, 4<<10))
|
||||
slurp, _ := io.ReadAll(io.LimitReader(res.Body, 4<<10))
|
||||
res.Body.Close()
|
||||
return nil, fmt.Errorf("%v; body: %s", res.Status, slurp)
|
||||
}
|
||||
|
@ -574,7 +573,7 @@ func (c *client) Exec(ctx context.Context, cmd string, opts ExecOpts) (remoteErr
|
|||
}
|
||||
defer res.Body.Close()
|
||||
if res.StatusCode != http.StatusOK {
|
||||
slurp, _ := ioutil.ReadAll(io.LimitReader(res.Body, 4<<10))
|
||||
slurp, _ := io.ReadAll(io.LimitReader(res.Body, 4<<10))
|
||||
return nil, fmt.Errorf("buildlet: HTTP status %v: %s", res.Status, slurp)
|
||||
}
|
||||
condRun(opts.OnStartExec)
|
||||
|
@ -587,7 +586,7 @@ func (c *client) Exec(ctx context.Context, cmd string, opts ExecOpts) (remoteErr
|
|||
// Stream the output:
|
||||
out := opts.Output
|
||||
if out == nil {
|
||||
out = ioutil.Discard
|
||||
out = io.Discard
|
||||
}
|
||||
if _, err := io.Copy(out, res.Body); err != nil {
|
||||
resc <- errs{execErr: fmt.Errorf("error copying response: %w", err)}
|
||||
|
@ -673,7 +672,7 @@ func (c *client) Status(ctx context.Context) (Status, error) {
|
|||
if resp.StatusCode != http.StatusOK {
|
||||
return Status{}, errors.New(resp.Status)
|
||||
}
|
||||
b, err := ioutil.ReadAll(resp.Body)
|
||||
b, err := io.ReadAll(resp.Body)
|
||||
resp.Body.Close()
|
||||
if err != nil {
|
||||
return Status{}, err
|
||||
|
@ -699,7 +698,7 @@ func (c *client) WorkDir(ctx context.Context) (string, error) {
|
|||
if resp.StatusCode != http.StatusOK {
|
||||
return "", errors.New(resp.Status)
|
||||
}
|
||||
b, err := ioutil.ReadAll(resp.Body)
|
||||
b, err := io.ReadAll(resp.Body)
|
||||
resp.Body.Close()
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
@ -792,7 +791,7 @@ func (c *client) ListDir(ctx context.Context, dir string, opts ListDirOpts, fn f
|
|||
}
|
||||
defer resp.Body.Close()
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
slurp, _ := ioutil.ReadAll(io.LimitReader(resp.Body, 1<<10))
|
||||
slurp, _ := io.ReadAll(io.LimitReader(resp.Body, 1<<10))
|
||||
return fmt.Errorf("%s: %s", resp.Status, slurp)
|
||||
}
|
||||
sc := bufio.NewScanner(resp.Body)
|
||||
|
@ -853,7 +852,7 @@ func (c *client) ConnectSSH(user, authorizedPubKey string) (net.Conn, error) {
|
|||
return nil, fmt.Errorf("reading /connect-ssh response: %v", err)
|
||||
}
|
||||
if res.StatusCode != http.StatusSwitchingProtocols {
|
||||
slurp, _ := ioutil.ReadAll(res.Body)
|
||||
slurp, _ := io.ReadAll(res.Body)
|
||||
conn.Close()
|
||||
return nil, fmt.Errorf("unexpected /connect-ssh response: %v, %s", res.Status, slurp)
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
@ -112,7 +112,7 @@ func (cc *CoordinatorClient) CreateBuildletWithStatus(builderType string, status
|
|||
}
|
||||
defer res.Body.Close()
|
||||
if res.StatusCode != 200 {
|
||||
slurp, _ := ioutil.ReadAll(res.Body)
|
||||
slurp, _ := io.ReadAll(res.Body)
|
||||
return nil, fmt.Errorf("%s: %s", res.Status, slurp)
|
||||
}
|
||||
|
||||
|
@ -185,7 +185,7 @@ func (cc *CoordinatorClient) RemoteBuildlets() ([]RemoteBuildlet, error) {
|
|||
}
|
||||
defer res.Body.Close()
|
||||
if res.StatusCode != 200 {
|
||||
slurp, _ := ioutil.ReadAll(res.Body)
|
||||
slurp, _ := io.ReadAll(res.Body)
|
||||
return nil, fmt.Errorf("%s: %s", res.Status, slurp)
|
||||
}
|
||||
var ret []RemoteBuildlet
|
||||
|
@ -256,7 +256,7 @@ func userToken() (string, error) {
|
|||
}
|
||||
keyDir := configDir()
|
||||
userPath := filepath.Join(keyDir, "user-"+gomoteUserFlag+".user")
|
||||
b, err := ioutil.ReadFile(userPath)
|
||||
b, err := os.ReadFile(userPath)
|
||||
if err == nil {
|
||||
gomoteUserFlag = string(bytes.TrimSpace(b))
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ func userToken() (string, error) {
|
|||
baseFile = "staging-" + baseFile
|
||||
}
|
||||
tokenFile := filepath.Join(keyDir, baseFile)
|
||||
slurp, err := ioutil.ReadFile(tokenFile)
|
||||
slurp, err := os.ReadFile(tokenFile)
|
||||
if os.IsNotExist(err) {
|
||||
return "", fmt.Errorf("Missing file %s for user %q. Change --user or obtain a token and place it there.",
|
||||
tokenFile, gomoteUserFlag)
|
||||
|
|
|
@ -25,7 +25,6 @@ import (
|
|||
"fmt"
|
||||
"io"
|
||||
"io/fs"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
|
@ -412,7 +411,7 @@ func metadataValue(key string) string {
|
|||
v := os.Getenv(envKey)
|
||||
// Respect curl-style '@' prefix to mean the rest is a filename.
|
||||
if strings.HasPrefix(v, "@") {
|
||||
slurp, err := ioutil.ReadFile(v[1:])
|
||||
slurp, err := os.ReadFile(v[1:])
|
||||
if err != nil {
|
||||
log.Fatalf("Error reading file for GCEMETA_%v: %v", key, err)
|
||||
}
|
||||
|
@ -1613,7 +1612,7 @@ func waitLocalSSH() {
|
|||
|
||||
func numProcs() int {
|
||||
n := 0
|
||||
fis, _ := ioutil.ReadDir("/proc")
|
||||
fis, _ := os.ReadDir("/proc")
|
||||
for _, fi := range fis {
|
||||
if _, err := strconv.Atoi(fi.Name()); err == nil {
|
||||
n++
|
||||
|
@ -1810,7 +1809,7 @@ func appendSSHAuthorizedKey(sshUser, authKey string) error {
|
|||
return err
|
||||
}
|
||||
authFile := filepath.Join(sshDir, "authorized_keys")
|
||||
exist, err := ioutil.ReadFile(authFile)
|
||||
exist, err := os.ReadFile(authFile)
|
||||
if err != nil && !os.IsNotExist(err) {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build netbsd || openbsd
|
||||
// +build netbsd openbsd
|
||||
|
||||
package main
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build linux
|
||||
// +build linux
|
||||
|
||||
// (We only care about Linux on GKE for now)
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
|
@ -37,7 +36,7 @@ func keyForMode(mode string) (string, error) {
|
|||
if v := os.Getenv("GO_BUILD_KEY_PATH"); v != "" {
|
||||
keyPath = v
|
||||
}
|
||||
key, err := ioutil.ReadFile(keyPath)
|
||||
key, err := os.ReadFile(keyPath)
|
||||
if ok, _ := strconv.ParseBool(os.Getenv("GO_BUILD_KEY_DELETE_AFTER_READ")); ok {
|
||||
os.Remove(keyPath)
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
// Same requirements as internal/coordinator/pool/reverse.go.
|
||||
//go:build linux || darwin
|
||||
// +build linux darwin
|
||||
|
||||
package main
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ import (
|
|||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net"
|
||||
"os"
|
||||
|
@ -129,7 +128,7 @@ func genKey() (pubKey, privateKeyPath string) {
|
|||
log.Fatalf("ssh-keygen: %v, %s", err, out)
|
||||
}
|
||||
}
|
||||
slurp, err := ioutil.ReadFile(pubKeyPath)
|
||||
slurp, err := os.ReadFile(pubKeyPath)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build go1.16 && (linux || darwin)
|
||||
// +build go1.16
|
||||
// +build linux darwin
|
||||
|
||||
package main
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build go1.16 && (linux || darwin)
|
||||
// +build go1.16
|
||||
// +build linux darwin
|
||||
|
||||
package main
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build go1.16 && (linux || darwin)
|
||||
// +build go1.16
|
||||
// +build linux darwin
|
||||
|
||||
package main
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build go1.16 && (linux || darwin)
|
||||
// +build go1.16
|
||||
// +build linux darwin
|
||||
|
||||
package main
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build go1.16 && (linux || darwin)
|
||||
// +build go1.16
|
||||
// +build linux darwin
|
||||
|
||||
// The coordinator runs the majority of the Go build system.
|
||||
//
|
||||
|
@ -27,7 +25,6 @@ import (
|
|||
"fmt"
|
||||
"html"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
@ -2013,7 +2010,7 @@ func newBuildLogBlob(objName string) (obj io.WriteCloser, url_ string) {
|
|||
io.Closer
|
||||
}{
|
||||
os.Stderr,
|
||||
ioutil.NopCloser(nil),
|
||||
io.NopCloser(nil),
|
||||
}, "devmode://build-log/" + objName
|
||||
}
|
||||
if pool.NewGCEConfiguration().StorageClient() == nil {
|
||||
|
|
|
@ -3,14 +3,12 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build go1.16 && (linux || darwin)
|
||||
// +build go1.16
|
||||
// +build linux darwin
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
|
@ -138,9 +136,9 @@ func TestTryStatusJSON(t *testing.T) {
|
|||
t.Errorf("response status code: got %d; want %d", got, want)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
b, err := ioutil.ReadAll(resp.Body)
|
||||
b, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
t.Fatalf("ioutil.ReadAll: %v", err)
|
||||
t.Fatalf("io.ReadAll: %v", err)
|
||||
}
|
||||
if got, want := string(b), tc.body; got != want {
|
||||
t.Errorf("body: got\n%v\nwant\n%v", got, want)
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build go1.16 && (linux || darwin)
|
||||
// +build go1.16
|
||||
// +build linux darwin
|
||||
|
||||
// Code interacting with build.golang.org ("the dashboard").
|
||||
|
||||
|
@ -19,10 +17,10 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
@ -163,7 +161,7 @@ func builderKey(builder string) string {
|
|||
|
||||
func loadKey(sc *secret.Client) {
|
||||
if *masterKeyFile != "" {
|
||||
b, err := ioutil.ReadFile(*masterKeyFile)
|
||||
b, err := os.ReadFile(*masterKeyFile)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build go1.16 && (linux || darwin)
|
||||
// +build go1.16
|
||||
// +build linux darwin
|
||||
|
||||
package main
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build linux || darwin
|
||||
// +build linux darwin
|
||||
|
||||
package dashboard
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build linux || darwin
|
||||
// +build linux darwin
|
||||
|
||||
package dashboard
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build linux || darwin
|
||||
// +build linux darwin
|
||||
|
||||
// Package dashboard contains the implementation of the build dashboard for the Coordinator.
|
||||
package dashboard
|
||||
|
|
|
@ -3,13 +3,12 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build linux
|
||||
// +build linux
|
||||
|
||||
package dashboard
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
@ -54,7 +53,7 @@ func TestHandlerServeHTTP(t *testing.T) {
|
|||
dh.ServeHTTP(w, req)
|
||||
resp := w.Result()
|
||||
defer resp.Body.Close()
|
||||
ioutil.ReadAll(resp.Body)
|
||||
io.ReadAll(resp.Body)
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
t.Errorf("resp.StatusCode = %d, wanted %d", resp.StatusCode, http.StatusOK)
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build go1.16
|
||||
// +build go1.16
|
||||
|
||||
package legacydash
|
||||
|
||||
|
@ -14,7 +13,6 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"math/rand"
|
||||
pathpkg "path"
|
||||
"strings"
|
||||
|
@ -444,7 +442,7 @@ func (l *Log) Text() ([]byte, error) {
|
|||
if err != nil {
|
||||
return nil, fmt.Errorf("reading log data: %v", err)
|
||||
}
|
||||
b, err := ioutil.ReadAll(d)
|
||||
b, err := io.ReadAll(d)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("reading log data: %v", err)
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build go1.16
|
||||
// +build go1.16
|
||||
|
||||
// Package legacydash holds the serving code for the build dashboard
|
||||
// (build.golang.org) and its remaining HTTP API endpoints.
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build go1.16
|
||||
// +build go1.16
|
||||
|
||||
package legacydash
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build go1.16
|
||||
// +build go1.16
|
||||
|
||||
package legacydash
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build go1.16
|
||||
// +build go1.16
|
||||
|
||||
package legacydash
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build go1.16 && (linux || darwin)
|
||||
// +build go1.16
|
||||
// +build linux darwin
|
||||
|
||||
package main
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build go1.16 && (linux || darwin)
|
||||
// +build go1.16
|
||||
// +build linux darwin
|
||||
|
||||
package main
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build go1.16 && (linux || darwin)
|
||||
// +build go1.16
|
||||
// +build linux darwin
|
||||
|
||||
package main
|
||||
|
||||
|
|
|
@ -6,11 +6,12 @@ package protos
|
|||
import (
|
||||
context "context"
|
||||
fmt "fmt"
|
||||
math "math"
|
||||
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
math "math"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build go1.16 && (linux || darwin)
|
||||
// +build go1.16
|
||||
// +build linux darwin
|
||||
|
||||
package main
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build go1.16 && (linux || darwin)
|
||||
// +build go1.16
|
||||
// +build linux darwin
|
||||
|
||||
package main
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build go1.16 && (linux || darwin)
|
||||
// +build go1.16
|
||||
// +build linux darwin
|
||||
|
||||
// Code related to the Build Results API.
|
||||
|
||||
|
@ -13,7 +11,7 @@ package main
|
|||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
@ -77,7 +75,7 @@ func (g *gRPCServer) clearFromDashboard(ctx context.Context, builder, hash, key
|
|||
log.Printf("gRPCServer.ClearResults: error performing wipe for %q/%q: %v", builder, hash, err)
|
||||
return grpcstatus.Error(codes.Internal, codes.Internal.String())
|
||||
}
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
resp.Body.Close()
|
||||
if err != nil {
|
||||
log.Printf("gRPCServer.ClearResults: error reading response body for %q/%q: %v", builder, hash, err)
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build go1.16 && (linux || darwin)
|
||||
// +build go1.16
|
||||
// +build linux darwin
|
||||
|
||||
package main
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build go1.16 && (linux || darwin)
|
||||
// +build go1.16
|
||||
// +build linux darwin
|
||||
|
||||
package main
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build go1.16 && (linux || darwin)
|
||||
// +build go1.16
|
||||
// +build linux darwin
|
||||
|
||||
package main
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build linux || darwin
|
||||
// +build linux darwin
|
||||
|
||||
package main
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ import (
|
|||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
|
@ -62,7 +61,7 @@ func main() {
|
|||
|
||||
checkDeps()
|
||||
|
||||
mntDir, err := ioutil.TempDir("", "docker2boot")
|
||||
mntDir, err := os.MkdirTemp("", "docker2boot")
|
||||
if err != nil {
|
||||
failf("Failed to create mount temp dir: %v", err)
|
||||
}
|
||||
|
@ -152,7 +151,7 @@ func main() {
|
|||
writeFile(filepath.Join(mntDir, "etc", "resolv.conf"), "nameserver 8.8.8.8\n")
|
||||
|
||||
// Append the source image id & docker version to /etc/issue.
|
||||
issue, err := ioutil.ReadFile("/etc/issue")
|
||||
issue, err := os.ReadFile("/etc/issue")
|
||||
if err != nil && !os.IsNotExist(err) {
|
||||
failf("Failed to read /etc/issue: %v", err)
|
||||
}
|
||||
|
@ -252,7 +251,7 @@ func httpGet(u string) io.Reader {
|
|||
}
|
||||
|
||||
func slurpFile(file string) string {
|
||||
v, err := ioutil.ReadFile(file)
|
||||
v, err := os.ReadFile(file)
|
||||
if err != nil {
|
||||
failf("Failed to read %s: %v", file, err)
|
||||
}
|
||||
|
@ -260,7 +259,7 @@ func slurpFile(file string) string {
|
|||
}
|
||||
|
||||
func writeFile(file, contents string) {
|
||||
if err := ioutil.WriteFile(file, []byte(contents), 0644); err != nil {
|
||||
if err := os.WriteFile(file, []byte(contents), 0644); err != nil {
|
||||
failf("writeFile %s: %v", file, err)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ import (
|
|||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
@ -57,7 +56,7 @@ func getMasterKey() []byte {
|
|||
if err == nil {
|
||||
return []byte(strings.TrimSpace(v))
|
||||
}
|
||||
key, err := ioutil.ReadFile(filepath.Join(os.Getenv("HOME"), "keys/gobuilder-master.key"))
|
||||
key, err := os.ReadFile(filepath.Join(os.Getenv("HOME"), "keys/gobuilder-master.key"))
|
||||
if err == nil {
|
||||
return bytes.TrimSpace(key)
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ import (
|
|||
"crypto/sha1"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
@ -110,7 +109,7 @@ func writeCookiesFile(sc *secret.Client) error {
|
|||
if err != nil {
|
||||
return fmt.Errorf("secret.Retrieve(ctx, %q): %q, %w", secret.NameGerritbotGitCookies, cookies, err)
|
||||
}
|
||||
return ioutil.WriteFile(*gitcookiesFile, []byte(cookies), 0600)
|
||||
return os.WriteFile(*gitcookiesFile, []byte(cookies), 0600)
|
||||
}
|
||||
|
||||
func githubClient(sc *secret.Client) (*github.Client, error) {
|
||||
|
@ -144,7 +143,7 @@ func githubToken(sc *secret.Client) (string, error) {
|
|||
return token, nil
|
||||
}
|
||||
}
|
||||
slurp, err := ioutil.ReadFile(*githubTokenFile)
|
||||
slurp, err := os.ReadFile(*githubTokenFile)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
@ -176,7 +175,7 @@ func gerritAuth(sc *secret.Client) (string, string, error) {
|
|||
}
|
||||
}
|
||||
if len(slurp) == 0 {
|
||||
slurpBytes, err := ioutil.ReadFile(*gerritTokenFile)
|
||||
slurpBytes, err := os.ReadFile(*gerritTokenFile)
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ import (
|
|||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
|
@ -68,7 +67,7 @@ func main() {
|
|||
if err != nil {
|
||||
log.Fatalf("creating cache dir: %v", err)
|
||||
}
|
||||
credsDir, err := ioutil.TempDir("", "gitmirror-credentials")
|
||||
credsDir, err := os.MkdirTemp("", "gitmirror-credentials")
|
||||
if err != nil {
|
||||
log.Fatalf("creating credentials dir: %v", err)
|
||||
}
|
||||
|
@ -136,7 +135,7 @@ func writeCredentials(home string) error {
|
|||
return fmt.Errorf("reading github key from secret manager: %v", err)
|
||||
}
|
||||
privKeyPath := filepath.Join(home, secret.NameGitHubSSHKey)
|
||||
if err := ioutil.WriteFile(privKeyPath, []byte(privKey+"\n"), 0600); err != nil {
|
||||
if err := os.WriteFile(privKeyPath, []byte(privKey+"\n"), 0600); err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Fprintf(sshConfig, "Host github.com\n IdentityFile %v\n", privKeyPath)
|
||||
|
@ -147,10 +146,10 @@ func writeCredentials(home string) error {
|
|||
fmt.Fprintf(gitConfig, "[credential \"https://source.developers.google.com\"]\n helper=gcloud.sh\n")
|
||||
}
|
||||
|
||||
if err := ioutil.WriteFile(filepath.Join(home, ".gitconfig"), gitConfig.Bytes(), 0600); err != nil {
|
||||
if err := os.WriteFile(filepath.Join(home, ".gitconfig"), gitConfig.Bytes(), 0600); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := ioutil.WriteFile(sshConfigPath, sshConfig.Bytes(), 0600); err != nil {
|
||||
if err := os.WriteFile(sshConfigPath, sshConfig.Bytes(), 0600); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -159,7 +158,7 @@ func writeCredentials(home string) error {
|
|||
|
||||
func retrieveSecret(ctx context.Context, name string) (string, error) {
|
||||
if *flagSecretsDir != "" {
|
||||
secret, err := ioutil.ReadFile(filepath.Join(*flagSecretsDir, name))
|
||||
secret, err := os.ReadFile(filepath.Join(*flagSecretsDir, name))
|
||||
return string(secret), err
|
||||
}
|
||||
sc := secret.MustNewClient()
|
||||
|
@ -169,7 +168,7 @@ func retrieveSecret(ctx context.Context, name string) (string, error) {
|
|||
|
||||
func createCacheDir() (string, error) {
|
||||
if *flagCacheDir == "" {
|
||||
dir, err := ioutil.TempDir("", "gitmirror")
|
||||
dir, err := os.MkdirTemp("", "gitmirror")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
@ -467,7 +466,7 @@ func (r *repo) addRemote(name, url, pushOption string) error {
|
|||
remote := "URL: " + url + "\n" +
|
||||
"Push: +refs/heads/*:refs/heads/*\n" +
|
||||
"Push: +refs/tags/*:refs/tags/*\n"
|
||||
return ioutil.WriteFile(filepath.Join(r.root, "remotes", name), []byte(remote), 0777)
|
||||
return os.WriteFile(filepath.Join(r.root, "remotes", name), []byte(remote), 0777)
|
||||
}
|
||||
|
||||
// loop continuously runs "git fetch" in the repo, checks for new
|
||||
|
|
|
@ -6,7 +6,7 @@ package main
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
|
@ -195,7 +195,7 @@ func (tm *testMirror) loopOnce() {
|
|||
|
||||
func (tm *testMirror) commit(content string) {
|
||||
tm.t.Helper()
|
||||
if err := ioutil.WriteFile(filepath.Join(tm.gerrit, "README"), []byte(content), 0777); err != nil {
|
||||
if err := os.WriteFile(filepath.Join(tm.gerrit, "README"), []byte(content), 0777); err != nil {
|
||||
tm.t.Fatal(err)
|
||||
}
|
||||
tm.git(tm.gerrit, "add", ".")
|
||||
|
@ -219,7 +219,7 @@ func (tm *testMirror) get(path string) string {
|
|||
if err != nil {
|
||||
tm.t.Fatal(err)
|
||||
}
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
resp.Body.Close()
|
||||
if err != nil {
|
||||
tm.t.Fatal(err)
|
||||
|
|
|
@ -9,7 +9,6 @@ import (
|
|||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
@ -102,7 +101,7 @@ func writeCertificateToDisk(b []byte) (string, error) {
|
|||
if err := os.MkdirAll(tmpDir, 0700); err != nil {
|
||||
return "", fmt.Errorf("unable to create temp directory for certficates: %w", err)
|
||||
}
|
||||
tf, err := ioutil.TempFile(tmpDir, "id_ed25519-*-cert.pub")
|
||||
tf, err := os.CreateTemp(tmpDir, "id_ed25519-*-cert.pub")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ import (
|
|||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
|
@ -123,7 +122,7 @@ func getGitHubToken(ctx context.Context, sc *secret.Client) (string, error) {
|
|||
return token, nil
|
||||
}
|
||||
}
|
||||
slurp, err := ioutil.ReadFile(*githubTokenFile)
|
||||
slurp, err := os.ReadFile(*githubTokenFile)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
@ -147,7 +146,7 @@ func getGerritAuth(ctx context.Context, sc *secret.Client) (username string, pas
|
|||
}
|
||||
|
||||
var slurpBytes []byte
|
||||
slurpBytes, err = ioutil.ReadFile(*gerritTokenFile)
|
||||
slurpBytes, err = os.ReadFile(*gerritTokenFile)
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ package main
|
|||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
|
@ -141,7 +140,7 @@ func main() {
|
|||
var stripDir string
|
||||
if *flagDashboard {
|
||||
revDir := filepath.Join(xdgCacheDir(), "fetchlogs", "rev")
|
||||
fis, err := ioutil.ReadDir(revDir)
|
||||
fis, err := os.ReadDir(revDir)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "%s: %s\n", revDir, err)
|
||||
os.Exit(1)
|
||||
|
@ -235,7 +234,7 @@ func process(path, nicePath string) (found bool, err error) {
|
|||
}
|
||||
|
||||
// TODO: Use streaming if possible.
|
||||
data, err := ioutil.ReadFile(path)
|
||||
data, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
"hash"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
@ -96,7 +96,7 @@ func validateGithubRequest(w http.ResponseWriter, r *http.Request) (body []byte,
|
|||
return nil, err
|
||||
}
|
||||
|
||||
body, err = ioutil.ReadAll(http.MaxBytesReader(w, r.Body, 5<<20))
|
||||
body, err = io.ReadAll(http.MaxBytesReader(w, r.Body, 5<<20))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@ import (
|
|||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
@ -491,7 +490,7 @@ func (p *Platform) Build(ctx context.Context) error {
|
|||
}
|
||||
|
||||
// Execute the script.
|
||||
script, err := ioutil.TempFile("", "racebuild")
|
||||
script, err := os.CreateTemp("", "racebuild")
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create temp file: %v", err)
|
||||
}
|
||||
|
@ -572,7 +571,7 @@ func (p *Platform) UpdateReadme() error {
|
|||
defer readmeMu.Unlock()
|
||||
|
||||
readmeFile := filepath.Join(*flagGoroot, "src", "runtime", "race", "README")
|
||||
readme, err := ioutil.ReadFile(readmeFile)
|
||||
readme, err := os.ReadFile(readmeFile)
|
||||
if err != nil {
|
||||
log.Fatalf("bad -goroot? %v", err)
|
||||
}
|
||||
|
@ -597,7 +596,7 @@ func (p *Platform) UpdateReadme() error {
|
|||
readme = append(append(readme, []byte(updatedLine)...), '\n')
|
||||
}
|
||||
|
||||
return ioutil.WriteFile(readmeFile, readme, 0640)
|
||||
return os.WriteFile(readmeFile, readme, 0640)
|
||||
}
|
||||
|
||||
func (p *Platform) Gomote(ctx context.Context, args ...string) ([]byte, error) {
|
||||
|
|
|
@ -14,7 +14,6 @@ import (
|
|||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"math/rand"
|
||||
"net/http"
|
||||
|
@ -319,7 +318,7 @@ func publishFile(uploadURL string, auth buildlet.UserPass, f task.WebsiteFile) e
|
|||
}
|
||||
defer resp.Body.Close()
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
b, _ := ioutil.ReadAll(resp.Body)
|
||||
b, _ := io.ReadAll(resp.Body)
|
||||
return fmt.Errorf("upload failed to %q: %v\n%s", uploadURL, resp.Status, b)
|
||||
}
|
||||
return nil
|
||||
|
|
|
@ -24,7 +24,7 @@ import (
|
|||
"encoding/json"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
@ -147,7 +147,7 @@ func foreachFailure(fn func(f Failure, failLog string)) {
|
|||
if err != nil {
|
||||
log.Fatalf("Error fetching %s: %v", f.LogURL, err)
|
||||
}
|
||||
failLog, err := ioutil.ReadAll(res.Body)
|
||||
failLog, err := io.ReadAll(res.Body)
|
||||
res.Body.Close()
|
||||
if err != nil {
|
||||
log.Fatalf("Error reading %s: %v", f.LogURL, err)
|
||||
|
@ -290,7 +290,7 @@ func (c *client) wipe(builder, hash string) {
|
|||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
body, err := ioutil.ReadAll(res.Body)
|
||||
body, err := io.ReadAll(res.Body)
|
||||
res.Body.Close()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -327,7 +327,7 @@ func builderKey(builder string) string {
|
|||
if *keyFile == "" {
|
||||
log.Fatalf("No --key specified for builder %s", builder)
|
||||
}
|
||||
slurp, err := ioutil.ReadFile(*keyFile)
|
||||
slurp, err := os.ReadFile(*keyFile)
|
||||
if err != nil {
|
||||
log.Fatalf("Error reading builder key %s: %v", builder, err)
|
||||
}
|
||||
|
@ -337,7 +337,7 @@ func builderKey(builder string) string {
|
|||
func builderKeyFromMaster(builder string) (key string, ok bool) {
|
||||
masterKey, err := getMasterKeyFromSecretManager()
|
||||
if err != nil {
|
||||
slurp, err := ioutil.ReadFile(*masterKeyFile)
|
||||
slurp, err := os.ReadFile(*masterKeyFile)
|
||||
if err != nil {
|
||||
return "", false
|
||||
}
|
||||
|
@ -380,7 +380,7 @@ func failures() (ret []Failure) {
|
|||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
slurp, err := ioutil.ReadAll(res.Body)
|
||||
slurp, err := io.ReadAll(res.Body)
|
||||
res.Body.Close()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
|
|
@ -14,7 +14,6 @@ import (
|
|||
"encoding/json"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
@ -105,7 +104,7 @@ func onEC2() bool {
|
|||
}
|
||||
|
||||
func getBuildKey() []byte {
|
||||
key, err := ioutil.ReadFile(*keyFile)
|
||||
key, err := os.ReadFile(*keyFile)
|
||||
if err != nil {
|
||||
log.Fatalf("error reading build key from --key=%s: %v", *keyFile, err)
|
||||
}
|
||||
|
@ -187,7 +186,7 @@ func checkFix() error {
|
|||
if err := os.MkdirAll(filepath.Dir(keyFile), 0700); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := ioutil.WriteFile(keyFile, buildKey, 0600); err != nil {
|
||||
if err := os.WriteFile(keyFile, buildKey, 0600); err != nil {
|
||||
return err
|
||||
}
|
||||
cmd := exec.Command("docker", "run",
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build go1.16
|
||||
// +build go1.16
|
||||
|
||||
package main
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build go1.16
|
||||
// +build go1.16
|
||||
|
||||
package main
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build go1.16
|
||||
// +build go1.16
|
||||
|
||||
package main
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build go1.16
|
||||
// +build go1.16
|
||||
|
||||
// Binary runqemubuildlet runs a single VM-based buildlet in a loop.
|
||||
package main
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build go1.16
|
||||
// +build go1.16
|
||||
|
||||
package main
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ import (
|
|||
"crypto/md5"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/http/cookiejar"
|
||||
"net/url"
|
||||
|
@ -102,7 +101,7 @@ func (gitCookiesAuth) setAuth(c *Client, r *http.Request) error {
|
|||
// got so long that old versions of curl couldn't handle them.
|
||||
host := url.Host
|
||||
netrc := netrcPath()
|
||||
data, _ := ioutil.ReadFile(netrc)
|
||||
data, _ := os.ReadFile(netrc)
|
||||
for _, line := range strings.Split(string(data), "\n") {
|
||||
if i := strings.Index(line, "#"); i >= 0 {
|
||||
line = line[:i]
|
||||
|
@ -125,7 +124,7 @@ type gitCookieFileAuth struct {
|
|||
}
|
||||
|
||||
func (a *gitCookieFileAuth) loadCookieFileOnce() {
|
||||
data, err := ioutil.ReadFile(a.file)
|
||||
data, err := os.ReadFile(a.file)
|
||||
if err != nil {
|
||||
a.err = fmt.Errorf("Error loading cookie file: %v", err)
|
||||
return
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build ignore
|
||||
// +build ignore
|
||||
|
||||
// The demo command shows and tests usage of the gerrit package.
|
||||
package main
|
||||
|
@ -11,7 +10,6 @@ package main
|
|||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
@ -22,7 +20,7 @@ import (
|
|||
)
|
||||
|
||||
func main() {
|
||||
gobotPass, err := ioutil.ReadFile(filepath.Join(os.Getenv("HOME"), "keys", "gobot-golang-org.cookie"))
|
||||
gobotPass, err := os.ReadFile(filepath.Join(os.Getenv("HOME"), "keys", "gobot-golang-org.cookie"))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ import (
|
|||
|
||||
"cloud.google.com/go/compute/metadata"
|
||||
secretmanager "cloud.google.com/go/secretmanager/apiv1"
|
||||
"github.com/influxdata/influxdb-client-go/v2"
|
||||
influxdb2 "github.com/influxdata/influxdb-client-go/v2"
|
||||
"github.com/influxdata/influxdb-client-go/v2/domain"
|
||||
"golang.org/x/build/internal/https"
|
||||
"golang.org/x/build/internal/influx"
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build linux || darwin
|
||||
// +build linux darwin
|
||||
|
||||
package pool
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build linux || darwin
|
||||
// +build linux darwin
|
||||
|
||||
package pool
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build linux || darwin
|
||||
// +build linux darwin
|
||||
|
||||
// Code interacting with Google Compute Engine (GCE) and
|
||||
// a GCE implementation of the BuildletPool interface.
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build linux || darwin
|
||||
// +build linux darwin
|
||||
|
||||
package pool
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build linux || darwin
|
||||
// +build linux darwin
|
||||
|
||||
package pool
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build linux || darwin
|
||||
// +build linux darwin
|
||||
|
||||
package pool
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build linux || darwin
|
||||
// +build linux darwin
|
||||
|
||||
package pool
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build linux || darwin
|
||||
// +build linux darwin
|
||||
|
||||
package pool
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build linux || darwin
|
||||
// +build linux darwin
|
||||
|
||||
package pool
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build go1.16 && (linux || darwin)
|
||||
// +build go1.16
|
||||
// +build linux darwin
|
||||
|
||||
package remote
|
||||
|
||||
|
@ -19,7 +17,6 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net"
|
||||
"os"
|
||||
|
@ -330,7 +327,7 @@ func (ss *SSHServer) setupRemoteSSHEnv(bconf *dashboard.BuildConfig, workDir str
|
|||
// WriteSSHPrivateKeyToTempFile writes a key to a temporary file on the local file system. It also
|
||||
// sets the permissions on the file to what is expected by OpenSSH implementations of SSH.
|
||||
func WriteSSHPrivateKeyToTempFile(key []byte) (path string, err error) {
|
||||
tf, err := ioutil.TempFile("", "ssh-priv-key")
|
||||
tf, err := os.CreateTemp("", "ssh-priv-key")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build go1.16 && (linux || darwin)
|
||||
// +build go1.16
|
||||
// +build linux darwin
|
||||
|
||||
package remote
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build linux || darwin
|
||||
// +build linux darwin
|
||||
|
||||
package schedule
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build linux || darwin
|
||||
// +build linux darwin
|
||||
|
||||
package schedule
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build linux || darwin
|
||||
// +build linux darwin
|
||||
|
||||
package schedule
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build linux || darwin
|
||||
// +build linux darwin
|
||||
|
||||
package schedule
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build linux || darwin
|
||||
// +build linux darwin
|
||||
|
||||
package schedule
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ import (
|
|||
"context"
|
||||
"flag"
|
||||
"io/fs"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
@ -82,7 +81,7 @@ func TestDirFSWrite(t *testing.T) {
|
|||
if err := f.Close(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
b, err := ioutil.ReadFile(filepath.Join(temp, "fsystest.txt"))
|
||||
b, err := os.ReadFile(filepath.Join(temp, "fsystest.txt"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ import (
|
|||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
@ -49,7 +48,7 @@ func Init() error {
|
|||
var buf bytes.Buffer
|
||||
fmt.Fprintf(&buf, "go.googlesource.com\tFALSE\t/\tTRUE\t2147483647\to\tgit-gobot.gmail.com=%s\n", slurp)
|
||||
fmt.Fprintf(&buf, "go-review.googlesource.com\tFALSE\t/\tTRUE\t2147483647\to\tgit-gobot.gmail.com=%s\n", slurp)
|
||||
return ioutil.WriteFile(cookieFile, buf.Bytes(), 0644)
|
||||
return os.WriteFile(cookieFile, buf.Bytes(), 0644)
|
||||
}
|
||||
|
||||
func homeDir() string {
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build linux || darwin
|
||||
// +build linux darwin
|
||||
|
||||
package gomote
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build linux || darwin
|
||||
// +build linux darwin
|
||||
|
||||
package gomote
|
||||
|
||||
|
|
|
@ -11,10 +11,11 @@
|
|||
package protos
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -8,6 +8,7 @@ package protos
|
|||
|
||||
import (
|
||||
context "context"
|
||||
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build linux || darwin
|
||||
// +build linux darwin
|
||||
|
||||
package gomote
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build linux || darwin
|
||||
// +build linux darwin
|
||||
|
||||
package gomote
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
package httpdl
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
|
@ -26,7 +25,7 @@ func TestDownload(t *testing.T) {
|
|||
}))
|
||||
defer ts.Close()
|
||||
|
||||
tmpDir, err := ioutil.TempDir("", "dl")
|
||||
tmpDir, err := os.MkdirTemp("", "dl")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
@ -70,7 +69,7 @@ func TestDownload(t *testing.T) {
|
|||
}
|
||||
|
||||
// Also check re-download on size change.
|
||||
ioutil.WriteFile(dstFile, []byte(someContent+someContent), 0644)
|
||||
os.WriteFile(dstFile, []byte(someContent+someContent), 0644)
|
||||
os.Chtimes(dstFile, someTime, someTime)
|
||||
if err := Download(dstFile, ts.URL+"/foo.txt"); err != nil {
|
||||
t.Fatal(err)
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build linux || darwin
|
||||
// +build linux darwin
|
||||
|
||||
package releasetargets
|
||||
|
||||
|
@ -12,7 +11,7 @@ import (
|
|||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"sort"
|
||||
"strings"
|
||||
"testing"
|
||||
|
@ -29,13 +28,13 @@ func TestReleaseTargets(t *testing.T) {
|
|||
printRelease(out, release, TargetsForGo1Point(release))
|
||||
}
|
||||
if *update {
|
||||
if err := ioutil.WriteFile("releases.txt", out.Bytes(), 0); err != nil {
|
||||
if err := os.WriteFile("releases.txt", out.Bytes(), 0); err != nil {
|
||||
t.Fatalf("updating golden: %v", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
golden, err := ioutil.ReadFile("releases.txt")
|
||||
golden, err := os.ReadFile("releases.txt")
|
||||
if err != nil {
|
||||
t.Fatalf("reading golden: %v", err)
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ import (
|
|||
"fmt"
|
||||
"io"
|
||||
"io/fs"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
|
@ -676,7 +675,7 @@ func checkTGZ(t *testing.T, dlURL string, files map[string]task.WebsiteFile, fil
|
|||
if !ok {
|
||||
continue
|
||||
}
|
||||
b, err := ioutil.ReadAll(tr)
|
||||
b, err := io.ReadAll(tr)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
@ -706,7 +705,7 @@ func checkZip(t *testing.T, dlURL string, files map[string]task.WebsiteFile, fil
|
|||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
b, err := ioutil.ReadAll(r)
|
||||
b, err := io.ReadAll(r)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -11,10 +11,11 @@
|
|||
package protos
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -4,6 +4,7 @@ package protos
|
|||
|
||||
import (
|
||||
context "context"
|
||||
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
|
|
|
@ -11,7 +11,6 @@ import (
|
|||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
|
@ -83,7 +82,7 @@ func TestFileServerHandler(t *testing.T) {
|
|||
if resp.StatusCode != c.wantCode {
|
||||
t.Errorf("rep.StatusCode = %d, wanted %d", resp.StatusCode, c.wantCode)
|
||||
}
|
||||
b, err := ioutil.ReadAll(resp.Body)
|
||||
b, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
t.Errorf("resp.Body = _, %v, wanted no error", err)
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"context"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
|
@ -167,7 +167,7 @@ func TestFlag(t *testing.T) {
|
|||
for _, tt := range tests {
|
||||
t.Run(tt.flagVal, func(t *testing.T) {
|
||||
fs := flag.NewFlagSet("", flag.ContinueOnError)
|
||||
fs.SetOutput(ioutil.Discard)
|
||||
fs.SetOutput(io.Discard)
|
||||
flagVal := r.Flag(fs, "testflag", "usage")
|
||||
err := fs.Parse([]string{"--testflag", tt.flagVal})
|
||||
if tt.wantErr {
|
||||
|
@ -214,7 +214,7 @@ func TestJSONFlag(t *testing.T) {
|
|||
for _, tt := range tests {
|
||||
t.Run(tt.flagVal, func(t *testing.T) {
|
||||
fs := flag.NewFlagSet("", flag.ContinueOnError)
|
||||
fs.SetOutput(ioutil.Discard)
|
||||
fs.SetOutput(io.Discard)
|
||||
value := &jsonValue{}
|
||||
r.JSONVarFlag(fs, value, "testflag", "usage")
|
||||
err := fs.Parse([]string{"--testflag", tt.flagVal})
|
||||
|
|
|
@ -13,7 +13,6 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
|
@ -145,11 +144,11 @@ func getSourceTgzFromURL(hc *http.Client, service, repo, rev, url string) (sourc
|
|||
}
|
||||
defer res.Body.Close()
|
||||
if res.StatusCode/100 != 2 {
|
||||
slurp, _ := ioutil.ReadAll(io.LimitReader(res.Body, 4<<10))
|
||||
slurp, _ := io.ReadAll(io.LimitReader(res.Body, 4<<10))
|
||||
return source{}, fmt.Errorf("fetching %s/%s from %s: %v; body: %s", repo, rev, service, res.Status, slurp)
|
||||
}
|
||||
// See golang.org/issue/11224 for a discussion on tree filtering.
|
||||
b, err := ioutil.ReadAll(io.LimitReader(res.Body, maxSize(repo)+1))
|
||||
b, err := io.ReadAll(io.LimitReader(res.Body, maxSize(repo)+1))
|
||||
if int64(len(b)) > maxSize(repo) && err == nil {
|
||||
return source{TooBig: true}, nil
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
|
@ -270,7 +269,7 @@ func (b *fakeBuildlet) GetTar(ctx context.Context, dir string) (io.ReadCloser, e
|
|||
if err := zw.Close(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ioutil.NopCloser(buf), nil
|
||||
return io.NopCloser(buf), nil
|
||||
}
|
||||
|
||||
func (b *fakeBuildlet) ListDir(ctx context.Context, dir string, opts buildlet.ListDirOpts, fn func(buildlet.DirEntry)) error {
|
||||
|
|
|
@ -12,7 +12,6 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
@ -90,7 +89,7 @@ func (c *Client) RunLongLivedPod(ctx context.Context, pod *api.Pod) (*api.PodSta
|
|||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to make request: POST %q: %v", postURL, err)
|
||||
}
|
||||
body, err := ioutil.ReadAll(res.Body)
|
||||
body, err := io.ReadAll(res.Body)
|
||||
res.Body.Close()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to read request body for POST %q: %v", postURL, err)
|
||||
|
@ -142,7 +141,7 @@ func (c *Client) do(ctx context.Context, method, urlStr string, dst interface{})
|
|||
}
|
||||
defer res.Body.Close()
|
||||
if res.StatusCode != http.StatusOK {
|
||||
body, _ := ioutil.ReadAll(res.Body)
|
||||
body, _ := io.ReadAll(res.Body)
|
||||
return fmt.Errorf("%v %s: %v, %s", method, urlStr, res.Status, body)
|
||||
}
|
||||
if dst != nil {
|
||||
|
@ -223,7 +222,7 @@ func (c *Client) DeletePod(ctx context.Context, podName string) error {
|
|||
if err != nil {
|
||||
return fmt.Errorf("failed to make request: DELETE %q: %v", url, err)
|
||||
}
|
||||
body, err := ioutil.ReadAll(res.Body)
|
||||
body, err := io.ReadAll(res.Body)
|
||||
res.Body.Close()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to read response body: DELETE %q: %v", url, err)
|
||||
|
@ -389,7 +388,7 @@ func (c *Client) PodStatus(ctx context.Context, podName string) (*api.PodStatus,
|
|||
return nil, fmt.Errorf("failed to make request: GET %q: %v", getURL, err)
|
||||
}
|
||||
|
||||
body, err := ioutil.ReadAll(res.Body)
|
||||
body, err := io.ReadAll(res.Body)
|
||||
res.Body.Close()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to read request body for GET %q: %v", getURL, err)
|
||||
|
@ -418,7 +417,7 @@ func (c *Client) PodLog(ctx context.Context, podName string) (string, error) {
|
|||
if err != nil {
|
||||
return "", fmt.Errorf("failed to make request: GET %q: %v", url, err)
|
||||
}
|
||||
body, err := ioutil.ReadAll(res.Body)
|
||||
body, err := io.ReadAll(res.Body)
|
||||
res.Body.Close()
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("failed to read response body: GET %q: %v", url, err)
|
||||
|
|
|
@ -8,9 +8,10 @@ import (
|
|||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"sort"
|
||||
|
@ -568,7 +569,7 @@ func TestParseGithubEvents(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestParseMultipleGithubEvents(t *testing.T) {
|
||||
content, err := ioutil.ReadFile(filepath.Join("testdata", "TestParseMultipleGithubEvents.json"))
|
||||
content, err := os.ReadFile(filepath.Join("testdata", "TestParseMultipleGithubEvents.json"))
|
||||
if err != nil {
|
||||
t.Errorf("error while loading testdata: %s\n", err.Error())
|
||||
}
|
||||
|
@ -626,13 +627,13 @@ func (c *ClientMock) Do(req *http.Request) (*http.Response, error) {
|
|||
c.testdata = "TestParseMultipleGithubEvents.json"
|
||||
}
|
||||
timesDoWasCalled++
|
||||
content, _ := ioutil.ReadFile(filepath.Join("testdata", c.testdata))
|
||||
content, _ := os.ReadFile(filepath.Join("testdata", c.testdata))
|
||||
headers := make(http.Header, 0)
|
||||
t := time.Now()
|
||||
var b []byte
|
||||
headers["Date"] = []string{string(t.AppendFormat(b, "Mon Jan _2 15:04:05 2006"))}
|
||||
return &http.Response{
|
||||
Body: ioutil.NopCloser(bytes.NewReader(content)),
|
||||
Body: io.NopCloser(bytes.NewReader(content)),
|
||||
Status: c.status,
|
||||
StatusCode: c.statusCode,
|
||||
Header: headers,
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build windows || darwin
|
||||
// +build windows darwin
|
||||
|
||||
package robustio
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build !windows && !darwin
|
||||
// +build !windows,!darwin
|
||||
|
||||
package robustio
|
||||
|
||||
|
|
|
@ -13,10 +13,11 @@
|
|||
package apipb
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -4,6 +4,7 @@ package apipb
|
|||
|
||||
import (
|
||||
context "context"
|
||||
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
|
|
|
@ -11,7 +11,6 @@ import (
|
|||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
|
@ -327,7 +326,7 @@ func getGithubToken(ctx context.Context) (string, error) {
|
|||
}
|
||||
|
||||
tokenFile := filepath.Join(os.Getenv("HOME"), ".github-issue-token")
|
||||
slurp, err := ioutil.ReadFile(tokenFile)
|
||||
slurp, err := os.ReadFile(tokenFile)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
@ -391,11 +390,11 @@ func syncProdToDevMutationLogs() {
|
|||
|
||||
for name := range want {
|
||||
log.Printf("syncing %s from %s to %s", name, src, dst)
|
||||
slurp, err := ioutil.ReadFile(filepath.Join(src, strings.TrimPrefix(name, "maintner-")))
|
||||
slurp, err := os.ReadFile(filepath.Join(src, strings.TrimPrefix(name, "maintner-")))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if err := ioutil.WriteFile(filepath.Join(dst, name), slurp, 0644); err != nil {
|
||||
if err := os.WriteFile(filepath.Join(dst, name), slurp, 0644); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,10 +35,15 @@ It has these top-level messages:
|
|||
*/
|
||||
package maintpb
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import google_protobuf "github.com/golang/protobuf/ptypes/timestamp"
|
||||
import (
|
||||
fmt "fmt"
|
||||
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
|
||||
math "math"
|
||||
|
||||
google_protobuf "github.com/golang/protobuf/ptypes/timestamp"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче