diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml new file mode 100644 index 0000000..44db944 --- /dev/null +++ b/.github/dependabot.yaml @@ -0,0 +1,17 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directories: + - "/" + schedule: + interval: "monthly" + labels: + - "dependencies" + - package-ecosystem: "gomod" + directories: + - "/" + schedule: + interval: "monthly" + labels: + - "dependencies" + diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8e8a730..fe0f0af 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,33 +1,37 @@ name: Run CI Tests -on: [push] +on: + pull_request: + paths-ignore: + - 'README.md' + - 'LICENSE' + push: + branches: + - 'main' jobs: run-copywrite: - runs-on: ubuntu-22.04 + timeout-minutes: 5 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - - uses: hashicorp/setup-copywrite@v1.1.2 + - uses: hashicorp/setup-copywrite@v1.1.3 - name: verify copyright run: | - copywrite --config=.copywrite.hcl headers --plan - run-lint: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - uses: hashicorp/setup-golang@v1 - with: - version-file: go.mod - - uses: golangci/golangci-lint-action@v3 - with: - version: v1.55.2 - skip-cache: true + copywrite --config .github/workflows/scripts/copywrite.hcl \ + headers --spdx "BSD-3-Clause" --plan run-tests: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - - uses: hashicorp/setup-golang@v1 + - uses: extractions/setup-just@v2 + - uses: actions/setup-go@v5 with: - version-file: go.mod + go-version-file: go.mod + cache-dependency-path: '**/go.sum' + - name: Show System + run: | + uname -a + just sysinfo - name: Run Go Test run: | - make test + just init tidy lint test diff --git a/.github/workflows/scripts/copywrite.hcl b/.github/workflows/scripts/copywrite.hcl new file mode 100644 index 0000000..c9215e0 --- /dev/null +++ b/.github/workflows/scripts/copywrite.hcl @@ -0,0 +1,15 @@ +schema_version = 1 + +project { + license = "BSD-3-Clause" + copyright_holder = "CattleCloud LLC" + copyright_year = 2025 + header_ignore = [ + "**/*.sh", + ".src/**", + ".bin/**", + ".github/**", + ".golangci.yaml", + ] +} + diff --git a/.github/workflows/scripts/golangci.yaml b/.github/workflows/scripts/golangci.yaml new file mode 100644 index 0000000..5be68bc --- /dev/null +++ b/.github/workflows/scripts/golangci.yaml @@ -0,0 +1,43 @@ +run: + timeout: 5m +linters: + enable: + - asasalint + - asciicheck + - bidichk + - bodyclose + - copyloopvar + - dogsled + - dupword + - durationcheck + - errcheck + - errname + - errorlint + - exhaustive + - gochecknoinits + - gocritic + - gofmt + - gosimple + - govet + - ineffassign + - makezero + - misspell + - musttag + - nilnil + - noctx + - perfsprint + - prealloc + - predeclared + - reassign + - revive + - rowserrcheck + - staticcheck + - sqlclosecheck + - tagalign + - tenv + - unused + - whitespace + +linters-settings: + exhaustive: + default-signifies-exhaustive: true diff --git a/.gitignore b/.gitignore index 1b336c5..5f40696 100644 --- a/.gitignore +++ b/.gitignore @@ -1,23 +1,17 @@ -# Binaries for programs and plugins -*.exe -*.exe~ -*.dll -*.so -*.dylib +*~ +~* -# Test binary, built with `go test -c` -*.test +# OS files +**/.DS_Store -# Output of the go coverage tool, specifically when used with LiteIDE -*.out +# Build artifacts +site -# Dependency directories (remove the comment below to include it) -# vendor/ - -# Go work files +# Go workspace file go.work go.work.sum -# macOS -.DS_Store +# Local source and binary files +.src/ +.bin/ diff --git a/Justfile b/Justfile new file mode 100644 index 0000000..dc2573e --- /dev/null +++ b/Justfile @@ -0,0 +1,47 @@ +set shell := ["bash", "-u", "-c"] + +export scripts := ".github/workflows/scripts" +export GOBIN := `echo $PWD/.bin` + +# show available commands +[private] +default: + @just --list + +# tidy up Go modules +[group('build')] +tidy: + go mod tidy + +# run tests across source tree +[group('build')] +test: + go test -v -race -count=1 ./... + +# ensure copywrite headers present on source files +[group('lint')] +copywrite: + copywrite \ + --config {{scripts}}/copywrite.hcl headers \ + --spdx "BSD-3-Clause" + +# apply go vet command on source tree +[group('lint')] +vet: + go vet ./... + +# apply golangci-lint linters on source tree +[group('lint')] +lint: vet + $GOBIN/golangci-lint run --config .github/workflows/scripts/golangci.yaml + +# show host system information +[group('build')] +@sysinfo: + echo "{{os()/arch()}} {{num_cpus()}}c" + +# locally install build dependencies +[group('build')] +init: + go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.62.2 + diff --git a/LICENSE b/LICENSE index 013ff68..bfeaf27 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ BSD 3-Clause License -Copyright (c) 2018, NOXIDE.LOL +Copyright (c) 2025, CattleCloud LLC Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/Makefile b/Makefile deleted file mode 100644 index a15d2af..0000000 --- a/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -SHELL = bash - -default: test - -.PHONY: test -test: vet - @echo "==> Running Tests ..." - @go test -count=1 -v -race ./... - -.PHONY: copywrite -copywrite: - @echo "==> Checking Copywrite ..." - copywrite --config .copywrite.hcl headers --spdx "BSD-3-Clause" - -.PHONY: vet -vet: - @echo "==> Vet Go sources ..." - @go vet ./... - -.PHONY: lint -lint: vet - @echo "==> Lint ..." - @golangci-lint run diff --git a/README.md b/README.md index 93201aa..c4ee11f 100644 --- a/README.md +++ b/README.md @@ -3,13 +3,13 @@ atomicfs A library for atomic filesystem operations in Go. -[![Go Reference](https://pkg.go.dev/badge/noxide.lol/go/atomicfs.svg)](https://pkg.go.dev/noxide.lol/go/atomicfs) -[![License](https://img.shields.io/github/license/noxideproject/atomicfs?color=7C00D8&style=flat-square&label=License)](https://github.com/noxideproject/atomicfs/blob/main/LICENSE) -[![Build](https://img.shields.io/github/actions/workflow/status/noxideproject/atomicfs/ci.yaml?style=flat-square&color=0FAA07&label=Tests)](https://github.com/noxideproject/atomicfs/actions/workflows/ci.yaml) +[![Go Reference](https://pkg.go.dev/badge/cattlecloud.net/go/atomicfs.svg)](https://pkg.go.dev/cattlecloud.net/go/atomicfs) +[![License](https://img.shields.io/github/license/cattlecloud/atomicfs?color=7C00D8&style=flat-square&label=License)](https://github.com/cattlecloud/atomicfs/blob/main/LICENSE) +[![Build](https://img.shields.io/github/actions/workflow/status/cattlecloud/atomicfs/ci.yaml?style=flat-square&color=0FAA07&label=Tests)](https://github.com/cattlecloud/atomicfs/actions/workflows/ci.yaml) # Overview -The `noxide.lol/go/atomicfs` module provides a package for performing atomic +The `cattlecloud.net/go/atomicfs` module provides a package for performing atomic filesystem operations. #### Reading material @@ -18,9 +18,14 @@ filesystem operations. # Getting Started -The `atomicfs` package can be installed by running -```bash -$ go get noxide.lol/go/atomicfs +The `atomicfs` package can be added to a project with `go get`. + +```shell +go get cattlecloud.net/go/atomicfs@latest +``` + +```go +import "cattlecloud.net/go/atomicfs" ``` #### Examples @@ -36,11 +41,11 @@ _ = writer.Write(input, output) # Contributing -The `noxide.lol/go/atomicfs` module is always improving with new features and +The `cattlecloud.net/go/atomicfs` module is always improving with new features and error corrections. For contributing bug fixes and new features please file an issue. # License -The `noxide.lol/go/atomicfs` module is open source under the [BSD-3-Clause](LICENSE) +The `cattlecloud.net/go/atomicfs` module is open source under the [BSD-3-Clause](LICENSE) license. diff --git a/atomicfs.go b/atomicfs.go index 48ab06b..9f28449 100644 --- a/atomicfs.go +++ b/atomicfs.go @@ -1,4 +1,4 @@ -// Copyright (c) NOXIDE.LOL +// Copyright (c) CattleCloud LLC // SPDX-License-Identifier: BSD-3-Clause // Package atomicfs provides tools for doing all-or-nothing atomic filesystem @@ -14,8 +14,8 @@ import ( "strings" "syscall" - "noxide.lol/go/atomicfs/fs" - "noxide.lol/go/atomicfs/sys" + "cattlecloud.net/go/atomicfs/fs" + "cattlecloud.net/go/atomicfs/sys" ) // A FileWriter is used to read content from a source and write it to a diff --git a/atomicfs_test.go b/atomicfs_test.go index 225ead6..842f82f 100644 --- a/atomicfs_test.go +++ b/atomicfs_test.go @@ -1,4 +1,4 @@ -// Copyright (c) NOXIDE.LOL +// Copyright (c) CattleCloud LLC // SPDX-License-Identifier: BSD-3-Clause package atomicfs @@ -8,9 +8,9 @@ import ( "strings" "testing" + "cattlecloud.net/go/atomicfs/fs" + "cattlecloud.net/go/atomicfs/sys" "github.com/shoenig/test/must" - "noxide.lol/go/atomicfs/fs" - "noxide.lol/go/atomicfs/sys" ) func TestFileWriter_WriteFile(t *testing.T) { diff --git a/fs/filesystem.go b/fs/filesystem.go index c868a78..5dd2b8a 100644 --- a/fs/filesystem.go +++ b/fs/filesystem.go @@ -1,4 +1,4 @@ -// Copyright (c) NOXIDE.LOL +// Copyright (c) CattleCloud LLC // SPDX-License-Identifier: BSD-3-Clause package fs diff --git a/fs/osfs.go b/fs/osfs.go index 0e502d3..220a91c 100644 --- a/fs/osfs.go +++ b/fs/osfs.go @@ -1,4 +1,4 @@ -// Copyright (c) NOXIDE.LOL +// Copyright (c) CattleCloud LLC // SPDX-License-Identifier: BSD-3-Clause package fs diff --git a/fs/osfs_test.go b/fs/osfs_test.go index 98eadb9..2806a6c 100644 --- a/fs/osfs_test.go +++ b/fs/osfs_test.go @@ -1,4 +1,4 @@ -// Copyright (c) NOXIDE.LOL +// Copyright (c) CattleCloud LLC // SPDX-License-Identifier: BSD-3-Clause package fs diff --git a/go.mod b/go.mod index 6cbe7ad..3b9f099 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ -module noxide.lol/go/atomicfs +module cattlecloud.net/go/atomicfs -go 1.21 +go 1.23 require github.com/shoenig/test v1.7.0 diff --git a/sys/syscall.go b/sys/syscall.go index 59b3309..e4fc7b0 100644 --- a/sys/syscall.go +++ b/sys/syscall.go @@ -1,4 +1,4 @@ -// Copyright (c) NOXIDE.LOL +// Copyright (c) CattleCloud LLC // SPDX-License-Identifier: BSD-3-Clause package sys diff --git a/sys/syscall_test.go b/sys/syscall_test.go index 2d5a717..011ea8c 100644 --- a/sys/syscall_test.go +++ b/sys/syscall_test.go @@ -1,4 +1,4 @@ -// Copyright (c) NOXIDE.LOL +// Copyright (c) CattleCloud LLC // SPDX-License-Identifier: BSD-3-Clause package sys