first commit

This commit is contained in:
sam 2024-07-11 18:33:01 +12:00
commit 16f349df23
2 changed files with 27 additions and 0 deletions

3
go.mod Normal file
View file

@ -0,0 +1,3 @@
module git.samahh.dev/sam/go-helpers
go 1.22.5

24
helpers.go Normal file
View file

@ -0,0 +1,24 @@
package helpers
import (
"fmt"
"log"
)
func Input(text string) string {
fmt.Print(text)
var input string
fmt.Scanln(&input)
return input
}
func HandleError(err error) {
if err != nil {
log.Fatal(err)
}
}
func PassthroughError[T any](val T, err error) any {
HandleError(err)
return val
}