Skip to content

Commit

Permalink
Add troubleshooting about go caches (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
SirSpidey authored Jul 19, 2023
1 parent b5e6b44 commit 658f257
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ You can see the published documentation at https://terraform-ibm-modules.github.
- Governance
- Troubleshooting
- [Known issues](https://terraform-ibm-modules.github.io/documentation/#/issues.md)
- [How do I address errors when I run tests?](https://terraform-ibm-modules.github.io/documentation/#/ts-go-cache.md)
- [Report and issue or request a feature](https://terraform-ibm-modules.github.io/documentation/#/support.md)
- [Communities](https://terraform-ibm-modules.github.io/documentation/#/communities.md)
- [Contributing to the docs](https://terraform-ibm-modules.github.io/documentation/#/contribute-docs.md)
Expand Down
1 change: 1 addition & 0 deletions docs/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
- Governance
- Troubleshooting
- [Known issues](issues.md)
- [How do I address errors when I run tests?](ts-go-cache.md)
- [Report and issue or request a feature](support.md)
- [Communities](communities.md)
- [Contributing to the docs](contribute-docs.md)
4 changes: 3 additions & 1 deletion docs/inc-example-test.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@
make run-tests-local RUN=TestRunDefaultExample
```

If the tests run successfully, you see a `PASS` statement. The tests run the Terraform `init`, `plan`, and `apply` commands, runs a consistency check to make sure that the module is idempotent, and then destroys the resources.
If the tests run successfully, you see a `PASS` statement. If you see an error, see [How do I address errors when I run tests?](ts-go-cache.md).

The tests run the Terraform `init`, `plan`, and `apply` commands, runs a consistency check to make sure that the module is idempotent, and then destroys the resources.
19 changes: 19 additions & 0 deletions docs/ts-go-cache.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# How do I address errors when I run tests?

## What's happening

If you get Go errors after you issue the `make run-tests-local` command multiple times, you might have a corrupt Go cache.

## Why it's happening

Go caches the build outputs for reuse. Data is deleted periodically.

## How to fix it

Run `go clean -cache` to remove all cached data from the build process. Then run the tests again. The `-clean` option removes all cached packages, builds, and cached downloaded modules.

You can also run the command with these more specific options:
- The `-testcache` option removes the cached test results in the build cache.
- The `-modcache` option cleans the module download cache.

For more information, see [Build and test caching](https://pkg.go.dev/cmd/go#hdr-Build_and_test_caching) in the Go documentation.

0 comments on commit 658f257

Please sign in to comment.