Skip to content

Commit 72ce136

Browse files
authored
Fix linting issues (#113)
1 parent 631362b commit 72ce136

File tree

15 files changed

+32
-19
lines changed

15 files changed

+32
-19
lines changed

.golangci.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: "2"
2+
linters:
3+
settings:
4+
staticcheck:
5+
checks:
6+
- all
7+
- '-QF1008' # disable the rule QF1008

cli/cli.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Package cli configures the command line application.
2+
package cli

cli/common_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ func TestResolveByName(t *testing.T) {
393393
c := resolveByName(test.name)
394394
assert.Equal(t, test.expectedCert, c)
395395

396-
os.Remove(test.keyFile)
396+
assert.NoError(t, os.Remove(test.keyFile))
397397
})
398398
}
399399
}

cli/helper_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ func newMockUI(r io.Reader) *mockUI {
2323
}
2424

2525
func (u *mockUI) Ask(query string) (string, error) {
26-
fmt.Fprint(u.MockUi.OutputWriter, query)
26+
_, _ = fmt.Fprint(u.MockUi.OutputWriter, query)
27+
2728
line, err := u.reader.ReadString('\n')
2829
if err != nil {
2930
return "", err

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/moorara/gocert
22

3-
go 1.22.2
3+
go 1.24.4
44

55
require (
66
github.com/BurntSushi/toml v1.5.0
@@ -30,6 +30,6 @@ require (
3030
github.com/posener/complete v1.1.1 // indirect
3131
github.com/shopspring/decimal v1.2.0 // indirect
3232
github.com/spf13/cast v1.3.1 // indirect
33-
golang.org/x/crypto v0.31.0 // indirect
34-
golang.org/x/sys v0.28.0 // indirect
33+
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a // indirect
34+
golang.org/x/sys v0.0.0-20190412213103-97732733099d // indirect
3535
)

go.sum

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,12 @@ github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOf
5353
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
5454
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
5555
golang.org/x/crypto v0.0.0-20200414173820-0848c9571904/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
56+
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a h1:vclmkQCjlDX5OydZ9wv8rBCcS0QyQY66Mpf/7BZbInM=
5657
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
57-
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
58-
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
5958
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
6059
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
60+
golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI=
6161
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
62-
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
63-
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
6462
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
6563
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
6664
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

metadata/metadata.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Package metadata provides information about the application build.
12
package metadata
23

34
import "fmt"

pki/manager.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func NewX509Manager() Manager {
3434

3535
func checkName(name string) error {
3636
if name == "" {
37-
return errors.New("Name is not set")
37+
return errors.New("name is not set")
3838
}
3939

4040
pattern := "./*/" + name + ".*"
@@ -91,7 +91,7 @@ func (m *x509Manager) GenCert(config Config, claim Claim, c Cert) error {
9191
EmailAddresses: claim.EmailAddress,
9292

9393
BasicConstraintsValid: true,
94-
IsCA: true,
94+
IsCA: true,
9595

9696
SubjectKeyId: subjectKeyID,
9797
AuthorityKeyId: subjectKeyID,
@@ -284,7 +284,7 @@ func (m *x509Manager) SignCSR(configCA Config, cCA Cert, configCSR Config, cCSR
284284
// VerifyCert verifies a certificate using a ceritifcate authority
285285
func (m *x509Manager) VerifyCert(cCA, c Cert, dnsName string) error {
286286
if cCA.Type != CertTypeRoot && cCA.Type != CertTypeInterm {
287-
return errors.New("Certificate authority is invalid")
287+
return errors.New("certificate authority is invalid")
288288
}
289289

290290
chain, err := readCertificateChain(cCA.ChainPath())

pki/util.go renamed to pki/pki.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Package pki provides functions to generate and manage certificates and certificate requests.
12
package pki
23

34
import (
@@ -184,7 +185,7 @@ func readCertificateRequest(path string) (*x509.CertificateRequest, error) {
184185
func writeCertificateChain(c, cCA Cert) error {
185186
// Only an intermediate ca needs a certificate chain
186187
if c.Type != CertTypeInterm {
187-
return errors.New("Only intermediate CAs have certificate chain")
188+
return errors.New("only intermediate CAs have certificate chain")
188189
}
189190

190191
// CA can only be root or another intermediate
File renamed without changes.

0 commit comments

Comments
 (0)