Skip to content

Commit 516fc7a

Browse files
authored
Merge branch 'main' into issue/86
2 parents a2666e4 + 9a6bbea commit 516fc7a

File tree

14 files changed

+78
-53
lines changed

14 files changed

+78
-53
lines changed

.github/workflows/codeql.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: CodeQL
22

33
on:
44
push:
5-
branches: [ "master", "main" ]
5+
branches: [ "main" ]
66
pull_request:
77
schedule:
88
- cron: '00 5 * * 1'
@@ -21,15 +21,15 @@ jobs:
2121
strategy:
2222
fail-fast: false
2323
matrix:
24-
language: [ 'go' ]
24+
language: [ 'go', 'actions' ]
2525

2626
steps:
2727
- name: Checkout code
28-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
28+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2929

3030
# Initializes the CodeQL tools for scanning.
3131
- name: Initialize CodeQL
32-
uses: github/codeql-action/init@1b549b9259bda1cb5ddde3b41741a82a2d15a841 # v3.28.13
32+
uses: github/codeql-action/init@64d10c13136e1c5bce3e5fbde8d4906eeaafc885 # v3.29.5
3333
with:
3434
languages: ${{ matrix.language }}
3535
# xref: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
@@ -40,6 +40,6 @@ jobs:
4040
run: go build ./...
4141

4242
- name: Perform CodeQL Analysis
43-
uses: github/codeql-action/analyze@1b549b9259bda1cb5ddde3b41741a82a2d15a841 # v3.28.13
43+
uses: github/codeql-action/analyze@64d10c13136e1c5bce3e5fbde8d4906eeaafc885 # v3.29.5
4444
with:
4545
category: "/language:${{matrix.language}}"

.github/workflows/scorecard.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ jobs:
2525

2626
steps:
2727
- name: "Checkout code"
28-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
28+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2929
with:
3030
persist-credentials: false
3131

3232
- name: "Run analysis"
33-
uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # v2.4.1
33+
uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3
3434
with:
3535
results_file: results.sarif
3636
results_format: sarif
@@ -57,6 +57,6 @@ jobs:
5757
# Upload the results to GitHub's code scanning dashboard (optional).
5858
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
5959
- name: "Upload to code-scanning"
60-
uses: github/codeql-action/upload-sarif@1b549b9259bda1cb5ddde3b41741a82a2d15a841 # v3.28.13
60+
uses: github/codeql-action/upload-sarif@64d10c13136e1c5bce3e5fbde8d4906eeaafc885 # v3.29.5
6161
with:
6262
sarif_file: results.sarif

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ jobs:
1010
test:
1111
strategy:
1212
matrix:
13-
go-version: [1.22.x,1.23.x,1.24.x]
13+
go-version: [1.24.x,1.25.x]
1414
platform: [ubuntu-latest, macos-latest, windows-latest]
1515
runs-on: ${{ matrix.platform }}
1616
steps:
1717
- name: Checkout code
18-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
18+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
1919

2020
- name: Install Go
21-
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
21+
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
2222
with:
2323
go-version: ${{ matrix.go-version }}
2424

.github/workflows/test_wasip1.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Test wasip1
22

33
on:
44
push:
5-
branches: [ "master", "main" ]
5+
branches: [ "main" ]
66
pull_request:
77

88
permissions: {}
@@ -11,20 +11,20 @@ jobs:
1111
test:
1212
strategy:
1313
matrix:
14-
go-version: [1.23.x,1.24.x]
14+
go-version: [1.24.x,1.25.x]
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Checkout code
18-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
18+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
1919

2020
- name: Install Go
21-
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
21+
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
2222
with:
2323
go-version: ${{ matrix.go-version }}
2424

2525
- name: Install wasirun
2626
run: |
27-
go install github.com/stealthrocket/wasi-go/cmd/wasirun@latest
27+
go install github.com/stealthrocket/wasi-go/cmd/wasirun@v0.8.0
2828
2929
- name: Test
3030
run: make wasitest

.golangci.yaml

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
version: "2"
12
linters:
2-
disable-all: true
3+
default: none
34
enable:
45
- asasalint
56
- asciicheck
@@ -22,10 +23,8 @@ linters:
2223
- gochecknoinits
2324
- gochecksumtype
2425
- goheader
25-
- goimports
2626
- gomodguard
2727
- goprintffuncname
28-
- gosimple
2928
- gosmopolitan
3029
- govet
3130
- grouper
@@ -44,14 +43,33 @@ linters:
4443
- sloglint
4544
- spancheck
4645
- sqlclosecheck
46+
- staticcheck
4747
- tagalign
4848
- tagliatelle
49-
- tenv
5049
- testableexamples
51-
- typecheck
5250
- unconvert
5351
- unused
5452
- usestdlibvars
5553
- wastedassign
5654
- whitespace
5755
- zerologlint
56+
exclusions:
57+
generated: lax
58+
presets:
59+
- comments
60+
- common-false-positives
61+
- legacy
62+
- std-error-handling
63+
paths:
64+
- third_party$
65+
- builtin$
66+
- examples$
67+
formatters:
68+
enable:
69+
- goimports
70+
exclusions:
71+
generated: lax
72+
paths:
73+
- third_party$
74+
- builtin$
75+
- examples$

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ GOCMD = go
33
GOTEST = $(GOCMD) test
44
WASIRUN_WRAPPER := $(CURDIR)/scripts/wasirun-wrapper
55

