Skip to content

Commit 790446e

Browse files
authored
Run new Go tool 'go fix' on non-codegen files (#3337)
* Run new Go tool 'go fix' on non-codegen files * Add changelog
1 parent e64a7d0 commit 790446e

File tree

99 files changed

+319
-328
lines changed

Some content is hidden

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

99 files changed

+319
-328
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"id": "b3378a34-ab4e-46e5-aa2c-9d8835a2cabb",
3+
"type": "bugfix",
4+
"collapse": true,
5+
"description": "Modernize non codegen files with go fix",
6+
"modules": [
7+
"aws/protocol/eventstream",
8+
"config",
9+
"feature/cloudfront/sign",
10+
"feature/dynamodb/expression",
11+
"feature/ec2/imds",
12+
"feature/s3/manager",
13+
"feature/s3/transfermanager",
14+
"internal/codegen",
15+
"internal/configsources",
16+
"internal/endpoints/v2",
17+
"internal/ini",
18+
"internal/v4a",
19+
"service/bedrockruntime/internal/testing",
20+
"service/dynamodb",
21+
"service/internal/checksum",
22+
"service/internal/endpoint-discovery",
23+
"service/internal/integrationtest",
24+
"service/internal/presigned-url",
25+
"service/internal/s3shared",
26+
"service/kinesis/internal/testing",
27+
"service/s3",
28+
"service/s3control",
29+
"service/sqs",
30+
"service/transcribestreaming/internal/testing"
31+
]
32+
}

aws/protocol/eventstream/debug.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ type decodedHeaders Headers
8282

