Skip to content

fix: Create doc directory if doesn't exist#220

Merged
yevgenypats merged 3 commits intocloudquery:mainfrom
erezrokah:fix/ensure_docs_dir
Oct 3, 2022
Merged

fix: Create doc directory if doesn't exist#220
yevgenypats merged 3 commits intocloudquery:mainfrom
erezrokah:fix/ensure_docs_dir

Conversation

@erezrokah
Copy link
Copy Markdown
Member

Summary

If you run the doc command and the output directory doesn't exist, the command will fail. This fixes it


Use the following steps to ensure your PR is ready to be reviewed

  • Read the contribution guidelines 🧑‍🎓
  • Run go fmt to format your code 🖊
  • Lint your changes via golangci-lint run 🚨 (install golangci-lint here)
  • Update or add tests 🧪
  • Ensure the status checks below are successful ✅

@erezrokah erezrokah force-pushed the fix/ensure_docs_dir branch from b4ed024 to 1061746 Compare October 2, 2022 12:22
// GenerateSourcePluginDocs creates table documentation for the source plugin based on its list of tables
func (p *SourcePlugin) GenerateSourcePluginDocs(dir string) error {
for _, table := range p.Tables() {
if err := os.MkdirAll(dir, os.ModePerm); err != nil {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thinks this should be before the loop

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, no need to print to stdout as it return an error anyway and it will print (otherwise it will be printed twice which will be confusing). same of the underlying line (I know not related to this PR)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thinks this should be before the loop

Good point, fixed in d6e2729. I think it has the downside of creating the directory even if there are no tables, but I don't think that's a concern we should be dealing with.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, no need to print to stdout as it return an error anyway and it will print (otherwise it will be printed twice which will be confusing). same of the underlying line (I know not related to this PR)

Fixed in #226

@erezrokah erezrokah mentioned this pull request Oct 3, 2022
5 tasks
yevgenypats pushed a commit that referenced this pull request Oct 3, 2022
#### Summary

<!-- 🎉 Thank you for making CloudQuery awesome by submitting a PR 🎉 -->


Extracted from #220
@yevgenypats yevgenypats enabled auto-merge (squash) October 3, 2022 08:21
@yevgenypats yevgenypats merged commit 067534d into cloudquery:main Oct 3, 2022
kodiakhq bot pushed a commit that referenced this pull request Oct 3, 2022
🤖 I have created a release *beep* *boop*
---


## [0.11.5](v0.11.4...v0.11.5) (2022-10-03)


### Bug Fixes

* Create doc directory if doesn't exist ([#220](#220)) ([067534d](067534d))
* **deps:** Update golang.org/x/exp digest to 540bb73 ([#212](#212)) ([2e3dae3](2e3dae3))
* **deps:** Update golang.org/x/sync digest to 8fcdb60 ([#213](#213)) ([7d7d85f](7d7d85f))
* Remove redundant error print ([#226](#226)) ([9927ede](9927ede))
* Remove unused docs template function ([#221](#221)) ([f65f023](f65f023))
* Use correct path for Windows zip ([#223](#223)) ([960f650](960f650))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants