Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CodeQL

on:
push:
branches: [ "master", "main" ]
branches: [ "main" ]
pull_request:
schedule:
- cron: '00 5 * * 1'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_wasip1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Test wasip1

on:
push:
branches: [ "master", "main" ]
branches: [ "main" ]
pull_request:

permissions: {}
Expand Down
28 changes: 23 additions & 5 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
version: "2"
linters:
disable-all: true
default: none
enable:
- asasalint
- asciicheck
Expand All @@ -22,10 +23,8 @@ linters:
- gochecknoinits
- gochecksumtype
- goheader
- goimports
- gomodguard
- goprintffuncname
- gosimple
- gosmopolitan
- govet
- grouper
Expand All @@ -44,14 +43,33 @@ linters:
- sloglint
- spancheck
- sqlclosecheck
- staticcheck
- tagalign
- tagliatelle
- tenv
- testableexamples
- typecheck
- unconvert
- unused
- usestdlibvars
- wastedassign
- whitespace
- zerologlint
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- goimports
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ GOCMD = go
GOTEST = $(GOCMD) test
WASIRUN_WRAPPER := $(CURDIR)/scripts/wasirun-wrapper

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

GOLANGCI = $(TOOLS_BIN)/golangci-lint-$(GOLANGCI_VERSION)
Expand Down
4 changes: 2 additions & 2 deletions osfs/os_posix.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ func (f *file) Lock() error {
f.m.Lock()
defer f.m.Unlock()

return unix.Flock(int(f.File.Fd()), unix.LOCK_EX)
return unix.Flock(int(f.Fd()), unix.LOCK_EX)
}

func (f *file) Unlock() error {
f.m.Lock()
defer f.m.Unlock()

return unix.Flock(int(f.File.Fd()), unix.LOCK_UN)
return unix.Flock(int(f.Fd()), unix.LOCK_UN)
}

func rename(from, to string) error {
Expand Down
11 changes: 5 additions & 6 deletions test/basic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"strings"
"testing"

"github.com/go-git/go-billy/v6"
. "github.com/go-git/go-billy/v6" //nolint
"github.com/go-git/go-billy/v6/osfs"
"github.com/go-git/go-billy/v6/util"
Expand Down Expand Up @@ -71,7 +70,7 @@ func TestCreateOverwrite(t *testing.T) {
f, err := fs.Create("foo")
require.NoError(t, err)

l, err := f.Write([]byte(fmt.Sprintf("foo%d", i)))
l, err := fmt.Fprintf(f, "foo%d", i)
require.NoError(t, err)
assert.Equal(t, 4, l)

Expand Down Expand Up @@ -477,7 +476,7 @@ func TestStatNonExistent(t *testing.T) {
func TestRename(t *testing.T) {
tests := []struct {
name string
before func(*testing.T, billy.Filesystem)
before func(*testing.T, Filesystem)
from string
to string
wantErr *error
Expand All @@ -491,7 +490,7 @@ func TestRename(t *testing.T) {
},
{
name: "file rename",
before: func(t *testing.T, fs billy.Filesystem) {
before: func(t *testing.T, fs Filesystem) {
root := fsRoot(fs)
f, err := fs.Create(fs.Join(root, "foo"))
require.NoError(t, err)
Expand All @@ -503,7 +502,7 @@ func TestRename(t *testing.T) {
},
{
name: "dir rename",
before: func(t *testing.T, fs billy.Filesystem) {
before: func(t *testing.T, fs Filesystem) {
root := fsRoot(fs)
f, err := fs.Create(fs.Join(root, "foo", "bar1"))
require.NoError(t, err)
Expand Down Expand Up @@ -568,7 +567,7 @@ func TestRename(t *testing.T) {
})
}

func fsRoot(fs billy.Filesystem) string {
func fsRoot(fs Filesystem) string {
if reflect.TypeOf(fs) == reflect.TypeOf(&osfs.BoundOS{}) {
return fs.Root()
}
Expand Down