diff --git a/.golangci.yml b/.golangci.yml index 01d2c92..c2ac8ce 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -186,3 +186,5 @@ linters: - nestif - nakedret - nonamedreturns + - depguard + - tagalign diff --git a/cmd/keystorev4/server.go b/cmd/keystorev4/server.go index a864f2a..cda4f58 100644 --- a/cmd/keystorev4/server.go +++ b/cmd/keystorev4/server.go @@ -32,7 +32,7 @@ var ( }, Run: func(cmd *cobra.Command, args []string) { - Run(cmd) + //Run(cmd) }, } ) @@ -40,4 +40,5 @@ var ( // Run runs the command. func Run(cmd *cobra.Command) (string, error) { + return "", nil } diff --git a/common/cryptor/aes.go b/common/cryptor/aes.go index 03bb873..1fefe64 100644 --- a/common/cryptor/aes.go +++ b/common/cryptor/aes.go @@ -46,7 +46,7 @@ func AesEncryptByECBBase64(data, key string) string { // 判断key长度 keyLenMap := map[int]struct{}{16: {}, 24: {}, 32: {}} if _, ok := keyLenMap[len(key)]; !ok { - panic("key长度必须是 16、24、32 其中一个") + panic("The key length must be 16, 24, 32 or one") } // 密钥和待加密数据转成[]byte originByte := []byte(data) @@ -75,7 +75,7 @@ func AesDecryptByECBBase64(data, key string) string { // 判断key长度 keyLenMap := map[int]struct{}{16: {}, 24: {}, 32: {}} if _, ok := keyLenMap[len(key)]; !ok { - panic("key长度必须是 16、24、32 其中一个") + panic("The key length must be 16, 24, 32 or one") } // 反解密码base64 originByte, _ := base64.StdEncoding.DecodeString(data) @@ -103,7 +103,7 @@ func AesEncryptByECB(data, key []byte) []byte { // 判断key长度 keyLenMap := map[int]struct{}{16: {}, 24: {}, 32: {}} if _, ok := keyLenMap[len(key)]; !ok { - panic("key长度必须是 16、24、32 其中一个") + panic("The key length must be 16, 24, 32 or one") } // 密钥和待加密数据转成[]byte originByte := data @@ -133,7 +133,7 @@ func AesDecryptByECB(data, key []byte) []byte { // 判断key长度 keyLenMap := map[int]struct{}{16: {}, 24: {}, 32: {}} if _, ok := keyLenMap[len(key)]; !ok { - panic("key长度必须是 16、24、32 其中一个") + panic("The key length must be 16, 24, 32 or one") } // 反解密码base64 //originByte, _ := base64.StdEncoding.DecodeString(data)