mirror of
https://github.com/golang-standards/project-layout
synced 2024-11-18 21:25:53 +00:00
commit
9cea4efe7f
@ -4,7 +4,7 @@ This is a basic layout for Go application projects. It's not an official standar
|
||||
|
||||
If you are trying to learn Go or if you are building a PoC or a toy project for yourself this project layout is an overkill. Start with something really simple (a single `main.go` file is more than enough). As your project grows keep in mind that it'll be important to make sure your code is well structured otherwise you'll end up with a messy code with lots of hidden dependencies and global state. When you have more people working on the project you'll need even more structure. That's when it's important to introduce a common way to manage packages/libraries. When you have an open source project or when you know other projects import the code from your project repository that's when it's important to have private (aka `internal`) packages and code. Clone the repository, keep what you need and delete everything else! Just because it's there it doesn't mean you have to use it all. None of these patterns are used in every single project. Even the `vendor` pattern is not universal.
|
||||
|
||||
With Go 1.14 [`Go Modules`](https://github.com/golang/go/wiki/Modules) are finally ready for production. Use [`Go Modules`](https://blog.golang.org/using-go-modules) unless you have a specific reason not to use them and if you do then you don’t need to worry about $GOPATH and where you put your project. The basic `go.mod` file in the repo assumes your project is hosted on Github, but it's not a requirement. The module path can be anything though the first module path component should have a dot in its name (the current version of Go doesn't enforce it anymore, but if you are using slightly older versions don't be surprised if your builds fail without it). See Issues [`37554`](https://github.com/golang/go/issues/37554) and [`32819`](https://github.com/golang/go/issues/32819) if you want to know more about it.
|
||||
With Go 1.14 [`Go Modules`](https://github.com/golang/go/wiki/Modules) are finally ready for production. Use [`Go Modules`](https://blog.golang.org/using-go-modules) unless you have a specific reason not to use them and if you do then you don’t need to worry about $GOPATH and where you put your project. The basic `go.mod` file in the repo assumes your project is hosted on GitHub, but it's not a requirement. The module path can be anything though the first module path component should have a dot in its name (the current version of Go doesn't enforce it anymore, but if you are using slightly older versions don't be surprised if your builds fail without it). See Issues [`37554`](https://github.com/golang/go/issues/37554) and [`32819`](https://github.com/golang/go/issues/32819) if you want to know more about it.
|
||||
|
||||
This project layout is intentionally generic and it doesn't try to impose a specific Go package structure.
|
||||
|
||||
@ -149,7 +149,7 @@ Other assets to go along with your repository (images, logos, etc).
|
||||
|
||||
### `/website`
|
||||
|
||||
This is the place to put your project's website data if you are not using Github pages.
|
||||
This is the place to put your project's website data if you are not using GitHub pages.
|
||||
|
||||
See the [`/website`](website/README.md) directory for examples.
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# `/website`
|
||||
|
||||
This is the place to put your project's website data if you are not using Github pages.
|
||||
This is the place to put your project's website data if you are not using GitHub pages.
|
||||
|
||||
Examples:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user