Skip to content

Commit 497d319

Browse files
Merge pull request #14 from capnspacehook/modernize
Refactor
2 parents f7a35a7 + 3afd8fc commit 497d319

40 files changed

Lines changed: 1339 additions & 821 deletions

.github/actionlint-matcher.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "actionlint",
5+
"pattern": [
6+
{
7+
"regexp": "^(?:\\x1b\\[\\d+m)?(.+?)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*: (?:\\x1b\\[\\d+m)*(.+?)(?:\\x1b\\[\\d+m)* \\[(.+?)\\]$",
8+
"file": 1,
9+
"line": 2,
10+
"column": 3,
11+
"message": 4,
12+
"code": 5
13+
}
14+
]
15+
}
16+
]
17+
}

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: daily
7+
- package-ecosystem: gomod
8+
open-pull-requests-limit: 5
9+
directory: /
10+
schedule:
11+
interval: daily

.github/workflows/codeql.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Run CodeQL
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- "*"
10+
schedule:
11+
- cron: "00 13 * * 1"
12+
13+
workflow_dispatch: {}
14+
15+
jobs:
16+
codeql:
17+
permissions:
18+
actions: write
19+
contents: read
20+
security-events: write
21+
uses: capnspacehook/go-workflows/.github/workflows/codeql.yml@master

.github/workflows/lint-actions.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Lint workflows
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- ".github/workflows/*"
9+
pull_request:
10+
branches:
11+
- "*"
12+
paths:
13+
- ".github/workflows/*"
14+
15+
workflow_dispatch: {}
16+
17+
jobs:
18+
lint-workflows:
19+
permissions:
20+
contents: read
21+
uses: capnspacehook/go-workflows/.github/workflows/lint-actions.yml@master

.github/workflows/lint-go.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Lint Go
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- "*"
10+
11+
workflow_dispatch: {}
12+
13+
jobs:
14+
lint-go:
15+
permissions:
16+
contents: read
17+
uses: capnspacehook/go-workflows/.github/workflows/lint-go.yml@master

.github/workflows/test.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- "*"
10+
11+
workflow_dispatch: {}
12+
13+
jobs:
14+
test:
15+
permissions:
16+
contents: read
17+
uses: capnspacehook/go-workflows/.github/workflows/test.yml@master
18+
with:
19+
fuzz-with-race: true

.github/workflows/vuln.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Vulnerability scan
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- "*"
10+
schedule:
11+
- cron: "00 13 * * 1"
12+
13+
workflow_dispatch: {}
14+
15+
jobs:
16+
vuln-check:
17+
permissions:
18+
contents: read
19+
uses: capnspacehook/go-workflows/.github/workflows/vuln.yml@master

.golangci.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
version: "2"
2+
linters:
3+
default: none
4+
enable:
5+
- asasalint
6+
- bidichk
7+
- bodyclose
8+
- copyloopvar
9+
- durationcheck
10+
- errcheck
11+
- errchkjson
12+
- errorlint
13+
- exptostd
14+
- fatcontext
15+
- gocheckcompilerdirectives
16+
- goconst
17+
- gocritic
18+
- govet
19+
- ineffassign
20+
- intrange
21+
- loggercheck
22+
- mirror
23+
- misspell
24+
- nilerr
25+
- nolintlint
26+
- nilnesserr
27+
- nilnil
28+
- paralleltest
29+
- perfsprint
30+
- prealloc
31+
- predeclared
32+
- reassign
33+
- revive
34+
- rowserrcheck
35+
- sloglint
36+
- sqlclosecheck
37+
- thelper
38+
- tparallel
39+
- unconvert
40+
- unparam
41+
- unused
42+
- usestdlibvars
43+
- wastedassign
44+
settings:
45+
gocritic:
46+
disabled-checks:
47+
- ifElseChain
48+
misspell:
49+
locale: US
50+
paralleltest:
51+
ignore-missing: true
52+
revive:
53+
rules:
54+
- name: blank-imports
55+
disabled: true
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+
issues:
68+
max-issues-per-linter: 0
69+
max-same-issues: 0
70+
formatters:
71+
enable:
72+
- gci
73+
- gofumpt
74+
settings:
75+
gci:
76+
sections:
77+
- standard
78+
- default
79+
- prefix(github.com/capnspacehook/pandorasbox)
80+
exclusions:
81+
generated: lax
82+
paths:
83+
- third_party$
84+
- builtin$
85+
- examples$

.goreleaser.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
changelog:
2+
use: github-native
3+
sort: asc
4+
5+
builds:
6+
- env:
7+
- CGO_ENABLED=0
8+
- GO111MODULE=on
9+
goos:
10+
- linux
11+
goarch:
12+
- amd64
13+
flags:
14+
- -buildmode=pie
15+
- -buildvcs=true
16+
- -trimpath
17+
mod_timestamp: '{{ .CommitTimestamp }}'
18+
ldflags:
19+
- '-s -w -X main.version={{ if eq .Tag "v0.0.0" }}devel{{ else }}{{ .Tag }}{{ end }}'
20+
21+
archives:
22+
- id: binary-archive
23+
name_template: "{{ .ProjectName }}"
24+
format: binary
25+
- id: tar-archive
26+
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
27+
format: tar.gz
28+
# hack to only add binary to archive
29+
files:
30+
- none*
31+
32+
checksum:
33+
name_template: "checksums.txt"
34+
ids:
35+
- binary-archive
36+
- tar-archive
37+
38+
signs:
39+
- id: checksum-signature
40+
cmd: cosign
41+
certificate: "${artifact}.crt"
42+
args: ["sign-blob", "--output-signature", "${signature}", "--output-certificate", "${certificate}", "${artifact}", "--yes"]
43+
artifacts: checksum
44+
45+
release:
46+
ids:
47+
- checksum-signature
48+
- tar-archive
49+
prerelease: auto
50+
name_template: "{{ .Tag }}"

box.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ import (
55
"io/fs"
66
"os"
77

8-
"github.com/awnumar/memguard"
98
"github.com/capnspacehook/pandorasbox/absfs"
10-
"github.com/capnspacehook/pandorasbox/ioutil"
119
"github.com/capnspacehook/pandorasbox/osfs"
1210
"github.com/capnspacehook/pandorasbox/vfs"
1311
)
@@ -75,10 +73,10 @@ func (b *Box) ReadDir(dirname string) ([]fs.DirEntry, error) {
7573

7674
func (b *Box) WriteFile(filename string, data []byte, perm fs.FileMode) error {
7775
if vfsFilename, ok := ConvertVFSPath(filename); ok {
78-
return ioutil.WriteFile(b.vfs, vfsFilename, data, perm)
76+
return b.vfs.WriteFile(vfsFilename, data, perm)
7977
}
8078

81-
return ioutil.WriteFile(b.osfs, filename, data, perm)
79+
return os.WriteFile(filename, data, perm)
8280
}
8381

8482
func (b *Box) Mkdir(name string, perm fs.FileMode) error {
@@ -217,7 +215,3 @@ func (b *Box) GetTempDir(vfsMode bool) string {
217215

218216
return b.osfs.TempDir()
219217
}
220-
221-
func (b *Box) Close() {
222-
memguard.Purge()
223-
}

0 commit comments

Comments
 (0)