Skip to content

Commit a4b6d31

Browse files
committed
Fix lint issues
Signed-off-by: Jason Parraga <sovietaced@gmail.com>
1 parent 6cbe2da commit a4b6d31

57 files changed

Lines changed: 111 additions & 191 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/internal/service/app_logs_streamer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func (s *K8sAppLogStreamer) TailLogs(ctx context.Context, replicaID *flyteapp.Re
7777
if err != nil {
7878
return connect.NewError(connect.CodeInternal, fmt.Errorf("failed to stream pod logs: %w", err))
7979
}
80-
defer logStream.Close()
80+
defer logStream.Close() //nolint:errcheck
8181

8282
err = podlogs.Stream(ctx, logStream, podlogs.DefaultBatchSize, func(lines []*dataplane.LogLine) error {
8383
return send(&flyteapp.LogLines{StructuredLines: lines})

app/service/app_logs_service.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func (s *AppLogsService) TailLogs(
3333
if err != nil {
3434
return connect.NewError(connect.CodeInternal, err)
3535
}
36-
defer clientStream.Close()
36+
defer clientStream.Close() //nolint:errcheck
3737
for clientStream.Receive() {
3838
if err := stream.Send(clientStream.Msg()); err != nil {
3939
return err

app/service/app_service.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func (s *AppService) Watch(
142142
if err != nil {
143143
return connect.NewError(connect.CodeInternal, err)
144144
}
145-
defer clientStream.Close()
145+
defer clientStream.Close() //nolint:errcheck
146146
for clientStream.Receive() {
147147
if err := stream.Send(clientStream.Msg()); err != nil {
148148
return err

dataproxy/logs/k8s_log_streamer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func (s *K8sLogStreamer) TailLogs(ctx context.Context, logContext *core.LogConte
8383
if err != nil {
8484
return connect.NewError(connect.CodeInternal, fmt.Errorf("failed to stream pod logs: %w", err))
8585
}
86-
defer logStream.Close()
86+
defer logStream.Close() //nolint:errcheck
8787

8888
err = podlogs.Stream(ctx, logStream, podlogs.DefaultBatchSize, func(lines []*dataplane.LogLine) error {
8989
return stream.Send(&dataproxy.TailLogsResponse{

docker/devbox-bundled/bootstrap/cmd/bootstrap/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func getNodeIP() (string, error) {
3737
// Fallback: scan interfaces for a non-loopback address
3838
return getFirstNonLoopbackIP()
3939
}
40-
defer conn.Close()
40+
defer conn.Close() //nolint:errcheck
4141
localAddr := conn.LocalAddr().(*net.UDPAddr)
4242
return localAddr.IP.String(), nil
4343
}

flytecopilot/cmd/sidecar.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import (
55
"fmt"
66
"time"
77

8-
"github.com/golang/protobuf/proto"
98
"github.com/pkg/errors"
109
"github.com/spf13/cobra"
10+
"google.golang.org/protobuf/proto"
1111

1212
"github.com/flyteorg/flyte/v2/flytecopilot/cmd/containerwatcher"
1313
"github.com/flyteorg/flyte/v2/flytecopilot/data"

flytecopilot/data/download.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ import (
1212
"strconv"
1313
"strings"
1414
"sync"
15+
"time"
1516

1617
"github.com/ghodss/yaml"
17-
"github.com/golang/protobuf/jsonpb"
18-
"github.com/golang/protobuf/proto"
19-
"github.com/golang/protobuf/ptypes"
18+
"github.com/golang/protobuf/jsonpb" //nolint: staticcheck
2019
structpb "github.com/golang/protobuf/ptypes/struct"
2120
"github.com/pkg/errors"
21+
"google.golang.org/protobuf/proto"
2222

2323
"github.com/flyteorg/flyte/v2/flytestdlib/futures"
2424
"github.com/flyteorg/flyte/v2/flytestdlib/logger"
@@ -334,20 +334,20 @@ func (d Downloader) handlePrimitive(primitive *core.Primitive, toFilePath string
334334
return []byte(strconv.FormatFloat(primitive.GetFloatValue(), 'f', -1, 64)), nil
335335
}
336336
case *core.Primitive_Datetime:
337-
v, err = ptypes.Timestamp(primitive.GetDatetime())
337+
v = primitive.GetDatetime().AsTime()
338338
if err != nil {
339339
return nil, err
340340
}
341341
toByteArray = func() ([]byte, error) {
342-
return []byte(ptypes.TimestampString(primitive.GetDatetime())), nil
342+
return []byte(primitive.GetDatetime().AsTime().Format(time.RFC3339Nano)), nil
343343
}
344344
case *core.Primitive_Duration:
345-
v, err := ptypes.Duration(primitive.GetDuration())
345+
v = primitive.GetDuration().AsDuration()
346346
if err != nil {
347347
return nil, err
348348
}
349349
toByteArray = func() ([]byte, error) {
350-
return []byte(v.String()), nil
350+
return []byte(primitive.GetDuration().AsDuration().String()), nil
351351
}
352352
default:
353353
v = nil

flytecopilot/data/upload.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@ import (
44
"context"
55
"fmt"
66
"io"
7-
"io/ioutil"
87
"os"
98
"path"
109
"path/filepath"
1110
"reflect"
1211

13-
"github.com/golang/protobuf/proto"
1412
"github.com/pkg/errors"
13+
"google.golang.org/protobuf/proto"
1514

1615
"github.com/flyteorg/flyte/v2/flyteidl2/clients/go/coreutils"
1716
"github.com/flyteorg/flyte/v2/flytestdlib/futures"
@@ -49,7 +48,7 @@ func (u Uploader) handleSimpleType(_ context.Context, t core.SimpleType, filePat
4948
if info.Size() > maxPrimitiveSize {
5049
return nil, fmt.Errorf("maximum allowed filesize is [%d], but found [%d]", maxPrimitiveSize, info.Size())
5150
}
52-
b, err := ioutil.ReadFile(fpath)
51+
b, err := os.ReadFile(fpath)
5352
if err != nil {
5453
return nil, err
5554
}
@@ -128,7 +127,7 @@ func (u Uploader) RecursiveUpload(ctx context.Context, vars *core.VariableMap, f
128127
} else if info.IsDir() {
129128
return fmt.Errorf("error file is a directory")
130129
} else {
131-
b, err := ioutil.ReadFile(errFile)
130+
b, err := os.ReadFile(errFile)
132131
if err != nil {
133132
return err
134133
}

flyteidl2/clients/go/coreutils/literals.go

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ import (
1111
"strings"
1212
"time"
1313

14-
"github.com/golang/protobuf/jsonpb"
15-
"github.com/golang/protobuf/ptypes"
14+
"github.com/golang/protobuf/jsonpb" //nolint: staticcheck
1615
structpb "github.com/golang/protobuf/ptypes/struct"
1716
"github.com/pkg/errors"
1817
"github.com/shamaton/msgpack/v2"
18+
"google.golang.org/protobuf/types/known/durationpb"
19+
"google.golang.org/protobuf/types/known/timestamppb"
1920

2021
"github.com/flyteorg/flyte/v2/flytestdlib/storage"
2122
"github.com/flyteorg/flyte/v2/gen/go/flyteidl2/core"
@@ -45,17 +46,14 @@ func MakePrimitive(v interface{}) (*core.Primitive, error) {
4546
},
4647
}, nil
4748
case time.Time:
48-
t, err := ptypes.TimestampProto(p)
49-
if err != nil {
50-
return nil, err
51-
}
49+
t := timestamppb.New(p)
5250
return &core.Primitive{
5351
Value: &core.Primitive_Datetime{
5452
Datetime: t,
5553
},
5654
}, nil
5755
case time.Duration:
58-
d := ptypes.DurationProto(p)
56+
d := durationpb.New(p)
5957
return &core.Primitive{
6058
Value: &core.Primitive_Duration{
6159
Duration: d,
@@ -360,16 +358,13 @@ func MakePrimitiveForType(t core.SimpleType, s string) (*core.Primitive, error)
360358
if err != nil {
361359
return nil, errors.Wrap(err, "failed to parse Duration, valid formats: e.g. 300ms, -1.5h, 2h45m")
362360
}
363-
p.Value = &core.Primitive_Duration{Duration: ptypes.DurationProto(v)}
361+
p.Value = &core.Primitive_Duration{Duration: durationpb.New(v)}
364362
case core.SimpleType_DATETIME:
365363
v, err := time.Parse(time.RFC3339, s)
366364
if err != nil {
367365
return nil, errors.Wrap(err, "failed to parse Datetime in RFC3339 format")
368366
}
369-
ts, err := ptypes.TimestampProto(v)
370-
if err != nil {
371-
return nil, errors.Wrap(err, "failed to convert datetime to proto")
372-
}
367+
ts := timestamppb.New(v)
373368
p.Value = &core.Primitive_Datetime{Datetime: ts}
374369
default:
375370
return nil, fmt.Errorf("unsupported type %s", t.String())

flyteplugins/go/tasks/aws/client.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import (
1111
"os"
1212
"sync"
1313

14-
"github.com/aws/aws-sdk-go/aws"
15-
"github.com/aws/aws-sdk-go/aws/credentials"
16-
"github.com/aws/aws-sdk-go/aws/session"
14+
"github.com/aws/aws-sdk-go/aws" //nolint: staticcheck
15+
"github.com/aws/aws-sdk-go/aws/credentials" //nolint: staticcheck
16+
"github.com/aws/aws-sdk-go/aws/session" //nolint: staticcheck
1717

1818
"github.com/flyteorg/flyte/v2/flytestdlib/errors"
1919
"github.com/flyteorg/flyte/v2/flytestdlib/logger"

0 commit comments

Comments
 (0)