Skip to content

Commit

Permalink
code review 1 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kartikeysemwal committed Sep 8, 2024
1 parent 3ad8778 commit 2bd3ae4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions internal/file/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func CreateOutputFile(target string, subcommand string, format string, outputDir
_, err := os.Stat(filename)

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

if os.IsNotExist(err) {
if _, err := os.Stat(outputDir + "/"); os.IsNotExist(err) {
if _, err := os.Stat(fmt.Sprintf("%s/", outputDir)); os.IsNotExist(err) {
CreateOutputFolder(outputDir)
}
// If the file doesn't exist, create it.
Expand Down
5 changes: 4 additions & 1 deletion pkg/crawler/useragents.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ import (
"time"
)

const (
maxRandomValue = 100
)

// genOsString generates a random OS string for a User Agent.
func genOsString() string {
source := rand.NewSource(time.Now().UnixNano())
Expand Down Expand Up @@ -151,7 +155,6 @@ func GenerateRandomUserAgent() string {
source := rand.NewSource(time.Now().UnixNano())
rng := rand.New(source)

const maxRandomValue = 100
decision := rng.Intn(maxRandomValue)

var ua string
Expand Down
1 change: 0 additions & 1 deletion pkg/output/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import (
"github.com/edoardottt/cariddi/pkg/scanner"
)

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

0 comments on commit 2bd3ae4

Please sign in to comment.