Sample go project
This commit is contained in:
parent
52559a3072
commit
de293b5f37
5 changed files with 38 additions and 1 deletions
10
README.md
10
README.md
|
@ -1,3 +1,11 @@
|
|||
# workflow-sample-go
|
||||
|
||||
Demonstrates how to configure a typical Go project.
|
||||
Demonstrates how to configure a typical Go project.
|
||||
|
||||
Project layout based on the
|
||||
[golang-standards/project-layout](https://github.com/golang-standards/project-layout)
|
||||
project layout standard (that was a mouthful) as I find it to be the most
|
||||
comfortable to work within.
|
||||
|
||||
The build pipelines are made for this standard and are probably difficult to
|
||||
adapt.
|
||||
|
|
15
cmd/sample/main.go
Normal file
15
cmd/sample/main.go
Normal file
|
@ -0,0 +1,15 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"repobase.net/j/internal/greet"
|
||||
"repobase.net/j/pkg/util"
|
||||
)
|
||||
|
||||
func main() {
|
||||
name := "World"
|
||||
message := greet.Hello(name)
|
||||
fmt.Println(message)
|
||||
|
||||
util.PrintVersion()
|
||||
}
|
2
go.mod
Normal file
2
go.mod
Normal file
|
@ -0,0 +1,2 @@
|
|||
module repobase.net/j/workflow-sample-go
|
||||
go 1.22
|
5
internal/greet/greet.go
Normal file
5
internal/greet/greet.go
Normal file
|
@ -0,0 +1,5 @@
|
|||
package greet
|
||||
|
||||
func Hello(name string) string {
|
||||
return "Hello, " + name + "!"
|
||||
}
|
7
pkg/util/util.go
Normal file
7
pkg/util/util.go
Normal file
|
@ -0,0 +1,7 @@
|
|||
package util
|
||||
|
||||
import fmt
|
||||
|
||||
func PrintVersion() {
|
||||
fmt.Println("v4.2.0")
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue