Kaynağa Gözat

Add state to example

Ben 1 hafta önce
ebeveyn
işleme
3588e9a476
3 değiştirilmiş dosya ile 13 ekleme ve 1 silme
  1. 4 1
      go.mod
  2. 2 0
      go.sum
  3. 7 0
      main.go

+ 4 - 1
go.mod

@@ -2,4 +2,7 @@ module myjob
 
 go 1.25.0
 
-require dario.cat/mergo v1.0.2
+require (
+	dario.cat/mergo v1.0.2
+	git.bazzel.dev/bmallen/helios v0.0.0-20260220151042-142c415c823c
+)

+ 2 - 0
go.sum

@@ -1,2 +1,4 @@
 dario.cat/mergo v1.0.2 h1:85+piFYR1tMbRrLcDwR18y4UKJ3aH1Tbzi24VRW1TK8=
 dario.cat/mergo v1.0.2/go.mod h1:E/hbnu0NxMFBjpMIE34DRGLWqDy0g5FuKDhCb31ngxA=
+git.bazzel.dev/bmallen/helios v0.0.0-20260220151042-142c415c823c h1:2t9BMjRh40cW9PJ/jZkn7D36mK66XNGGTRROHnhXqz8=
+git.bazzel.dev/bmallen/helios v0.0.0-20260220151042-142c415c823c/go.mod h1:ELOHVMwr7s8WJ+DqRHKLyDRyE1qeWjsGtJuoXoQr5gY=

+ 7 - 0
main.go

@@ -5,7 +5,10 @@ import (
 	"log"
 	"myjob/libs/foo"
 	"os/exec"
+	"time"
+
 	"dario.cat/mergo"
+	"git.bazzel.dev/bmallen/helios/state"
 )
 
 var (
@@ -14,6 +17,8 @@ var (
 
 func init() {
 	log.Println("main init")
+	fmt.Println("ID: ", state.ID())
+
 }
 
 type Foo struct {
@@ -36,6 +41,8 @@ func main() {
 
 	fmt.Print(string(out))
 
+	state.Set("myvar", time.Now())
+	
 	first := "first"
 	second := "second"
 	src := Foo{