Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project layout and tests #22

Closed
harshabangi opened this issue Nov 5, 2023 · 5 comments
Closed

Project layout and tests #22

harshabangi opened this issue Nov 5, 2023 · 5 comments

Comments

@harshabangi
Copy link

harshabangi commented Nov 5, 2023

The project layout does not adhere to the standard Go practice. For the Go project layout, please refer to the following link: https://github.com/golang-standards/project-layout#go-directories. In Go projects, you will typically find test files (unit tests) in the same directory as the code files. To align with the standard layout, move the test files in the 'tests' folder within their respective directories. Integration tests should be placed in the 'tests' folder.

@FaizBShah
Copy link
Contributor

FaizBShah commented Nov 5, 2023

@championswimmer mentioned in their tweet that this project is designed slightly different from the traditional Go project. Its following more of a Node.js project style

@thecaffeinedev
Copy link

+1 @FaizBShah. Russ Cox (one of the creators of Go) has spoken out against the golang-standards/project-layout repository.

This is the only official recommendation https://go.dev/doc/modules/layout

@harshabangi
Copy link
Author

harshabangi commented Nov 6, 2023

@thecaffeinedev Thanks for pointing out. We can follow the example directory structure that is under Server Project in the blog. The intention was to have cli code under cmd, server code under internal, library code under pkg etc.

@championswimmer
Copy link
Owner

We can move unit tests into the src folder, I am ok with that

I'll also add a VSCode and IntelliJ rule that collapses tests inside the file (on project browser) so that it doesn't pollute the view so much)

Thanks @harshabangi @FaizBShah @thecaffeinedev for inputs

@championswimmer
Copy link
Owner

Here's what I have done to hide the test files in the explorer view.

https://arnav.tech/nesting-test-files-under-the-main-file-in-project-view-of-visual-studio-code-and-jetbrains-ides

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants