Skip to content

Commit 87edab9

Browse files
committed
update Go version and dependencies
This commit updates the module version from Go 1.16 to Go 1.20 and updates the module dependencies. Signed-off-by: Andreas Auernhammer <[email protected]>
1 parent c8b5358 commit 87edab9

File tree

7 files changed

+67
-100
lines changed

7 files changed

+67
-100
lines changed

.github/workflows/codeql.yml

Lines changed: 0 additions & 38 deletions
This file was deleted.

.github/workflows/go.yml

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
go-version: [1.19.1]
17+
go-version: [1.21.1]
1818
steps:
1919
- name: Set up Go ${{ matrix.go-version }}
2020
uses: actions/setup-go@v3
@@ -28,14 +28,27 @@ jobs:
2828
run: |
2929
go build ./...
3030
go vet ./...
31-
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.48.0
32-
$(go env GOPATH)/bin/golangci-lint run --config ./.golangci.yml
31+
lint:
32+
name: Lint
33+
runs-on: ubuntu-latest
34+
steps:
35+
- name: "Set up Go"
36+
uses: actions/setup-go@v3
37+
with:
38+
go-version: 1.21.1
39+
- name: Check out code
40+
uses: actions/checkout@v3
41+
- name: Lint
42+
uses: golangci/golangci-lint-action@v3
43+
with:
44+
version: latest
45+
args: --config ./.golangci.yml --timeout=2m
3346
test:
3447
name: Text ${{ matrix.os }}
3548
runs-on: ${{ matrix.os }}
3649
strategy:
3750
matrix:
38-
go-version: [1.19.1]
51+
go-version: [1.21.1]
3952
os: [ubuntu-latest, windows-latest, macos-latest]
4053
steps:
4154
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
@@ -47,3 +60,20 @@ jobs:
4760
- name: Test on ${{ matrix.os }}
4861
run: |
4962
go test ./...
63+
vulncheck:
64+
name: Vulncheck
65+
needs: Lint
66+
runs-on: ubuntu-latest
67+
steps:
68+
- name: Check out code into the Go module directory
69+
uses: actions/checkout@v3
70+
- uses: actions/setup-go@v3
71+
with:
72+
go-version: 1.21.1
73+
check-latest: true
74+
- name: Get govulncheck
75+
run: go install golang.org/x/vuln/cmd/govulncheck@latest
76+
shell: bash
77+
- name: Run govulncheck
78+
run: govulncheck ./...
79+
shell: bash

.github/workflows/vulncheck.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

.golangci.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,30 @@ linters-settings:
55
misspell:
66
locale: US
77

8+
staticcheck:
9+
checks: ["all", "-SA1019"]
10+
811
linters:
912
disable-all: true
1013
enable:
1114
- typecheck
1215
- goimports
1316
- misspell
17+
- staticcheck
1418
- govet
19+
- revive
1520
- ineffassign
1621
- gosimple
17-
- deadcode
18-
- unparam
1922
- unused
20-
- structcheck
2123
- prealloc
2224
- unconvert
25+
- gofumpt
2326

2427
issues:
2528
exclude-use-default: false
2629
exclude:
27-
- should have a package comment
28-
- error strings should not be capitalized or end with punctuation or a newline
30+
- "var-naming: don't use ALL_CAPS in Go names; use CamelCase"
31+
- "package-comments: should have a package comment"
32+
2933
service:
3034
golangci-lint-version: 1.48.0 # use the fixed version to not introduce new linters unexpectedly

