Skip to content

Commit

Permalink
style: format code with Gofumpt and Prettier
Browse files Browse the repository at this point in the history
This commit fixes the style issues introduced in 4f5a181 according to the output
from Gofumpt and Prettier.

Details: #2643
  • Loading branch information
deepsource-autofix[bot] authored and vankichi committed Sep 26, 2024
1 parent 4f5a181 commit 223aac3
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions hack/tools/deadlink/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"path/filepath"
"regexp"
"strings"
"unsafe"

"github.com/vdaas/vald/internal/file"
"github.com/vdaas/vald/internal/log"
Expand Down Expand Up @@ -175,15 +174,16 @@ func main() {
errLinks map[string]int
}
// result for each file path
var res = map[string]result{}
res := map[string]result{}
// map of external link to avoid DOS
var exLinks = map[string]int{}
exLinks := map[string]int{}
for _, path := range paths {
b, err := file.ReadFile(path)
if err != nil {
log.Fatal(err)
}
str := *(*string)(unsafe.Pointer(&b))
// str := *(*string)(unsafe.Pointer(&b))
str := string(b)
// get origin url
url = strings.TrimPrefix(reProp.FindString(str), PREFIX_PROP)
// init counter
Expand Down Expand Up @@ -231,6 +231,7 @@ func main() {
mu.Lock()
if _, ok := r.errLinks[k]; ok {
r.fail++
mu.Unlock()
continue
}
var code int
Expand Down Expand Up @@ -273,9 +274,6 @@ func main() {
}
fmt.Printf("count: %d, ok: %d, fail: %d\n\n", v.count, v.success, v.fail)
}
for k, v := range exLinks {
fmt.Printf("%s => %d\n", k, v)
}
fmt.Printf("\n[summary] all: %d, OK: %d, NG: %d\n", countAll, successAll, failAll)
if failAll > 0 {
os.Exit(1)
Expand Down

0 comments on commit 223aac3

Please sign in to comment.