cleanup: some redundant code clean up

Signed-off-by: guiyong.ou <guiyong.ou@daocloud.io>
This commit is contained in:
guiyong.ou 2023-08-14 17:36:25 +08:00
parent 9d618a17fb
commit 3d76c20f51
7 changed files with 12 additions and 12 deletions

View File

@ -30,7 +30,7 @@ func ValidArgsListCertificates(ctx context.Context, factory **Factory) func(_ *c
return nil, cobra.ShellCompDirectiveNoFileComp
}
f := (*factory)
f := *factory
if err := f.complete(); err != nil {
return nil, cobra.ShellCompDirectiveNoFileComp
}
@ -56,7 +56,7 @@ func ValidArgsListSecrets(ctx context.Context, factory **Factory) func(_ *cobra.
return nil, cobra.ShellCompDirectiveNoFileComp
}
f := (*factory)
f := *factory
if err := f.complete(); err != nil {
return nil, cobra.ShellCompDirectiveNoFileComp
}
@ -83,7 +83,7 @@ func ValidArgsListCertificateSigningRequests(ctx context.Context, factory **Fact
return nil, cobra.ShellCompDirectiveNoFileComp
}
f := (*factory)
f := *factory
if err := f.complete(); err != nil {
return nil, cobra.ShellCompDirectiveNoFileComp
}
@ -109,7 +109,7 @@ func ValidArgsListCertificateRequests(ctx context.Context, factory **Factory) fu
if len(args) > 0 {
return nil, cobra.ShellCompDirectiveNoFileComp
}
f := (*factory)
f := *factory
if err := f.complete(); err != nil {
return nil, cobra.ShellCompDirectiveNoFileComp
}

View File

@ -30,7 +30,7 @@ func TestConvert_Pointer_v1_LoggingConfiguration_To_v1_LoggingConfiguration(t *t
testInput := logs.NewOptions()
generalInput := &testInput
var nilTestInput *logsapi.LoggingConfiguration = nil
var nilInput **logsapi.LoggingConfiguration = &nilTestInput
var nilInput = &nilTestInput
testcases := map[string]struct {
in **logsapi.LoggingConfiguration

View File

@ -52,7 +52,7 @@ const (
var (
// RequeuePeriod is the default period after which an Order should be re-queued.
// It can be overriden in tests.
RequeuePeriod time.Duration = time.Second * 5
RequeuePeriod = time.Second * 5
)
func (c *controller) Sync(ctx context.Context, o *cmacme.Order) (err error) {

View File

@ -335,7 +335,7 @@ func TestEncodePKCS12Keystore(t *testing.T) {
})
t.Run("encodePKCS12Keystore *prepends* non-leaf certificates to the supplied CA certificate chain", func(t *testing.T) {
const password = "password"
var caChainInPEM []byte = mustSelfSignCertificate(t, nil)
var caChainInPEM = mustSelfSignCertificate(t, nil)
caChainIn, err := pki.DecodeX509CertificateChainBytes(caChainInPEM)
require.NoError(t, err)

View File

@ -34,7 +34,7 @@ import (
func Test_tsigHMACProvider_Generate(t *testing.T) {
var (
someSecret = base64.StdEncoding.EncodeToString(([]byte("foo-secret")))
someSecret = base64.StdEncoding.EncodeToString([]byte("foo-secret"))
someMessage = "foo-message"
someMessageMD5 = md5Message(t, []byte("foo-secret"), []byte("foo-message"))
someMessageSHA1 = sha1Message(t, []byte("foo-secret"), []byte("foo-message"))

View File

@ -280,7 +280,7 @@ func TestResolveConfServers(t *testing.T) {
// TODO: find a website which uses issuewild?
func TestValidateCAA(t *testing.T) {
for _, nameservers := range [][]string{RecursiveNameservers, []string{"https://1.1.1.1/dns-query"}, []string{"https://8.8.8.8/dns-query"}} {
for _, nameservers := range [][]string{RecursiveNameservers, {"https://1.1.1.1/dns-query"}, {"https://8.8.8.8/dns-query"}} {
// google installs a CAA record at google.com
// ask for the www.google.com record to test that

View File

@ -53,9 +53,9 @@ func TestAcmeOrdersController(t *testing.T) {
// some test values
var (
testName string = "acmetest"
challengeType string = "dns-01"
authType string = "dns"
testName = "acmetest"
challengeType = "dns-01"
authType = "dns"
)
// Initial ACME authorization to be returned by GetAuthorization.