Skip to content

Commit 7fecafc

Browse files
authored
Merge branch 'main' into refactor-reorganize-auth-and-credential
2 parents 82bdb1e + ba36eb5 commit 7fecafc

File tree

18 files changed

+59
-63
lines changed

18 files changed

+59
-63
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ jobs:
4646
go-version: ${{ matrix.go-version }}
4747
check-latest: true
4848
- name: Initialize CodeQL
49-
uses: github/codeql-action/init@v3
49+
uses: github/codeql-action/init@v4
5050
with:
5151
languages: go
5252
- name: Perform CodeQL Analysis
53-
uses: github/codeql-action/analyze@v3
53+
uses: github/codeql-action/analyze@v4

content/file/file.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import (
3939
// bufPool is a pool of byte buffers that can be reused for copying content
4040
// between files.
4141
var bufPool = sync.Pool{
42-
New: func() interface{} {
42+
New: func() any {
4343
// the buffer size should be larger than or equal to 128 KiB
4444
// for performance considerations.
4545
// we choose 1 MiB here so there will be less disk I/O.
@@ -174,7 +174,7 @@ func (s *Store) Close() error {
174174
s.setClosed()
175175

176176
var errs []string
177-
s.tmpFiles.Range(func(name, _ interface{}) bool {
177+
s.tmpFiles.Range(func(name, _ any) bool {
178178
if err := os.Remove(name.(string)); err != nil {
179179
errs = append(errs, err.Error())
180180
}

content/file/file_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func (m *storageMock) Fetch(ctx context.Context, desc ocispec.Descriptor) (io.Re
8282
}
8383

8484
func TestStoreInterface(t *testing.T) {
85-
var store interface{} = &Store{}
85+
var store any = &Store{}
8686
if _, ok := store.(oras.Target); !ok {
8787
t.Error("&Store{} does not conform oras.Target")
8888
}
@@ -2227,7 +2227,7 @@ func TestStore_File_Push_Concurrent(t *testing.T) {
22272227

22282228
concurrency := 64
22292229
eg, egCtx := errgroup.WithContext(ctx)
2230-
for i := 0; i < concurrency; i++ {
2230+
for i := range concurrency {
22312231
eg.Go(func(i int) func() error {
22322232
return func() error {
22332233
if err := s.Push(egCtx, desc, bytes.NewReader(content)); err != nil {
@@ -2296,7 +2296,7 @@ func TestStore_File_Fetch_Concurrent(t *testing.T) {
22962296
concurrency := 64
22972297
eg, egCtx := errgroup.WithContext(ctx)
22982298

2299-
for i := 0; i < concurrency; i++ {
2299+
for i := range concurrency {
23002300
eg.Go(func(i int) func() error {
23012301
return func() error {
23022302
rc, err := s.Fetch(egCtx, desc)

content/memory/memory_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import (
4040
)
4141

4242
func TestStoreInterface(t *testing.T) {
43-
var store interface{} = &Store{}
43+
var store any = &Store{}
4444
if _, ok := store.(oras.Target); !ok {
4545
t.Error("&Store{} does not conform oras.Target")
4646
}

content/oci/oci_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func (t *storageTracker) Exists(ctx context.Context, target ocispec.Descriptor)
7070
}
7171

7272
func TestStoreInterface(t *testing.T) {
73-
var store interface{} = &Store{}
73+
var store any = &Store{}
7474
if _, ok := store.(oras.GraphTarget); !ok {
7575
t.Error("&Store{} does not conform oras.Target")
7676
}

content/oci/readonlyoci_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import (
4242
)
4343

4444
func TestReadonlyStoreInterface(t *testing.T) {
45-
var store interface{} = &ReadOnlyStore{}
45+
var store any = &ReadOnlyStore{}
4646
if _, ok := store.(oras.ReadOnlyGraphTarget); !ok {
4747
t.Error("&ReadOnlyStore{} does not conform oras.ReadOnlyGraphTarget")
4848
}

content/oci/storage.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import (
3333
// bufPool is a pool of byte buffers that can be reused for copying content
3434
// between files.
3535
var bufPool = sync.Pool{
36-
New: func() interface{} {
36+
New: func() any {
3737
// the buffer size should be larger than or equal to 128 KiB
3838
// for performance considerations.
3939
// we choose 1 MiB here so there will be less disk I/O.

content/oci/storage_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ func TestStorage_Push_Concurrent(t *testing.T) {
232232

233233
concurrency := 64
234234
eg, egCtx := errgroup.WithContext(ctx)
235-
for i := 0; i < concurrency; i++ {
235+
for i := range concurrency {
236236
eg.Go(func(i int) func() error {
237237
return func() error {
238238
if err := s.Push(egCtx, desc, bytes.NewReader(content)); err != nil {
@@ -346,7 +346,7 @@ func TestStorage_Fetch_Concurrent(t *testing.T) {
346346
concurrency := 64
347347
eg, egCtx := errgroup.WithContext(ctx)
348348

349-
for i := 0; i < concurrency; i++ {
349+
for i := range concurrency {
350350
eg.Go(func(i int) func() error {
351351
return func() error {
352352
rc, err := s.Fetch(egCtx, desc)

internal/cas/memory.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func (m *Memory) Exists(_ context.Context, target ocispec.Descriptor) (bool, err
8080
// necessarily correspond to any consistent snapshot of the storage contents.
8181
func (m *Memory) Map() map[descriptor.Descriptor][]byte {
8282
res := make(map[descriptor.Descriptor][]byte)
83-
m.content.Range(func(key, value interface{}) bool {
83+
m.content.Range(func(key, value any) bool {
8484
res[key.(descriptor.Descriptor)] = value.([]byte)
8585
return true
8686
})

internal/syncutil/once.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
// Once is an object that will perform exactly one action.
2525
// Unlike sync.Once, this Once allows the action to have return values.
2626
type Once struct {
27-
result interface{}
27+
result any
2828
err error
2929
status chan bool
3030
}
@@ -46,7 +46,7 @@ func NewOnce() *Once {
4646
// Besides the return value of the function f, including the error, Do returns
4747
// true if the function f passed is called first and is not cancelled, deadline
4848
// exceeded, or panicking. Otherwise, returns false.
49-
func (o *Once) Do(ctx context.Context, f func() (interface{}, error)) (bool, interface{}, error) {
49+
func (o *Once) Do(ctx context.Context, f func() (any, error)) (bool, any, error) {
5050
defer func() {
5151
if r := recover(); r != nil {
5252
o.status <- true

0 commit comments

Comments
 (0)