all: switch to context package in std lib, remove obsolete +build lines
Done with:
go fix ./...
Using go1.21.0.
Change-Id: I1a672e18186a4af800cd3623f9cb34c81cddd298
Reviewed-on: https://go-review.googlesource.com/c/perf/+/525659
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
diff --git a/analysis/app/appengine.go b/analysis/app/appengine.go
index 5dd35fe..5b2a2d4 100644
--- a/analysis/app/appengine.go
+++ b/analysis/app/appengine.go
@@ -3,14 +3,13 @@
// license that can be found in the LICENSE file.
//go:build appengine
-// +build appengine
package app
import (
+ "context"
"net/http"
- "golang.org/x/net/context"
"google.golang.org/appengine"
"google.golang.org/appengine/log"
)
diff --git a/analysis/app/compare.go b/analysis/app/compare.go
index c686cc7..396de99 100644
--- a/analysis/app/compare.go
+++ b/analysis/app/compare.go
@@ -6,6 +6,7 @@
import (
"bytes"
+ "context"
"errors"
"fmt"
"html/template"
@@ -17,7 +18,6 @@
"strings"
"unicode"
- "golang.org/x/net/context"
"golang.org/x/perf/benchstat"
"golang.org/x/perf/storage/benchfmt"
"golang.org/x/perf/storage/query"
diff --git a/analysis/app/compare_test.go b/analysis/app/compare_test.go
index 2fce9c0..ea48941 100644
--- a/analysis/app/compare_test.go
+++ b/analysis/app/compare_test.go
@@ -5,6 +5,7 @@
package app
import (
+ "context"
"fmt"
"net/http"
"net/http/httptest"
@@ -12,7 +13,6 @@
"strings"
"testing"
- "golang.org/x/net/context"
"golang.org/x/perf/storage"
"golang.org/x/perf/storage/benchfmt"
)
diff --git a/analysis/app/local.go b/analysis/app/local.go
index f34d9f6..e4a0aec 100644
--- a/analysis/app/local.go
+++ b/analysis/app/local.go
@@ -3,15 +3,13 @@
// license that can be found in the LICENSE file.
//go:build !appengine
-// +build !appengine
package app
import (
+ "context"
"log"
"net/http"
-
- "golang.org/x/net/context"
)
// requestContext returns the Context object for a given request.
diff --git a/analysis/app/trend.go b/analysis/app/trend.go
index ad381da..46d1386 100644
--- a/analysis/app/trend.go
+++ b/analysis/app/trend.go
@@ -8,6 +8,7 @@
import (
"bytes"
+ "context"
"encoding/json"
"fmt"
"html/template"
@@ -22,7 +23,6 @@
"github.com/aclements/go-gg/generic/slice"
"github.com/aclements/go-gg/ggstat"
"github.com/aclements/go-gg/table"
- "golang.org/x/net/context"
"golang.org/x/perf/storage"
)
diff --git a/analysis/appengine/app.go b/analysis/appengine/app.go
index 62d3bc4..23a1157 100644
--- a/analysis/appengine/app.go
+++ b/analysis/appengine/app.go
@@ -6,12 +6,12 @@
package main
import (
+ "context"
"log"
"net/http"
"os"
"time"
- "golang.org/x/net/context"
"golang.org/x/perf/analysis/app"
"golang.org/x/perf/storage"
"google.golang.org/appengine"
diff --git a/benchmath/mktables.go b/benchmath/mktables.go
index d377603..e8cc209 100644
--- a/benchmath/mktables.go
+++ b/benchmath/mktables.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build ignore
-// +build ignore
// Mktables pre-computes statistical tables.
package main
diff --git a/storage/app/appengine.go b/storage/app/appengine.go
index a6689e5..a012302 100644
--- a/storage/app/appengine.go
+++ b/storage/app/appengine.go
@@ -3,14 +3,13 @@
// license that can be found in the LICENSE file.
//go:build appengine
-// +build appengine
package app
import (
+ "context"
"net/http"
- "golang.org/x/net/context"
"google.golang.org/appengine"
"google.golang.org/appengine/log"
)
diff --git a/storage/app/local.go b/storage/app/local.go
index 52450c3..d62b7fa 100644
--- a/storage/app/local.go
+++ b/storage/app/local.go
@@ -3,15 +3,13 @@
// license that can be found in the LICENSE file.
//go:build !appengine
-// +build !appengine
package app
import (
+ "context"
"log"
"net/http"
-
- "golang.org/x/net/context"
)
// requestContext returns the Context object for a given request.
diff --git a/storage/app/query_test.go b/storage/app/query_test.go
index f72219a..88a7280 100644
--- a/storage/app/query_test.go
+++ b/storage/app/query_test.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build cgo
-// +build cgo
package app
diff --git a/storage/app/upload.go b/storage/app/upload.go
index 91ccf09..c85de8e 100644
--- a/storage/app/upload.go
+++ b/storage/app/upload.go
@@ -5,6 +5,7 @@
package app
import (
+ "context"
"encoding/json"
"errors"
"fmt"
@@ -17,7 +18,6 @@
"strings"
"time"
- "golang.org/x/net/context"
"golang.org/x/perf/storage/benchfmt"
"golang.org/x/perf/storage/db"
)
diff --git a/storage/app/upload_test.go b/storage/app/upload_test.go
index d06643b..a4a0894 100644
--- a/storage/app/upload_test.go
+++ b/storage/app/upload_test.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build cgo
-// +build cgo
package app
diff --git a/storage/appengine/app.go b/storage/appengine/app.go
index d54302a..e4efdc4 100644
--- a/storage/appengine/app.go
+++ b/storage/appengine/app.go
@@ -6,6 +6,7 @@
package main
import (
+ "context"
"errors"
"fmt"
"log"
@@ -15,7 +16,6 @@
"time"
_ "github.com/go-sql-driver/mysql"
- "golang.org/x/net/context"
"golang.org/x/perf/storage/app"
"golang.org/x/perf/storage/db"
"golang.org/x/perf/storage/fs/gcs"
diff --git a/storage/client.go b/storage/client.go
index 12d6ce2..2baa09f 100644
--- a/storage/client.go
+++ b/storage/client.go
@@ -8,6 +8,7 @@
package storage
import (
+ "context"
"encoding/json"
"fmt"
"io"
@@ -15,7 +16,6 @@
"net/http"
"net/url"
- "golang.org/x/net/context"
"golang.org/x/net/context/ctxhttp"
"golang.org/x/perf/storage/benchfmt"
)
diff --git a/storage/client_test.go b/storage/client_test.go
index d740444..d504525 100644
--- a/storage/client_test.go
+++ b/storage/client_test.go
@@ -6,6 +6,7 @@
import (
"bytes"
+ "context"
"fmt"
"io"
"net/http"
@@ -13,7 +14,6 @@
"reflect"
"testing"
- "golang.org/x/net/context"
"golang.org/x/perf/internal/diff"
"golang.org/x/perf/storage/benchfmt"
)
diff --git a/storage/db/db.go b/storage/db/db.go
index 1d92d24..cf14ad3 100644
--- a/storage/db/db.go
+++ b/storage/db/db.go
@@ -8,6 +8,7 @@
import (
"bytes"
+ "context"
"database/sql"
"fmt"
"io"
@@ -18,7 +19,6 @@
"text/template"
"time"
- "golang.org/x/net/context"
"golang.org/x/perf/storage"
"golang.org/x/perf/storage/benchfmt"
"golang.org/x/perf/storage/query"
diff --git a/storage/db/db_test.go b/storage/db/db_test.go
index f107a27..73561fe 100644
--- a/storage/db/db_test.go
+++ b/storage/db/db_test.go
@@ -3,12 +3,12 @@
// license that can be found in the LICENSE file.
//go:build cgo
-// +build cgo
package db_test
import (
"bytes"
+ "context"
"fmt"
"reflect"
"sort"
@@ -17,7 +17,6 @@
"testing"
"time"
- "golang.org/x/net/context"
"golang.org/x/perf/internal/diff"
"golang.org/x/perf/storage/benchfmt"
. "golang.org/x/perf/storage/db"
diff --git a/storage/db/dbtest/cloud.go b/storage/db/dbtest/cloud.go
index 2f344aa..c6e9ef4 100644
--- a/storage/db/dbtest/cloud.go
+++ b/storage/db/dbtest/cloud.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build cloud && !plan9
-// +build cloud,!plan9
package dbtest
diff --git a/storage/db/dbtest/dbtest.go b/storage/db/dbtest/dbtest.go
index 4ebef55..4f9d00e 100644
--- a/storage/db/dbtest/dbtest.go
+++ b/storage/db/dbtest/dbtest.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build cgo
-// +build cgo
package dbtest
diff --git a/storage/db/dbtest/nocloud.go b/storage/db/dbtest/nocloud.go
index 3e14efd..3322d48 100644
--- a/storage/db/dbtest/nocloud.go
+++ b/storage/db/dbtest/nocloud.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build !cloud && !plan9
-// +build !cloud,!plan9
package dbtest
diff --git a/storage/db/sqlite3/sqlite3.go b/storage/db/sqlite3/sqlite3.go
index 2b28f9f..c9d91fd 100644
--- a/storage/db/sqlite3/sqlite3.go
+++ b/storage/db/sqlite3/sqlite3.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build cgo
-// +build cgo
// Package sqlite3 provides the sqlite3 driver for
// x/perf/storage/db. It must be imported instead of go-sqlite3 to
diff --git a/storage/fs/fs.go b/storage/fs/fs.go
index a2639b4..b413c2e 100644
--- a/storage/fs/fs.go
+++ b/storage/fs/fs.go
@@ -7,12 +7,11 @@
package fs
import (
+ "context"
"errors"
"io"
"sort"
"sync"
-
- "golang.org/x/net/context"
)
// An FS stores uploaded benchmark data files.
diff --git a/storage/fs/gcs/gcs.go b/storage/fs/gcs/gcs.go
index 60a12e4..c70933b 100644
--- a/storage/fs/gcs/gcs.go
+++ b/storage/fs/gcs/gcs.go
@@ -6,8 +6,9 @@
package gcs
import (
+ "context"
+
"cloud.google.com/go/storage"
- "golang.org/x/net/context"
"golang.org/x/perf/storage/fs"
)
diff --git a/storage/fs/local/local.go b/storage/fs/local/local.go
index 650e6e3..5d96e92 100644
--- a/storage/fs/local/local.go
+++ b/storage/fs/local/local.go
@@ -8,10 +8,10 @@
package local
import (
+ "context"
"os"
"path/filepath"
- "golang.org/x/net/context"
"golang.org/x/perf/storage/fs"
)
diff --git a/storage/localperfdata/app.go b/storage/localperfdata/app.go
index 691274b..4d81bdd 100644
--- a/storage/localperfdata/app.go
+++ b/storage/localperfdata/app.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build cgo
-// +build cgo
// Localperfdata runs an HTTP server for benchmark storage.
//