Sample go project

This commit is contained in:
j 2025-06-17 15:45:03 +10:00
parent 52559a3072
commit de293b5f37
5 changed files with 38 additions and 1 deletions

View file

@ -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
View 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
View file

@ -0,0 +1,2 @@
module repobase.net/j/workflow-sample-go
go 1.22

5
internal/greet/greet.go Normal file
View file

@ -0,0 +1,5 @@
package greet
func Hello(name string) string {
return "Hello, " + name + "!"
}

7
pkg/util/util.go Normal file
View file

@ -0,0 +1,7 @@
package util
import fmt
func PrintVersion() {
fmt.Println("v4.2.0")
}