Skip to content

Commit 2bd3ae4

Browse files
code review 1 changes
1 parent 3ad8778 commit 2bd3ae4

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

internal/file/file.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func CreateOutputFile(target string, subcommand string, format string, outputDir
8484
_, err := os.Stat(filename)
8585

8686
if os.IsNotExist(err) {
87-
if _, err := os.Stat(outputDir + "/"); os.IsNotExist(err) {
87+
if _, err := os.Stat(fmt.Sprintf("%s/", outputDir)); os.IsNotExist(err) {
8888
CreateOutputFolder(outputDir)
8989
}
9090
// If the file doesn't exist, create it.
@@ -123,7 +123,7 @@ func CreateIndexOutputFile(filename string, outputDir string) {
123123
_, err := os.Stat(filename)
124124

125125
if os.IsNotExist(err) {
126-
if _, err := os.Stat(outputDir + "/"); os.IsNotExist(err) {
126+
if _, err := os.Stat(fmt.Sprintf("%s/", outputDir)); os.IsNotExist(err) {
127127
CreateOutputFolder(outputDir)
128128
}
129129
// If the file doesn't exist, create it.

pkg/crawler/useragents.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ import (
3535
"time"
3636
)
3737

38+
const (
39+
maxRandomValue = 100
40+
)
41+
3842
// genOsString generates a random OS string for a User Agent.
3943
func genOsString() string {
4044
source := rand.NewSource(time.Now().UnixNano())
@@ -151,7 +155,6 @@ func GenerateRandomUserAgent() string {
151155
source := rand.NewSource(time.Now().UnixNano())
152156
rng := rand.New(source)
153157

154-
const maxRandomValue = 100
155158
decision := rng.Intn(maxRandomValue)
156159

157160
var ua string

pkg/output/output.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ import (
3636
"github.com/edoardottt/cariddi/pkg/scanner"
3737
)
3838

39-
// constant defined in file.go as well, redefining here for circular dependency.
4039
const (
4140
CariddiOutputFolder = "output-cariddi"
4241
)

0 commit comments

Comments
 (0)