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
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ updates:
directory: "/"
schedule:
interval: monthly
cooldown:
default-days: 7
groups:
go-dependencies:
patterns:
Expand All @@ -13,6 +15,8 @@ updates:
directory: "/"
schedule:
interval: monthly
cooldown:
default-days: 7
groups:
github-actions-dependencies:
patterns:
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Linting

on:
push:
branches:
- 'main'
pull_request:
branches:
- '**'
workflow_dispatch:

permissions: {}

jobs:
lint:
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Run zizmor
uses: zizmorcore/zizmor-action@cc914d7f3750a2d13d75c7f184a1060aa0e9d482 # v0.6.4
with:
# Fail the check on findings and annotate them inline, rather than
# uploading SARIF to code scanning (which never fails the check).
advanced-security: false
annotations: true
12 changes: 6 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ permissions:

jobs:
test:
runs-on: ubuntu-24.04
runs-on: ubuntu-26.04
steps:
- name: Checkout
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Set up Go
uses: actions/setup-go@v7
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: 'stable'
go-version: '1.27.1'

- name: Build
run: go build -v ./...
Expand All @@ -33,9 +33,9 @@ jobs:
run: go test -v ./...

- name: Lint
uses: golangci/golangci-lint-action@v9
uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0
with:
version: v2.12.2
version: v2.13.2

- name: Vendorcheck
shell: bash
Expand Down
2 changes: 2 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ linters:
- depguard
- err113
- exhaustruct
- exhaustruct_v5
- goconst
- gomodguard # deprecated; gomodguard_v2 is enabled instead
- lll
- musttag
- wsl
Expand Down
19 changes: 18 additions & 1 deletion cmd/sunlight-secretmanager/filesystem_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"os"
"path/filepath"
"strings"
"syscall"
"testing"
)

Expand All @@ -21,6 +22,9 @@ func TestWriteFile(t *testing.T) {
t.Fatalf("failed to close test setup file: %s", err)
}

// Get the FS type of the tempdir, which may vary between environments
tempDirFSType := filesystemType(t, tempDir)

for _, tc := range []struct {
name string
path string
Expand All @@ -42,7 +46,7 @@ func TestWriteFile(t *testing.T) {
{
name: "happy path",
path: filepath.Join(tempDir, "happy"),
fsType: 61267, // The statfs.Type for a normal unix filesystem
fsType: tempDirFSType, // Whatever filesystem the test temp dir is on
wantErr: "",
},
} {
Expand Down Expand Up @@ -74,3 +78,16 @@ func TestWriteFile(t *testing.T) {
})
}
}

// filesystemType returns the statfs.Type of the filesystem containing path.
func filesystemType(t *testing.T, path string) int64 {
t.Helper()

var statfs syscall.Statfs_t
err := syscall.Statfs(path, &statfs)
if err != nil {
t.Fatalf("failed to get filesystem info for %q: %s", path, err)
}

return statfs.Type
}