linter: Enable gofumpt and run against codebase (#1848)

* linter: Enable gofumpt and run against codebase

* Address shazbert's nits

* gofumpt: Fix issues after rebase
This commit is contained in:
Adrian Gallagher
2025-03-18 10:23:16 +11:00
committed by GitHub
parent 748ed71455
commit f5faca2eb2
189 changed files with 1541 additions and 1104 deletions

View File

@@ -41,10 +41,8 @@ const (
NumberCharacters = "0123456789"
)
var (
// emailRX represents email address matching pattern
emailRX = regexp.MustCompile("^[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$")
)
// emailRX represents email address matching pattern
var emailRX = regexp.MustCompile("^[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$")
// Vars for common.go operations
var (
@@ -136,7 +134,8 @@ func NewHTTPClientWithTimeout(t time.Duration) *http.Client {
}
h := &http.Client{
Transport: tr,
Timeout: t}
Timeout: t,
}
return h
}

View File

@@ -71,8 +71,8 @@ func TestGetRandomSalt(t *testing.T) {
func TestGetMD5(t *testing.T) {
t.Parallel()
var originalString = []byte("I am testing the MD5 function in common!")
var expectedOutput = []byte("18fddf4a41ba90a7352765e62e7a8744")
originalString := []byte("I am testing the MD5 function in common!")
expectedOutput := []byte("18fddf4a41ba90a7352765e62e7a8744")
actualOutput, err := GetMD5(originalString)
if err != nil {
t.Fatal(err)
@@ -86,8 +86,8 @@ func TestGetMD5(t *testing.T) {
func TestGetSHA512(t *testing.T) {
t.Parallel()
var originalString = []byte("I am testing the GetSHA512 function in common!")
var expectedOutput = []byte(
originalString := []byte("I am testing the GetSHA512 function in common!")
expectedOutput := []byte(
`a2273f492ea73fddc4f25c267b34b3b74998bd8a6301149e1e1c835678e3c0b90859fce22e4e7af33bde1711cbb924809aedf5d759d648d61774b7185c5dc02b`,
)
actualOutput, err := GetSHA512(originalString)
@@ -103,8 +103,8 @@ func TestGetSHA512(t *testing.T) {
func TestGetSHA256(t *testing.T) {
t.Parallel()
var originalString = []byte("I am testing the GetSHA256 function in common!")
var expectedOutput = []byte(
originalString := []byte("I am testing the GetSHA256 function in common!")
expectedOutput := []byte(
"0962813d7a9f739cdcb7f0c0be0c2a13bd630167e6e54468266e4af6b1ad9303",
)
actualOutput, err := GetSHA256(originalString)

View File

@@ -17,9 +17,7 @@ const (
ErrUnableToCloseFile string = "Unable to close file %v %v"
)
var (
addFilesToZip func(z *zip.Writer, src string, isDir bool) error
)
var addFilesToZip func(z *zip.Writer, src string, isDir bool) error
func init() {
addFilesToZip = addFilesToZipWrapper