Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2f97278
add os.Root functionality.
sean9999 May 13, 2025
937bdb2
fix linting problems
sean9999 May 25, 2025
dc4f19e
make CI test use versions >= v1.24
sean9999 Aug 16, 2025
e05e604
build(deps): bump github/codeql-action from 3.29.7 to 3.30.1
dependabot[bot] Sep 5, 2025
b7c472b
build(deps): bump actions/setup-go from 5.5.0 to 6.0.0
dependabot[bot] Sep 4, 2025
42e9af7
build(deps): bump actions/dependency-review-action from 4.7.1 to 4.7.3
dependabot[bot] Aug 27, 2025
1aad120
build(deps): bump actions/checkout from 4.2.2 to 5.0.0
dependabot[bot] Sep 8, 2025
1dab4ea
ci: update ci
sagikazarmark Sep 8, 2025
7efa4c2
chore: update deps
sagikazarmark Sep 8, 2025
946117f
fix spelling
MarkRosemaker Aug 3, 2025
4f7891d
Update afero to v1.15.0
sagikazarmark Sep 8, 2025
83790f7
build(deps): bump github/codeql-action from 3.30.1 to 3.30.5
dependabot[bot] Sep 26, 2025
5163234
build(deps): bump actions/dependency-review-action from 4.7.3 to 4.8.0
dependabot[bot] Sep 26, 2025
494edb2
build(deps): bump ossf/scorecard-action from 2.4.2 to 2.4.3
dependabot[bot] Oct 1, 2025
ba1497f
build(deps): bump github/codeql-action from 3.30.5 to 4.30.8
dependabot[bot] Oct 10, 2025
235e35b
add os.Root functionality.
sean9999 May 13, 2025
4c8ff9e
fix linting problems
sean9999 May 25, 2025
d2c31a6
make CI test use versions >= v1.24
sean9999 Aug 16, 2025
e98f68f
add os.Root functionality.
sean9999 May 13, 2025
e356664
fix linting problems
sean9999 May 25, 2025
798efd6
make CI test use versions >= v1.24
sean9999 Aug 16, 2025
c566ff3
update deps
sean9999 Dec 14, 2025
7c5eab8
update deps
sean9999 Dec 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/analysis-scorecard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false

- name: Run analysis
uses: ossf/scorecard-action@05b42c624433fc40578a4040d5cf5e36ddca8cde # v2.4.2
uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3
with:
results_file: results.sarif
results_format: sarif
Expand All @@ -42,6 +42,6 @@ jobs:
retention-days: 5

- name: Upload results to GitHub Security tab
uses: github/codeql-action/upload-sarif@51f77329afa6477de8c49fc9c7046c15b9a4e79d # v3.29.7
uses: github/codeql-action/upload-sarif@f443b600d91635bebf5b0d9ebc620189c0d6fba5 # v4.30.8
with:
sarif_file: results.sarif
20 changes: 10 additions & 10 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
go: ["1.23", "1.24"]
go: [stable, oldstable, "1.23", "1.24", "1.25"]

steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
go-version: ${{ matrix.go }}

Expand All @@ -42,17 +42,17 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
go-version: "1.24"
go-version: "1.25"

- name: Lint
uses: golangci/golangci-lint-action@1481404843c368bc19ca9406f87d6e0fc97bdcfd # v7.0.0
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
with:
version: v2.0.2
version: v2.4.0

dependency-review:
name: Dependency review
Expand All @@ -61,7 +61,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

- name: Dependency Review
uses: actions/dependency-review-action@da24556b548a50705dd671f47852072ea4c105d9 # v4.7.1
uses: actions/dependency-review-action@56339e523c0409420f6c2c9a2f4292bbb3c07dd3 # v4.8.0
3 changes: 3 additions & 0 deletions afero.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ type Fs interface {

// Chtimes changes the access and modification times of the named file
Chtimes(name string, atime time.Time, mtime time.Time) error

// OpenRoot opens a [Root] if name is a valid subdirectory
OpenRoot(name string) (Root, error)
}

