add package structure example
This commit is contained in:
parent
d937c0497a
commit
016b14ac21
4 changed files with 36 additions and 8 deletions
19
README.md
19
README.md
|
@ -1,15 +1,18 @@
|
|||
# go-organization
|
||||
|
||||
Understand project structure of GO. Go Modules, GOPATH, efficent development environment...
|
||||
Understand project structure of GO. Go Modules, GOPATH, efficent development environment... This repo contains lots of trash folder/file! Just trying to understand structure with trying lots of unnecessary things too
|
||||
|
||||
### Base Resources
|
||||
- https://github.com/golang/go/wiki/Modules
|
||||
- https://go.dev/blog/using-go-modules
|
||||
- https://github.com/golang-standards/project-layout
|
||||
- https://go.dev/doc/code
|
||||
- https://tutorialedge.net/golang/go-project-structure-best-practices/
|
||||
- https://www.digitalocean.com/community/tutorials/how-to-use-go-modules
|
||||
- https://go.dev/ref/mod
|
||||
| Resource | Explanation | Implementation |
|
||||
| -------- | ----------- | -------------- |
|
||||
| https://github.com/golang/go/wiki/Modules | - | - |
|
||||
| https://go.dev/blog/using-go-modules | - | - |
|
||||
| https://github.com/golang-standards/project-layout | - | - |
|
||||
| https://go.dev/doc/code | - | - |
|
||||
| https://tutorialedge.net/golang/go-project-structure-best-practices/ | - | - |
|
||||
| https://www.digitalocean.com/community/tutorials/how-to-use-go-modules | Modules | - |
|
||||
| https://www.digitalocean.com/community/tutorials/how-to-write-packages-in-go | Packages | [package-str](simple-structure/package-str/) |
|
||||
| https://go.dev/ref/mod | - | - |
|
||||
|
||||
### FAQ
|
||||
<details>
|
||||
|
|
3
simple-structure/go.mod
Normal file
3
simple-structure/go.mod
Normal file
|
@ -0,0 +1,3 @@
|
|||
module Liderahenk/go-organization/simple-structure
|
||||
|
||||
go 1.20
|
12
simple-structure/package-str/example/main.go
Normal file
12
simple-structure/package-str/example/main.go
Normal file
|
@ -0,0 +1,12 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"Liderahenk/go-organization/simple-structure/package-str/great"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
great.Hello()
|
||||
fmt.Println(great.Name)
|
||||
// fmt.Println(great.name2) // ERROR lowercase variables cannot be used outside of package itself
|
||||
}
|
10
simple-structure/package-str/great/great.go
Normal file
10
simple-structure/package-str/great/great.go
Normal file
|
@ -0,0 +1,10 @@
|
|||
package great
|
||||
|
||||
import "fmt"
|
||||
|
||||
var Name = "deniz"
|
||||
var name2 = "deniz2"
|
||||
|
||||
func Hello() {
|
||||
fmt.Println("Hello World (go-organization/simple-structure/package-str/great/great.go)")
|
||||
}
|
Loading…
Reference in a new issue