Backup/main before prs#5
Conversation
| err = cmd.Run() | ||
| if err != nil { | ||
| return "", err | ||
| } |
There was a problem hiding this comment.
When a function returns a single output and this output is checked in an if (and only in this if) it should be one line:
if err = cmd.Run(); err != nil {
return "", err
}
This is a common pattern in error handling
| if err != nil { | ||
| return nil, err | ||
| } | ||
| defer os.RemoveAll(repoDir) |
There was a problem hiding this comment.
To avoid saving unnecessary data on my computer.
I'm making sure that all the cloned data is being erased when I'm done with it.
| @@ -0,0 +1,20 @@ | |||
| package repository | |||
There was a problem hiding this comment.
Because this is the file that is in charge of communicating with the data,
from what I know the layer that is accessing the data is the repository layer.
| "github.com/yagreut/onboardingAssignment/repository" | ||
| "github.com/yagreut/onboardingAssignment/service" | ||
|
|
||
| "github.com/sirupsen/logrus" |
There was a problem hiding this comment.
I have compared it against 2 more popular loggers and this one was both user friendly and met the assignment's demands.
| logrus.Fatal("Usage: go run main.go <input_file.json>") | ||
| } | ||
|
|
||
| inputFile := os.Args[1] |
There was a problem hiding this comment.
Let's enhance the task - add a secret scanning capability:
For each file, except for the large files, search whether it contains a GitHub Token.
Explore how to do it :)
If something is not clear, please ask
Mini repository scanner. Prompts user for file name and content. Saves the content into a file with the required name in a json format. The scanner clones the repo into a temp folder, scans it and returns a json list of the files in the repository that are bigger than a certain size.