From 413ed58f7df58644f030ddf70cbd3b234270e579 Mon Sep 17 00:00:00 2001 From: Shulhan Date: Sat, 27 Mar 2021 16:34:31 +0700 Subject: cmd: rename the program trunks to trunks-example The trunks directory on command is actually the main program for example package. --- Makefile | 2 +- cmd/trunks-example/main.go | 36 ++++++++++++++++++++++++++++++++++++ cmd/trunks/main.go | 36 ------------------------------------ 3 files changed, 37 insertions(+), 37 deletions(-) create mode 100644 cmd/trunks-example/main.go delete mode 100644 cmd/trunks/main.go diff --git a/Makefile b/Makefile index fe70ef6..6ec65af 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ .PHONY: run run: - DEBUG=3 go run ./cmd/trunks + DEBUG=3 go run ./cmd/trunks-example diff --git a/cmd/trunks-example/main.go b/cmd/trunks-example/main.go new file mode 100644 index 0000000..854cf69 --- /dev/null +++ b/cmd/trunks-example/main.go @@ -0,0 +1,36 @@ +// Copyright 2021, Shulhan . All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +// Program trunks provide an example how to use the Trunks module. +// +package main + +import ( + "os" + "os/signal" + "syscall" + + "git.sr.ht/~shulhan/trunks/example" + "github.com/shuLhan/share/lib/mlog" +) + +func main() { + ex, err := example.New() + if err != nil { + mlog.Fatalf("%s\n", err) + } + + go func() { + c := make(chan os.Signal, 1) + signal.Notify(c, syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM) + <-c + ex.Stop() + }() + + err = ex.Start() + if err != nil { + mlog.Fatalf("%s\n", err) + } +} diff --git a/cmd/trunks/main.go b/cmd/trunks/main.go deleted file mode 100644 index 854cf69..0000000 --- a/cmd/trunks/main.go +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2021, Shulhan . All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// -// Program trunks provide an example how to use the Trunks module. -// -package main - -import ( - "os" - "os/signal" - "syscall" - - "git.sr.ht/~shulhan/trunks/example" - "github.com/shuLhan/share/lib/mlog" -) - -func main() { - ex, err := example.New() - if err != nil { - mlog.Fatalf("%s\n", err) - } - - go func() { - c := make(chan os.Signal, 1) - signal.Notify(c, syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM) - <-c - ex.Stop() - }() - - err = ex.Start() - if err != nil { - mlog.Fatalf("%s\n", err) - } -} -- cgit v1.3