cmd/minisign/minisign.go

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Options:
4848
-v Print version information.
4949
`
5050

51-
var version string = "v0.0.0-dev"
51+
var version = "v0.0.0-dev"
5252

5353
func main() {
5454
log.SetFlags(0)
@@ -135,12 +135,12 @@ func generateKeyPair(secKeyFile, pubKeyFile string, force bool) {
135135
}
136136

137137
if dir := filepath.Dir(secKeyFile); dir != "" && dir != "." && dir != "/" {
138-
if err := os.MkdirAll(dir, 0755); err != nil {
138+
if err := os.MkdirAll(dir, 0o755); err != nil {
139139
log.Fatalf("Error: %v", err)
140140
}
141141
}
142142
if dir := filepath.Dir(pubKeyFile); dir != "" && dir != "." && dir != "/" {
143-
if err := os.MkdirAll(dir, 0755); err != nil {
143+
if err := os.MkdirAll(dir, 0o755); err != nil {
144144
log.Fatalf("Error: %v", err)
145145
}
146146
}
@@ -169,11 +169,11 @@ func generateKeyPair(secKeyFile, pubKeyFile string, force bool) {
169169
}
170170
fmt.Print("done\n\n")
171171

172-
var fileFlags = os.O_CREATE | os.O_WRONLY | os.O_TRUNC
172+
fileFlags := os.O_CREATE | os.O_WRONLY | os.O_TRUNC
173173
if !force {
174174
fileFlags |= os.O_EXCL // fail if the file already exists
175175
}
176-
skFile, err := os.OpenFile(secKeyFile, fileFlags, 0600)
176+
skFile, err := os.OpenFile(secKeyFile, fileFlags, 0o600)
177177
if err != nil {
178178
log.Fatalf("Error: %v", err)
179179
}
@@ -182,7 +182,7 @@ func generateKeyPair(secKeyFile, pubKeyFile string, force bool) {
182182
log.Fatalf("Error: %v", err)
183183
}
184184

185-
pkFile, err := os.OpenFile(pubKeyFile, fileFlags, 0644)
185+
pkFile, err := os.OpenFile(pubKeyFile, fileFlags, 0o644)
186186
if err != nil {
187187
log.Fatalf("Error: %v", err)
188188
}
@@ -234,7 +234,7 @@ func signFiles(secKeyFile, sigFile, untrustedComment, trustedComment string, fil
234234

235235
if sigFile != "" {
236236
if dir := filepath.Dir(sigFile); dir != "" && dir != "." && dir != "/" {
237-
if err := os.MkdirAll(dir, 0755); err != nil {
237+
if err := os.MkdirAll(dir, 0o755); err != nil {
238238
log.Fatalf("Error: %v", err)
239239
}
240240
}
@@ -247,30 +247,31 @@ func signFiles(secKeyFile, sigFile, untrustedComment, trustedComment string, fil
247247
log.Fatalf("Error: %v", err)
248248
}
249249

250-
var tComment, uComment = trustedComment, untrustedComment
250+
tComment, uComment := trustedComment, untrustedComment
251251
if uComment == "" {
252252
uComment = "signature from minisign secret key"
253253
}
254254
if tComment == "" {
255255
tComment = fmt.Sprintf("timestamp:%d\tfilename:%s", time.Now().Unix(), filepath.Base(name))
256256
}
257-
var reader = minisign.NewReader(file)
257+
reader := minisign.NewReader(file)
258258
if _, err = io.Copy(io.Discard, reader); err != nil {
259259
file.Close()
260260
log.Fatalf("Error: %v", err)
261261
}
262262
signature = reader.SignWithComments(privateKey, tComment, uComment)
263263
file.Close()
264264

265-
var signatureFile = name + ".minisig"
265+
signatureFile := name + ".minisig"
266266
if sigFile != "" {
267267
signatureFile = sigFile
268268
}
269-
if err = os.WriteFile(signatureFile, signature, 0644); err != nil {
269+
if err = os.WriteFile(signatureFile, signature, 0o644); err != nil {
270270
log.Fatalf("Error: %v", err)
271271
}
272272
}
273273
}
274+
274275
func verifyFile(sigFile, pubFile, pubKeyString string, printOutput, quiet, prettyQuiet, requireHash bool, files ...string) {
275276
if len(files) == 0 {
276277
log.Fatalf("Error: no files to verify. Use -m to specify a file path")
@@ -382,7 +383,7 @@ func recreateKeyPair(secKeyFile, pubKeyFile string, force bool) {
382383

383384
publicKey := privateKey.Public().(minisign.PublicKey)
384385
rawPublicKey, _ := publicKey.MarshalText()
385-
if err = os.WriteFile(pubKeyFile, rawPublicKey, 0644); err != nil {
386+
if err = os.WriteFile(pubKeyFile, rawPublicKey, 0o644); err != nil {
386387
log.Fatalf("Error: %v", err)
387388
}
388389
}

go.mod

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
module aead.dev/minisign
22

3-
go 1.16
3+
go 1.20
44

55
require (
6-
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83
7-
golang.org/x/sys v0.0.0-20210228012217-479acdf4ea46 // indirect
8-
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221
6+
golang.org/x/crypto v0.13.0
7+
golang.org/x/term v0.12.0
98
)
9+
10+
require golang.org/x/sys v0.12.0 // indirect

go.sum

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
2-
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83 h1:/ZScEX8SfEmUGRHs0gxpqteO5nfNW6axyZbBdw9A12g=
3-
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
4-
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
5-
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
6-
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
7-
golang.org/x/sys v0.0.0-20210228012217-479acdf4ea46 h1:V066+OYJ66oTjnhm4Yrn7SXIwSCiDQJxpBxmvqb1N1c=
8-
golang.org/x/sys v0.0.0-20210228012217-479acdf4ea46/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
9-
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221 h1:/ZHdbVpdR/jk3g30/d4yUL0JU9kksj8+F/bnQUVLGDM=
10-
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
11-
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
1+
golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck=
2+
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
3+
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
4+
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
5+
golang.org/x/term v0.12.0 h1:/ZfYdc3zq+q02Rv9vGqTeSItdzZTSNDmfTi0mBAuidU=
6+
golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=

0 commit comments

Comments
 (0)