6-
GOLANGCI_VERSION ?= v1.64.5
6+
GOLANGCI_VERSION ?= v2.1.6
77
TOOLS_BIN := $(shell mkdir -p build/tools && realpath build/tools)
88

99
GOLANGCI = $(TOOLS_BIN)/golangci-lint-$(GOLANGCI_VERSION)
@@ -14,7 +14,7 @@ $(GOLANGCI):
1414

1515
.PHONY: test
1616
test:
17-
$(GOTEST) -race -timeout 300s ./...
17+
$(GOTEST) -race -timeout 900s ./...
1818

1919
test-coverage:
2020
echo "" > $(COVERAGE_REPORT); \

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
module github.com/go-git/go-billy/v6
22

33
// go-git supports the last 3 stable Go versions.
4-
go 1.22
4+
go 1.24.0
55

66
require (
7-
github.com/cyphar/filepath-securejoin v0.4.1
8-
github.com/stretchr/testify v1.10.0
9-
golang.org/x/sys v0.30.0
7+
github.com/cyphar/filepath-securejoin v0.5.0
8+
github.com/stretchr/testify v1.11.1
9+
golang.org/x/sys v0.37.0
1010
)
1111

1212
require (

go.sum

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
github.com/cyphar/filepath-securejoin v0.4.1 h1:JyxxyPEaktOD+GAnqIqTf9A8tHyAG22rowi7HkoSU1s=
2-
github.com/cyphar/filepath-securejoin v0.4.1/go.mod h1:Sdj7gXlvMcPZsbhwhQ33GguGLDGQL7h7bg04C/+u9jI=
1+
github.com/cyphar/filepath-securejoin v0.5.0 h1:hIAhkRBMQ8nIeuVwcAoymp7MY4oherZdAxD+m0u9zaw=
2+
github.com/cyphar/filepath-securejoin v0.5.0/go.mod h1:Sdj7gXlvMcPZsbhwhQ33GguGLDGQL7h7bg04C/+u9jI=
33
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
44
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
55
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
66
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
7-
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
8-
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
9-
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
10-
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
7+
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
8+
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
9+
golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ=
10+
golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
1111
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
1212
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
1313
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=

memfs/file.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ type file struct {
1717
position int64
1818
flag int
1919
mode os.FileMode
20-
modTime time.Time
2120

2221
isClosed bool
2322
}
@@ -81,7 +80,6 @@ func (f *file) WriteAt(p []byte, off int64) (int, error) {
8180
return 0, errors.New("write not supported")
8281
}
8382

84-
f.modTime = time.Now()
8583
n, err := f.content.WriteAt(p, off)
8684
f.position = off + int64(n)
8785

@@ -113,7 +111,6 @@ func (f *file) Duplicate(filename string, mode fs.FileMode, flag int) billy.File
113111
content: f.content,
114112
mode: mode,
115113
flag: flag,
116-
modTime: f.modTime,
117114
}
118115

119116
if isTruncate(flag) {
@@ -132,7 +129,7 @@ func (f *file) Stat() (os.FileInfo, error) {
132129
name: f.Name(),
133130
mode: f.mode,
134131
size: f.content.Len(),
135-
modTime: f.modTime,
132+
modTime: f.content.modTime,
136133
}, nil
137134
}
138135

@@ -178,8 +175,9 @@ func (*fileInfo) Sys() interface{} {
178175
}
179176

180177
type content struct {
181-
name string
182-
bytes []byte
178+
name string
179+
bytes []byte
180+
modTime time.Time
183181

184182
m sync.RWMutex
185183
}
@@ -205,6 +203,7 @@ func (c *content) WriteAt(p []byte, off int64) (int, error) {
205203
if len(c.bytes) < prev {
206204
c.bytes = c.bytes[:prev]
207205
}
206+
c.modTime = time.Now()
208207
c.m.Unlock()
209208

210209
return len(p), nil

memfs/memory_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@ func TestModTime(t *testing.T) {
6565

6666
// new calls to ModTime() retain existing mod time.
6767
assert.Equal(t, modtime, fi1a.ModTime())
68+
69+
// Writing to file should change the mod time
70+
err = util.WriteFile(fs, "/file1", []byte{0}, 0o666)
71+
require.NoError(t, err)
72+
fi1c, err := fs.Stat("/file1")
73+
require.NoError(t, err)
74+
assert.NotEqual(t, modtime, fi1c.ModTime())
6875
}
6976

7077
func TestNegativeOffsets(t *testing.T) {

0 commit comments

Comments
 (0)