diff options
author | Franck Cuny <franck@fcuny.net> | 2024-01-22 08:07:58 -0800 |
---|---|---|
committer | Franck Cuny <franck@fcuny.net> | 2024-01-22 08:07:58 -0800 |
commit | ffd20492d19f547de3456249ed374ba752c2e1ab (patch) | |
tree | 90f587e26e77dfd28147e830fa0d87bf7ade28dd /cmd/flake-info | |
parent | disable linter for yaml (diff) | |
download | world-ffd20492d19f547de3456249ed374ba752c2e1ab.tar.gz |
build all the binaries using a Makefile
Add a Makefile to build the local binaries. Rename all the commands without a dash. We can build the commands with `make all` or by being explicit, for example `make bin/x509-info`. Add a common package to keep track of build information (commit and build date) so we can reuse the same pattern across all the commands.
Diffstat (limited to 'cmd/flake-info')
-rw-r--r-- | cmd/flake-info/main.go | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/cmd/flake-info/main.go b/cmd/flake-info/main.go deleted file mode 100644 index d41f321..0000000 --- a/cmd/flake-info/main.go +++ /dev/null @@ -1,43 +0,0 @@ -package main - -import ( - "errors" - "flag" - "fmt" - "os" - "time" - - "github.com/fcuny/world/pkg/flake/lock" -) - -func main() { - var flakeLockPath string - - flag.StringVar(&flakeLockPath, "flake-lock", "flake.lock", "path to the flake lock file") - - flag.Parse() - - if _, err := os.Stat(flakeLockPath); err != nil { - if errors.Is(err, os.ErrNotExist) { - fmt.Fprintf(os.Stderr, "%s does not exists\n", flakeLockPath) - } else { - fmt.Fprintf(os.Stderr, "failed to check if %s exists: %v\n", flakeLockPath, err) - } - os.Exit(1) - } - - lock, err := lock.New(flakeLockPath) - if err != nil { - fmt.Fprintf(os.Stderr, "failed to parse the lockfile for %s: %+v\n", flakeLockPath, err) - os.Exit(1) - } - - fmt.Printf("%s info:\n", flakeLockPath) - fmt.Printf("version: %d\n", lock.Version) - fmt.Printf("all nodes:\n") - for nodeName, node := range lock.Nodes { - date := time.Unix(node.Locked.LastModified, 0) - unitTimeInRFC3339 := date.Format(time.RFC3339) - fmt.Printf("- %s was updated on %s\n", nodeName, unitTimeInRFC3339) - } -} |