Let's get to work on the actual application! Our program takes as a command line argument the website URL we want to crawl (or at least the page we want to start from).
go build -o crawler && ./crawler BASE_URL
Or
go run . BASE_URL
Where BASE_URL is the root URL of the website we want to crawl. For example, you can test with my blog if you want: https://wagslane.dev.
You will need to process command line arguments for this step.
All your main function should do at this point is:
This is a good example of some code that's a bit weird to test with unit tests. Just run the dang thing with too few, just the right amount, and too many arguments to ensure it behaves as expected.
Run and submit the CLI tests from the root of your main package.
os.Args holds the CLI arguments, with the first item as the program path and the rest being the actual arguments, os.Args[1:].