refactor: clean code

This commit is contained in:
Fu Diwei
2025-01-15 22:45:02 +08:00
parent 974c320925
commit b657405e46
21 changed files with 68 additions and 68 deletions

View File

@@ -1,4 +1,4 @@
package x509
package certs
import (
"crypto/x509"

View File

@@ -1,4 +1,4 @@
package x509
package certs
import (
"crypto/ecdsa"

View File

@@ -1,4 +1,4 @@
package x509
package certs
import (
"crypto/ecdsa"

View File

@@ -1,4 +1,4 @@
package x509
package certs
import (
"bytes"

View File

@@ -1,4 +1,4 @@
package fs
package files
import (
"os"
@@ -7,7 +7,7 @@ import (
xerrors "github.com/pkg/errors"
)
// 与 [WriteFile] 类似,但写入的是字符串内容。
// 与 [Write] 类似,但写入的是字符串内容。
//
// 入参:
// - path: 文件路径。
@@ -15,8 +15,8 @@ import (
//
// 出参:
// - 错误。
func WriteFileString(path string, content string) error {
return WriteFile(path, []byte(content))
func WriteString(path string, content string) error {
return Write(path, []byte(content))
}
// 将数据写入指定路径的文件。
@@ -29,7 +29,7 @@ func WriteFileString(path string, content string) error {
//
// 出参:
// - 错误。
func WriteFile(path string, data []byte) error {
func Write(path string, data []byte) error {
dir := filepath.Dir(path)
err := os.MkdirAll(dir, os.ModePerm)