diff --git a/cmd/certificate_info_table.go b/cmd/certificate_info_table.go index 336aaf3ce..6d6b47505 100644 --- a/cmd/certificate_info_table.go +++ b/cmd/certificate_info_table.go @@ -26,7 +26,7 @@ func (t CertificateInfoTable) Print() { } table := boshtbl.Table{ - Title: color.New(color.Bold).Sprintf(color.YellowString("CERTIFICATE EXPIRY DATE INFORMATION")), + Title: color.New(color.Bold, color.FgYellow).Sprint("CERTIFICATE EXPIRY DATE INFORMATION"), Header: []boshtbl.Header{ boshtbl.NewHeader("Certificate"), boshtbl.NewHeader("Expiry Date (UTC)"), diff --git a/cmd/certificate_info_table_test.go b/cmd/certificate_info_table_test.go index 50c8faec6..d3a019e94 100644 --- a/cmd/certificate_info_table_test.go +++ b/cmd/certificate_info_table_test.go @@ -30,7 +30,7 @@ var _ = Describe("CertificateInfoTable", func() { cmd.CertificateInfoTable{Certificates: certsInfo, UI: ui}.Print() - Expect(ui.Table.Title).To(Equal(color.New(color.Bold).Sprintf(color.YellowString("CERTIFICATE EXPIRY DATE INFORMATION")))) + Expect(ui.Table.Title).To(Equal(color.New(color.Bold, color.FgYellow).Sprint("CERTIFICATE EXPIRY DATE INFORMATION"))) Expect(ui.Table.Header).To(Equal([]boshtbl.Header{ boshtbl.NewHeader("Certificate"), boshtbl.NewHeader("Expiry Date (UTC)"), diff --git a/cmd/environment_test.go b/cmd/environment_test.go index c59ed35aa..36d95138f 100644 --- a/cmd/environment_test.go +++ b/cmd/environment_test.go @@ -178,7 +178,7 @@ var _ = Describe("EnvironmentCmd", func() { err := act() Expect(err).ToNot(HaveOccurred()) Expect(ui.Table).To(Equal(boshtbl.Table{ - Title: color.New(color.Bold).Sprintf(color.YellowString("CERTIFICATE EXPIRY DATE INFORMATION")), + Title: color.New(color.Bold, color.FgYellow).Sprint("CERTIFICATE EXPIRY DATE INFORMATION"), Header: []boshtbl.Header{ boshtbl.NewHeader("Certificate"), boshtbl.NewHeader("Expiry Date (UTC)"), diff --git a/deployment/vm/vm.go b/deployment/vm/vm.go index ce8670716..9cd74c157 100644 --- a/deployment/vm/vm.go +++ b/deployment/vm/vm.go @@ -24,7 +24,8 @@ type Clock interface { Now() time.Time } -// go:generate counterfeiter . VM +// You only need **one** of these per package! +//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate type VM interface { CID() string diff --git a/director/config_diff.go b/director/config_diff.go index 7a0b7810d..75f8626b4 100644 --- a/director/config_diff.go +++ b/director/config_diff.go @@ -48,9 +48,9 @@ func (c Client) postConfigDiff(path string, manifest []byte, setHeaders func(*ht var descriptionExp = regexp.MustCompile(`description":"(.+?)"`) errorDescription := descriptionExp.FindStringSubmatch(err.Error()) if len(errorDescription) > 0 { - return resp, bosherr.Errorf(errorDescription[1]) + return resp, bosherr.Error(errorDescription[1]) } else { - return resp, bosherr.Errorf(err.Error()) + return resp, bosherr.Error(err.Error()) } } else { // endpoint couldn't be found => return empty diff, just for compatibility with directors which don't have the endpoint diff --git a/ssh/host.go b/ssh/host.go index bca685cc0..9f7ebd607 100644 --- a/ssh/host.go +++ b/ssh/host.go @@ -63,7 +63,7 @@ func (h *hostBuilder) BuildHost(slug boshdir.AllOrInstanceGroupOrInstanceSlug, u if targetVM.JobName == "" { return boshdir.Host{}, bosherr.Errorf("Instance %s has no active VM", slug) } - if targetVM.IPs == nil || len(targetVM.IPs) == 0 { + if len(targetVM.IPs) == 0 { return boshdir.Host{}, bosherr.Errorf("VM %s has no IP address", targetVM.VMID) } targetHost = targetVM.IPs[0] diff --git a/ui/table/writer.go b/ui/table/writer.go index d0d204d49..0a12efaaf 100644 --- a/ui/table/writer.go +++ b/ui/table/writer.go @@ -137,12 +137,12 @@ func (w *Writer) Flush() error { paddingSize := w.widths[colIdx] - len(col.String) if colIdx == lastColIdx { - _, err := fmt.Fprintf(w.w, w.borderStr) + _, err := fmt.Fprint(w.w, w.borderStr) if err != nil { return err } } else { - _, err := fmt.Fprintf(w.w, strings.Repeat(w.bgStr, paddingSize)+w.borderStr) + _, err := fmt.Fprint(w.w, strings.Repeat(w.bgStr, paddingSize)+w.borderStr) if err != nil { return err }