8383
func (hs *decodedHeaders) UnmarshalJSON(b []byte) error {
8484
var jsonHeaders []struct {
85-
Name string `json:"name"`
86-
Type valueType `json:"type"`
87-
Value interface{} `json:"value"`
85+
Name string `json:"name"`
86+
Type valueType `json:"type"`
87+
Value any `json:"value"`
8888
}
8989

9090
decoder := json.NewDecoder(bytes.NewReader(b))
@@ -106,7 +106,7 @@ func (hs *decodedHeaders) UnmarshalJSON(b []byte) error {
106106
return nil
107107
}
108108

109-
func valueFromType(typ valueType, val interface{}) (Value, error) {
109+
func valueFromType(typ valueType, val any) (Value, error) {
110110
switch typ {
111111
case trueValueType:
112112
return BoolValue(true), nil

aws/protocol/eventstream/decode_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ func TestDecoder_DecodeMultipleMessages(t *testing.T) {
105105
)
106106

107107
r := bytes.NewBuffer(nil)
108-
for i := 0; i < expectMsgCount; i++ {
108+
for range expectMsgCount {
109109
r.Write(testEncodedMsg)
110110
}
111111

aws/protocol/eventstream/encode.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ func EncodeHeaders(w io.Writer, headers Headers) error {
157157
return nil
158158
}
159159

160-
func binaryWriteFields(w io.Writer, order binary.ByteOrder, vs ...interface{}) error {
160+
func binaryWriteFields(w io.Writer, order binary.ByteOrder, vs ...any) error {
161161
for _, v := range vs {
162162
if err := binary.Write(w, order, v); err != nil {
163163
return err

aws/protocol/eventstream/encode_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func TestEncoder_Limits(t *testing.T) {
6464
}
6565

6666
headers := make(Headers, 0, 10_000) // Previously we failed if headers size was above a certain size
67-
for i := 0; i < 10_000; i++ {
67+
for range 10_000 {
6868
headers = append(headers, h)
6969
}
7070

aws/protocol/eventstream/error.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ type LengthError struct {
77
Part string
88
Want int
99
Have int
10-
Value interface{}
10+
Value any
1111
}
1212

1313
func (e LengthError) Error() string {

aws/protocol/eventstream/header.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func (hs *Headers) Set(name string, value Value) {
3434
// Get returns the Value associated with the header. Nil is returned if the
3535
// value does not exist.
3636
func (hs Headers) Get(name string) Value {
37-
for i := 0; i < len(hs); i++ {
37+
for i := range hs {
3838
if h := hs[i]; h.Name == name {
3939
return h.Value
4040
}

aws/protocol/eventstream/header_value.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ type rawValue struct {
6262
Value []byte // byte representation of value, BigEndian encoding.
6363
}
6464

65-
func (r rawValue) encodeScalar(w io.Writer, v interface{}) error {
65+
func (r rawValue) encodeScalar(w io.Writer, v any) error {
6666
return binaryWriteFields(w, binary.BigEndian,
6767
r.Type,
6868
v,
@@ -158,7 +158,7 @@ func decodeStringValue(r io.Reader) (string, error) {
158158

159159
// Value represents the abstract header value.
160160
type Value interface {
161-
Get() interface{}
161+
Get() any
162162
String() string
163163
valueType() valueType
164164
encode(io.Writer) error
@@ -169,7 +169,7 @@ type Value interface {
169169
type BoolValue bool
170170

171171
// Get returns the underlying type
172-
func (v BoolValue) Get() interface{} {
172+
func (v BoolValue) Get() any {
173173
return bool(v)
174174
}
175175

@@ -196,7 +196,7 @@ func (v BoolValue) encode(w io.Writer) error {
196196
type Int8Value int8
197197

198198
// Get returns the underlying value.
199-
func (v Int8Value) Get() interface{} {
199+
func (v Int8Value) Get() any {
200200
return int8(v)
201201
}
202202

@@ -234,7 +234,7 @@ func (v *Int8Value) decode(r io.Reader) error {
234234
type Int16Value int16
235235

236236
// Get returns the underlying value.
237-
func (v Int16Value) Get() interface{} {
237+
func (v Int16Value) Get() any {
238238
return int16(v)
239239
}
240240

@@ -271,7 +271,7 @@ func (v *Int16Value) decode(r io.Reader) error {
271271
type Int32Value int32
272272

273273
// Get returns the underlying value.
274-
func (v Int32Value) Get() interface{} {
274+
func (v Int32Value) Get() any {
275275
return int32(v)
276276
}
277277

@@ -308,7 +308,7 @@ func (v *Int32Value) decode(r io.Reader) error {
308308
type Int64Value int64
309309

310310
// Get returns the underlying value.
311-
func (v Int64Value) Get() interface{} {
311+
func (v Int64Value) Get() any {
312312
return int64(v)
313313
}
314314

@@ -345,7 +345,7 @@ func (v *Int64Value) decode(r io.Reader) error {
345345
type BytesValue []byte
346346

347347
// Get returns the underlying value.
348-
func (v BytesValue) Get() interface{} {
348+
func (v BytesValue) Get() any {
349349
return []byte(v)
350350
}
351351

@@ -383,7 +383,7 @@ func (v *BytesValue) decode(r io.Reader) error {
383383
type StringValue string
384384

385385
// Get returns the underlying value.
386-
func (v StringValue) Get() interface{} {
386+
func (v StringValue) Get() any {
387387
return string(v)
388388
}
389389

@@ -421,7 +421,7 @@ func (v *StringValue) decode(r io.Reader) error {
421421
type TimestampValue time.Time
422422

423423
// Get returns the underlying value.
424-
func (v TimestampValue) Get() interface{} {
424+
func (v TimestampValue) Get() any {
425425
return time.Time(v)
426426
}
427427

@@ -478,7 +478,7 @@ func timeFromEpochMilli(t int64) time.Time {
478478
type UUIDValue [16]byte
479479

480480
// Get returns the underlying value.
481-
func (v UUIDValue) Get() interface{} {
481+
func (v UUIDValue) Get() any {
482482
return v[:]
483483
}
484484

aws/protocol/eventstream/header_value_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"time"
1010
)
1111

12-
func binWrite(v interface{}) []byte {
12+
func binWrite(v any) []byte {
1313
var w bytes.Buffer
1414
binary.Write(&w, binary.BigEndian, v)
1515
return w.Bytes()

config/config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ var defaultAWSConfigResolvers = []awsConfigResolver{
103103
//
104104
// General the Config type will use type assertion against the Provider interfaces
105105
// to extract specific data from the Config.
106-
type Config interface{}
106+
type Config any
107107

108108
// A loader is used to load external configuration data and returns it as
109109
// a generic Config type.
@@ -170,8 +170,8 @@ func (cs configs) ResolveAWSConfig(ctx context.Context, resolvers []awsConfigRes
170170

171171
// ResolveConfig calls the provide function passing slice of configuration sources.
172172
// This implements the aws.ConfigResolver interface.
173-
func (cs configs) ResolveConfig(f func(configs []interface{}) error) error {
174-
var cfgs []interface{}
173+
func (cs configs) ResolveConfig(f func(configs []any) error) error {
174+
var cfgs []any
175175
for i := range cs {
176176
cfgs = append(cfgs, cs[i])
177177
}

0 commit comments

Comments
 (0)