diff --git a/go.mod b/go.mod index 5d828bf0935..36433599656 100644 --- a/go.mod +++ b/go.mod @@ -74,7 +74,6 @@ require ( go.etcd.io/etcd/client/pkg/v3 v3.5.7 go.etcd.io/etcd/client/v3 v3.5.7 golang.org/x/crypto v0.5.0 // indirect - golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 golang.org/x/mod v0.7.0 // indirect golang.org/x/net v0.7.0 golang.org/x/oauth2 v0.4.0 @@ -95,7 +94,6 @@ require ( gopkg.in/ldap.v2 v2.5.1 gopkg.in/warnings.v0 v0.1.2 // indirect gotest.tools v2.2.0+incompatible - honnef.co/go/tools v0.3.3 k8s.io/apiextensions-apiserver v0.18.19 k8s.io/apimachinery v0.26.1 k8s.io/client-go v0.26.1 @@ -121,7 +119,6 @@ require ( cloud.google.com/go/compute v1.18.0 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect cloud.google.com/go/iam v0.10.0 // indirect - github.com/BurntSushi/toml v1.2.1 // indirect github.com/DataDog/datadog-agent/pkg/obfuscate v0.42.0 // indirect github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.42.0 // indirect github.com/DataDog/datadog-go/v5 v5.2.0 // indirect @@ -191,7 +188,6 @@ require ( go.uber.org/zap v1.23.0 // indirect go4.org/intern v0.0.0-20220617035311-6925f38cc365 // indirect go4.org/unsafe/assume-no-moving-gc v0.0.0-20220617031537-928513b29760 // indirect - golang.org/x/exp/typeparams v0.0.0-20230131160201-f062dba9d201 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/appengine v1.6.7 // indirect gopkg.in/inf.v0 v0.9.1 // indirect diff --git a/go.sum b/go.sum index dd2a817d188..caa6b8b418b 100644 --- a/go.sum +++ b/go.sum @@ -74,8 +74,6 @@ github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbt github.com/Azure/go-autorest/tracing v0.6.0 h1:TYi4+3m5t6K48TGI9AUdb+IzbnSxvnvUMfuitfgcfuo= github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/toml v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak= -github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DataDog/datadog-agent/pkg/obfuscate v0.42.0 h1:p9uCmbyi4gEbJAOLoT/GjIAQMGe3velLmiC3mMgSIy4= github.com/DataDog/datadog-agent/pkg/obfuscate v0.42.0/go.mod h1:7Bsrm5U8/B+B8dffT3t733tDvdCr7upqIPSVuDqJ0Mw= @@ -859,8 +857,6 @@ golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EH golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20230131160201-f062dba9d201 h1:BEABXpNXLEz0WxtA+6CQIz2xkg80e+1zrhWyMcq8VzE= golang.org/x/exp v0.0.0-20230131160201-f062dba9d201/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= -golang.org/x/exp/typeparams v0.0.0-20230131160201-f062dba9d201 h1:O1QcdQUR9htWjzzsXVFPX+RJ3n1P/u/5bsQR8dbs5BY= -golang.org/x/exp/typeparams v0.0.0-20230131160201-f062dba9d201/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -874,8 +870,6 @@ golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRu golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 h1:VLliZ0d+/avPrXXH+OakdXhpJuEoBZuwh1m2j7U6Iug= -golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= @@ -1320,8 +1314,6 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.3.3 h1:oDx7VAwstgpYpb3wv0oxiZlxY+foCpRAwY7Vk6XpAgA= -honnef.co/go/tools v0.3.3/go.mod h1:jzwdWgg7Jdq75wlfblQxO4neNaFFSvgc1tD5Wv8U0Yw= inet.af/netaddr v0.0.0-20220811202034-502d2d690317 h1:U2fwK6P2EqmopP/hFLTOAjWTki0qgd4GMJn5X8wOleU= inet.af/netaddr v0.0.0-20220811202034-502d2d690317/go.mod h1:OIezDfdzOgFhuw4HuWapWq2e9l0H9tK4F1j+ETRtF3k= k8s.io/api v0.18.19/go.mod h1:lmViaHqL3es8JiaK3pCJMjBKm2CnzIcAXpHKifwbmAg= diff --git a/tools/statsd.go b/tools/statsd.go deleted file mode 100644 index e823ad6d5c8..00000000000 --- a/tools/statsd.go +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright 2019 The Vitess Authors. - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// statsd is a simple server for hosting test.go remote stats. -package main - -import ( - "encoding/json" - "log" - "net/http" - "os" - "strconv" - "sync" - "time" -) - -var mu sync.Mutex - -const statsFileName = "stats.json" - -func main() { - http.HandleFunc("/travis/stats", func(w http.ResponseWriter, r *http.Request) { - if r.Method == "POST" { - test := r.FormValue("test") - result := r.FormValue("result") - - if test == "" || result == "" { - return - } - - switch result { - case "pass": - duration := r.FormValue("duration") - if duration == "" { - return - } - dur, err := time.ParseDuration(duration) - if err != nil { - return - } - testPassed(test, dur) - case "fail": - testFailed(test) - case "flake": - try := r.FormValue("try") - if try == "" { - return - } - i, err := strconv.ParseInt(try, 10, 64) - if err != nil { - return - } - testFlaked(test, int(i)) - } - - return - } - - http.ServeFile(w, r, statsFileName) - }) - - http.ListenAndServe(":15123", nil) -} - -type Stats struct { - TestStats map[string]TestStats -} - -type TestStats struct { - Pass, Fail, Flake int - PassTime time.Duration -} - -func testPassed(name string, passTime time.Duration) { - updateTestStats(name, func(ts *TestStats) { - totalTime := int64(ts.PassTime)*int64(ts.Pass) + int64(passTime) - ts.Pass++ - ts.PassTime = time.Duration(totalTime / int64(ts.Pass)) - }) -} - -func testFailed(name string) { - updateTestStats(name, func(ts *TestStats) { - ts.Fail++ - }) -} - -func testFlaked(name string, try int) { - updateTestStats(name, func(ts *TestStats) { - ts.Flake += try - 1 - }) -} - -func updateTestStats(name string, update func(*TestStats)) { - var stats Stats - - mu.Lock() - defer mu.Unlock() - - data, err := os.ReadFile(statsFileName) - if err != nil { - log.Print("Can't read stats file, starting new one.") - } else { - if err := json.Unmarshal(data, &stats); err != nil { - log.Printf("Can't parse stats file: %v", err) - return - } - } - - if stats.TestStats == nil { - stats.TestStats = make(map[string]TestStats) - } - ts := stats.TestStats[name] - update(&ts) - stats.TestStats[name] = ts - - data, err = json.MarshalIndent(stats, "", "\t") - if err != nil { - log.Printf("Can't encode stats file: %v", err) - return - } - if err := os.WriteFile(statsFileName, data, 0644); err != nil { - log.Printf("Can't write stats file: %v", err) - } -} diff --git a/tools/tools.go b/tools/tools.go index 56eaa05c2ed..68a97b603f6 100644 --- a/tools/tools.go +++ b/tools/tools.go @@ -22,15 +22,9 @@ package tools // These imports ensure that "go mod tidy" won't remove deps // for build-time dependencies like linters and code generators import ( - _ "github.com/golang/mock/mockgen" _ "github.com/planetscale/vtprotobuf/cmd/protoc-gen-go-vtproto" - _ "golang.org/x/lint" - _ "golang.org/x/tools/cmd/cover" - _ "golang.org/x/tools/cmd/goimports" - _ "golang.org/x/tools/cmd/goyacc" _ "google.golang.org/grpc/cmd/protoc-gen-go-grpc" _ "google.golang.org/protobuf/cmd/protoc-gen-go" - _ "honnef.co/go/tools/cmd/staticcheck" _ "k8s.io/code-generator/cmd/client-gen" _ "k8s.io/code-generator/cmd/deepcopy-gen" _ "k8s.io/code-generator/cmd/informer-gen"