Skip to content
This repository was archived by the owner on Jul 19, 2023. It is now read-only.

Commit 68fdfa2

Browse files
authored
Bump minimal support version to 1.19 (#531)
* Bump minimal support version to 1.19 * Make lint happy
1 parent 3b273c4 commit 68fdfa2

File tree

13 files changed

+18
-26
lines changed

13 files changed

+18
-26
lines changed

.golangci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33

44
# options for analysis running
55
run:
6-
go: "1.18"
6+
go: "1.19"
77
# default concurrency is a available CPU number
88
concurrency: 16
99

1010
# timeout for analysis, e.g. 30s, 5m, default is 1m
11-
timeout: 5m
11+
timeout: 10m
1212

1313
# exit code when at least one issue was found, default is 1
1414
issues-exit-code: 1

docs/internal/contributing/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ a piece of work is finished it should:
1919

2020
To be able to run make targets you'll need to install:
2121

22-
- [Go](https://go.dev/doc/install) (> 1.18)
22+
- [Go](https://go.dev/doc/install) (> 1.19)
2323
- [Docker](https://docs.docker.com/engine/install/)
2424

2525
All other required tools will be automatically downloaded `$(pwd)/.tmp/bin`.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/grafana/phlare
22

3-
go 1.18
3+
go 1.19
44

55
require (
66
github.com/bufbuild/connect-go v1.4.1

pkg/agent/target.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"fmt"
77
"hash/fnv"
88
"io"
9-
"io/ioutil"
109
"net/http"
1110
"strings"
1211
"sync"
@@ -244,7 +243,7 @@ func (t *Target) fetchProfile(ctx context.Context, profileType string, buf io.Wr
244243
}
245244
defer resp.Body.Close()
246245

247-
b, err := ioutil.ReadAll(io.TeeReader(resp.Body, buf))
246+
b, err := io.ReadAll(io.TeeReader(resp.Body, buf))
248247
if err != nil {
249248
return fmt.Errorf("failed to read body: %w", err)
250249
}

pkg/cfg/cfg_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package cfg
22

33
import (
44
"flag"
5-
"io/ioutil"
65
"os"
76
"testing"
87
"time"
@@ -69,7 +68,7 @@ tls:
6968

7069
func TestDefaultUnmarshal(t *testing.T) {
7170
testContext := func(yamlString string, args []string) TestConfigWrapper {
72-
file, err := ioutil.TempFile("", "config.yaml")
71+
file, err := os.CreateTemp("", "config.yaml")
7372
defer func() {
7473
os.Remove(file.Name())
7574
}()

pkg/cfg/dynamic_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package cfg
22

33
import (
44
"flag"
5-
"io/ioutil"
5+
"os"
66
"testing"
77
"time"
88

@@ -21,7 +21,7 @@ server:
2121
data := NewDynamicConfig(mockApplyDynamicConfig)
2222
fs := flag.NewFlagSet(t.Name(), flag.PanicOnError)
2323

24-
file, err := ioutil.TempFile("", "config.yaml")
24+
file, err := os.CreateTemp("", "config.yaml")
2525
require.NoError(t, err)
2626
_, err = file.WriteString(config)
2727
require.NoError(t, err)

pkg/cfg/files.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"encoding/json"
55
"flag"
66
"fmt"
7-
"io/ioutil"
87
"os"
98
"strconv"
109

@@ -20,7 +19,7 @@ func JSON(f *string) Source {
2019
return nil
2120
}
2221

23-
j, err := ioutil.ReadFile(*f)
22+
j, err := os.ReadFile(*f)
2423
if err != nil {
2524
return err
2625
}
@@ -42,7 +41,7 @@ func dJSON(y []byte) Source {
4241
// using https://pkg.go.dev/github.com/drone/envsubst?tab=overview
4342
func YAML(f string, expandEnvVars bool) Source {
4443
return func(dst Cloneable) error {
45-
y, err := ioutil.ReadFile(f)
44+
y, err := os.ReadFile(f)
4645
if err != nil {
4746
return err
4847
}

pkg/phlaredb/block/metadata.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"encoding/json"
55
"fmt"
66
"io"
7-
"io/ioutil"
87
"math"
98
"math/rand"
109
"os"
@@ -229,7 +228,7 @@ func ReadFromDir(dir string) (*Meta, error) {
229228
}
230229

231230
func exhaustCloseWithErrCapture(err *error, r io.ReadCloser, format string) {
232-
_, copyErr := io.Copy(ioutil.Discard, r)
231+
_, copyErr := io.Copy(io.Discard, r)
233232

234233
runutil.CloseWithErrCapture(err, r, format)
235234

pkg/phlaredb/phlaredb_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"context"
66
"fmt"
77
"io/fs"
8-
"io/ioutil"
98
"net/http"
109
"os"
1110
"strings"
@@ -38,7 +37,7 @@ import (
3837
func TestCreateLocalDir(t *testing.T) {
3938
dataPath := t.TempDir()
4039
localFile := dataPath + "/local"
41-
require.NoError(t, ioutil.WriteFile(localFile, []byte("d"), 0o644))
40+
require.NoError(t, os.WriteFile(localFile, []byte("d"), 0o644))
4241
_, err := New(context.Background(), Config{
4342
DataPath: dataPath,
4443
MaxBlockDuration: 30 * time.Minute,

pkg/phlaredb/shipper/shipper.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ package shipper
1111
import (
1212
"context"
1313
"encoding/json"
14-
"io/ioutil"
1514
"math"
1615
"os"
1716
"path"
@@ -369,7 +368,7 @@ func WriteMetaFile(logger log.Logger, dir string, meta *Meta) error {
369368

370369
// ReadMetaFile reads the given meta from <dir>/shipper.json.
371370
func ReadMetaFile(dir string) (*Meta, error) {
372-
b, err := ioutil.ReadFile(filepath.Join(dir, filepath.Clean(MetaFilename)))
371+
b, err := os.ReadFile(filepath.Join(dir, filepath.Clean(MetaFilename)))
373372
if err != nil {
374373
return nil, err
375374
}

0 commit comments

Comments
 (0)