From f3d6ab9711998a336f37717f7698c810969f1df3 Mon Sep 17 00:00:00 2001 From: Mark Bates Date: Tue, 24 Jul 2018 11:37:59 +0200 Subject: [PATCH] Always display the version of pop/plush/other libraries used sort of fixes #1159 --- buffalo/cmd/info.go | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/buffalo/cmd/info.go b/buffalo/cmd/info.go index 37ce7656b..1fc3dd1e8 100644 --- a/buffalo/cmd/info.go +++ b/buffalo/cmd/info.go @@ -2,6 +2,7 @@ package cmd import ( "fmt" + "io" "os" "os/exec" "reflect" @@ -32,7 +33,10 @@ var infoCmd = &cobra.Command{ bb.WriteString(fmt.Sprintf("%s=%v\n", f.Name, rv.FieldByName(f.Name).Interface())) } - return runInfoCmds() + if err := runInfoCmds(); err != nil { + return errors.WithStack(err) + } + return infoGoMod() }, } @@ -43,6 +47,23 @@ type infoCommand struct { InfoLabel string } +func infoGoMod() error { + if _, err := os.Stat("go.mod"); err != nil { + return nil + } + f, err := os.Open("go.mod") + if err != nil { + return errors.WithStack(err) + } + defer f.Close() + + bb := os.Stdout + bb.WriteString("\n### go.mod\n") + io.Copy(bb, f) + + return nil +} + func runInfoCmds() error { commands := []infoCommand{