var (
Expand Down
9 changes: 9 additions & 0 deletions basepath.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package afero

import (
"fmt"
"io/fs"
"os"
"path/filepath"
Expand Down Expand Up @@ -32,6 +33,14 @@ type BasePathFile struct {
path string
}

func (f *BasePathFs) OpenRoot(name string) (Root, error) {
fullPath := filepath.Join(f.path, name)
if !filepath.IsLocal(fullPath) {
return nil, fmt.Errorf("%w: %s", ErrInvalidRoot, fullPath)
}
return f.source.OpenRoot(fullPath)
}

func (f *BasePathFile) Name() string {
sourcename := f.File.Name()
return strings.TrimPrefix(sourcename, filepath.Clean(f.path))
Expand Down
6 changes: 3 additions & 3 deletions basepath_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ func TestRealPath(t *testing.T) {
t.Errorf("Got error %s", err)
}

excpected := filepath.Join(baseDir, anotherDir)
expected := filepath.Join(baseDir, anotherDir)

if surrealPath != excpected {
t.Errorf("Expected \n%s got \n%s", excpected, surrealPath)
if surrealPath != expected {
t.Errorf("Expected \n%s got \n%s", expected, surrealPath)
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions cacheOnReadFs.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ const (
cacheLocal
)

func (u *CacheOnReadFs) OpenRoot(name string) (Root, error) {
return NewRootFs(u, name)
}

func (u *CacheOnReadFs) cacheStatus(name string) (state cacheState, fi os.FileInfo, err error) {
var lfi, bfi os.FileInfo
lfi, err = u.layer.Stat(name)
Expand Down
4 changes: 4 additions & 0 deletions copyOnWriteFs.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ func NewCopyOnWriteFs(base Fs, layer Fs) Fs {
return &CopyOnWriteFs{base: base, layer: layer}
}

func (u *CopyOnWriteFs) OpenRoot(name string) (Root, error) {
return NewRootFs(u, name)
}

// Returns true if the file is not in the overlay
func (u *CopyOnWriteFs) isBaseFile(name string) (bool, error) {
if _, err := u.layer.Stat(name); err == nil {
Expand Down
4 changes: 4 additions & 0 deletions gcsfs/gcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ func NewGcsFSFromClientWithSeparator(
return &GcsFs{NewGcsFsWithSeparator(ctx, c, folderSeparator)}, nil
}

func (fs *GcsFs) OpenRoot(name string) (afero.Root, error) {
return afero.NewRootFs(fs, name)
}

// Wraps gcs.GcsFs and convert some return types to afero interfaces.

func (fs *GcsFs) Name() string {
Expand Down
79 changes: 42 additions & 37 deletions gcsfs/go.mod
Original file line number Diff line number Diff line change
@@ -1,57 +1,62 @@
module github.com/spf13/afero/gcsfs

go 1.23.0
go 1.24

toolchain go1.24.2

replace github.com/spf13/afero => ../

require (
cloud.google.com/go/storage v1.51.0
cloud.google.com/go/storage v1.56.0
github.com/spf13/afero v1.14.0
golang.org/x/oauth2 v0.28.0
google.golang.org/api v0.226.0
golang.org/x/oauth2 v0.30.0
google.golang.org/api v0.247.0
)

require (
cel.dev/expr v0.19.2 // indirect
cloud.google.com/go v0.118.3 // indirect
cloud.google.com/go/auth v0.15.0 // indirect
cloud.google.com/go/auth/oauth2adapt v0.2.7 // indirect
cloud.google.com/go/compute/metadata v0.6.0 // indirect
cloud.google.com/go/iam v1.4.1 // indirect
cloud.google.com/go/monitoring v1.24.0 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.25.0 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.51.0 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.51.0 // indirect
cel.dev/expr v0.24.0 // indirect
cloud.google.com/go v0.121.6 // indirect
cloud.google.com/go/auth v0.16.5 // indirect
cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect
cloud.google.com/go/compute/metadata v0.8.0 // indirect
cloud.google.com/go/iam v1.5.2 // indirect
cloud.google.com/go/monitoring v1.24.2 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.29.0 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.53.0 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.53.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cncf/xds/go v0.0.0-20250121191232-2f005788dc42 // indirect
github.com/cncf/xds/go v0.0.0-20250501225837-2ac532fd4443 // indirect
github.com/envoyproxy/go-control-plane/envoy v1.32.4 // indirect
github.com/envoyproxy/protoc-gen-validate v1.2.1 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-jose/go-jose/v4 v4.1.2 // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/google/s2a-go v0.1.9 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.5 // indirect
github.com/googleapis/gax-go/v2 v2.14.1 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.6 // indirect
github.com/googleapis/gax-go/v2 v2.15.0 // indirect
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
github.com/spiffe/go-spiffe/v2 v2.5.0 // indirect
github.com/zeebo/errs v1.4.0 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/contrib/detectors/gcp v1.34.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.59.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.59.0 // indirect
go.opentelemetry.io/otel v1.34.0 // indirect
go.opentelemetry.io/otel/metric v1.34.0 // indirect
go.opentelemetry.io/otel/sdk v1.34.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.34.0 // indirect
go.opentelemetry.io/otel/trace v1.34.0 // indirect
golang.org/x/crypto v0.36.0 // indirect
golang.org/x/net v0.37.0 // indirect
golang.org/x/sync v0.14.0 // indirect
golang.org/x/sys v0.31.0 // indirect
golang.org/x/text v0.25.0 // indirect
golang.org/x/time v0.11.0 // indirect
google.golang.org/genproto v0.0.0-20250303144028-a0af3efb3deb // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb // indirect
google.golang.org/grpc v1.71.0 // indirect
google.golang.org/protobuf v1.36.5 // indirect
go.opentelemetry.io/contrib/detectors/gcp v1.37.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.62.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.62.0 // indirect
go.opentelemetry.io/otel v1.37.0 // indirect
go.opentelemetry.io/otel/metric v1.37.0 // indirect
go.opentelemetry.io/otel/sdk v1.37.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.37.0 // indirect
go.opentelemetry.io/otel/trace v1.37.0 // indirect
golang.org/x/crypto v0.41.0 // indirect
golang.org/x/net v0.43.0 // indirect
golang.org/x/sync v0.16.0 // indirect
golang.org/x/sys v0.35.0 // indirect
golang.org/x/text v0.28.0 // indirect
golang.org/x/time v0.12.0 // indirect
google.golang.org/genproto v0.0.0-20250811230008-5f3141c8851a // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250811230008-5f3141c8851a // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250811230008-5f3141c8851a // indirect
google.golang.org/grpc v1.74.2 // indirect
google.golang.org/protobuf v1.36.7 // indirect
)
Loading