How do I actually run a local Exercism project? Do we create our main()?

Using the CLI I ran exercism download --exercise=lasagna-master --track=go

I have already solved this on the website, but I want to do a revision using an IDE.

I can run standalone Go code just fine, but when I do go run lasagna_master.go I get

package command-line-arguments is not a main package

How do we iterate on this code? I have read Working Locally | Exercism's Docs and this is not clear.

Is part of working locally, needing to write our own main(), or is there some argument we’re supposed to include with Go?

1 Like

Typically you would run the tests locally. For exercises, you’re writing functions/libraries and not stand alone programs which can be run directly. You can write your own main() if you’d like, though.

1 Like

Thanks @IsaacG

For anyone new enough to Go that they haven’t run tests before:

user@host lasagna-master % go test -v
=== RUN   TestPreparationTime
=== RUN   TestPreparationTime/Preparation_time_for_many_layers_with_custom_average_time
=== RUN   TestPreparationTime/Preparation_time_for_few_layers
=== RUN   TestPreparationTime/Preparation_time_for_default_case
--- PASS: TestPreparationTime (0.00s)
    --- PASS: TestPreparationTime/Preparation_time_for_many_layers_with_custom_average_time (0.00s)
    --- PASS: TestPreparationTime/Preparation_time_for_few_layers (0.00s)
    --- PASS: TestPreparationTime/Preparation_time_for_default_case (0.00s)
=== RUN   TestQuantities
=== RUN   TestQuantities/few_layers
=== RUN   TestQuantities/many_layers
=== RUN   TestQuantities/no_noodles
=== RUN   TestQuantities/no_sauce
--- PASS: TestQuantities (0.00s)
    --- PASS: TestQuantities/few_layers (0.00s)
    --- PASS: TestQuantities/many_layers (0.00s)
    --- PASS: TestQuantities/no_noodles (0.00s)
    --- PASS: TestQuantities/no_sauce (0.00s)
=== RUN   TestAddSecretIngredient
=== RUN   TestAddSecretIngredient/Adds_secret_ingredient
--- PASS: TestAddSecretIngredient (0.00s)
    --- PASS: TestAddSecretIngredient/Adds_secret_ingredient (0.00s)
=== RUN   TestScaleRecipe
=== RUN   TestScaleRecipe/scales_up_correctly
=== RUN   TestScaleRecipe/scales_up_correctly_(2)
=== RUN   TestScaleRecipe/scales_down_correctly
=== RUN   TestScaleRecipe/empty_recipe
--- PASS: TestScaleRecipe (0.00s)
    --- PASS: TestScaleRecipe/scales_up_correctly (0.00s)
    --- PASS: TestScaleRecipe/scales_up_correctly_(2) (0.00s)
    --- PASS: TestScaleRecipe/scales_down_correctly (0.00s)
    --- PASS: TestScaleRecipe/empty_recipe (0.00s)
ok  	lasagna	0.426s