commit
fa2bac276e
@ -0,0 +1 @@
|
||||
bin/
|
@ -0,0 +1,8 @@
|
||||
from golang:1.23-bookworm as build
|
||||
workdir /app
|
||||
copy . .
|
||||
run CGO_ENABLED=0 go build -o oombomb ./main.go
|
||||
|
||||
from scratch
|
||||
copy --from=build /app/oombomb /oombomb
|
||||
cmd ["/oombomb"]
|
@ -0,0 +1,26 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os/signal"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
)
|
||||
|
||||
func main() {
|
||||
ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGTERM, syscall.SIGKILL, syscall.SIGINT)
|
||||
defer cancel()
|
||||
init := "Hello, World!"
|
||||
ticker := time.NewTicker(time.Second)
|
||||
|
||||
mainloop:
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
break mainloop
|
||||
case <-ticker.C:
|
||||
init = strings.Repeat(init, 10)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue