Skip to content

Commit

Permalink
deps: Updated all Go dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
skyzyx committed Nov 10, 2024
1 parent eafe668 commit 59a5fb4
Show file tree
Hide file tree
Showing 7 changed files with 165 additions and 427 deletions.
124 changes: 2 additions & 122 deletions cmd/version.go
Original file line number Diff line number Diff line change
@@ -1,131 +1,11 @@
// Copyright 2023-2024, Northwood Labs
// Copyright 2023-2024, Ryan Parman <rparman@northwood-labs.com>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package cmd

import (
"fmt"
"os"
"path/filepath"
"runtime"
"runtime/debug"
"strings"
"text/tabwriter"

"github.com/gookit/color"
"github.com/spf13/cobra"

"github.com/northwood-labs/golang-utils/archstring"
"github.com/northwood-labs/golang-utils/exiterrorf"
clihelpers "github.com/northwood-labs/cli-helpers"
)

var (
// Color text.
colorHeader = color.New(color.FgWhite, color.BgBlue, color.OpBold)

// Version represents the version of the software.
Version = "dev"

// Commit represents the git commit hash of the software.
Commit = vcs("vcs.revision", "unknown")

// BuildDate represents the date the software was built.
BuildDate = vcs("vcs.time", "unknown")

// Dirty represents whether or not the git repo was dirty when the software was built.
Dirty = vcs("vcs.modified", "unknown")

// PGOEnabled represents whether or not the build leveraged Profile-Guided Optimization (PGO).
PGOEnabled = vcs("-pgo", "false")

versionCmd = &cobra.Command{
Use: "version",
Short: "Long-form version information",
Long: `Long-form version information, including the build commit hash, build date, Go
version, and external dependencies.`,
Run: func(cmd *cobra.Command, args []string) {
colorHeader.Println(" BASIC ")

w := tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', 0)

fmt.Fprintf(w, " Version:\t%s\t\n", Version)
fmt.Fprintf(w, " Go version:\t%s\t\n", runtime.Version())
fmt.Fprintf(w, " Git commit:\t%s\t\n", Commit)
if Dirty == "true" {
fmt.Fprintf(w, " Dirty repo:\t%s\t\n", Dirty)
}
if !strings.Contains(PGOEnabled, "false") {
fmt.Fprintf(w, " PGO:\t%s\t\n", filepath.Base(PGOEnabled))
}
fmt.Fprintf(w, " Build date:\t%s\t\n", BuildDate)
fmt.Fprintf(w, " OS/Arch:\t%s/%s\t\n", runtime.GOOS, runtime.GOARCH)
fmt.Fprintf(w, " System:\t%s\t\n", archstring.GetFriendlyName(runtime.GOOS, runtime.GOARCH))
fmt.Fprintf(w, " CPU Cores:\t%d\t\n", runtime.NumCPU())

err := w.Flush()
if err != nil {
exiterrorf.ExitErrorf(err)
}

fmt.Println("")

//----------------------------------------------------------------------

if buildInfo, ok := debug.ReadBuildInfo(); ok {
colorHeader.Println(" DEPENDENCIES ")

w = tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', 0)

for i := range buildInfo.Deps {
dependency := buildInfo.Deps[i]
fmt.Fprintf(w, " %s\t%s\t\n", dependency.Path, dependency.Version)
}
}

err = w.Flush()
if err != nil {
exiterrorf.ExitErrorf(err)
}

// if info, ok := debug.ReadBuildInfo(); ok {
// for i := range info.Settings {
// setting := info.Settings[i]

// fmt.Printf("%s = %s\n", setting.Key, setting.Value)
// }
// }

fmt.Println("")
},
}
)
var versionCmd = clihelpers.VersionScreen()

func init() { // lint:allow_init
rootCmd.AddCommand(versionCmd)
}

func vcs(key, fallback string) string {
if info, ok := debug.ReadBuildInfo(); ok {
for i := range info.Settings {
setting := info.Settings[i]

if setting.Key == key {
return setting.Value
}
}
}

return fallback
}
48 changes: 19 additions & 29 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ replace github.com/imdario/mergo => github.com/imdario/mergo v0.3.16
require (
github.com/chanced/caps v1.0.2
github.com/google/go-cmp v0.6.0
github.com/gookit/color v1.5.4
github.com/gtramontina/ooze v0.2.0
github.com/hashicorp/go-version v1.7.0
github.com/hashicorp/terraform-plugin-framework v1.13.0
Expand All @@ -18,32 +17,27 @@ require (
github.com/lithammer/dedent v1.1.0
github.com/mitchellh/go-homedir v1.1.0
github.com/nlnwa/whatwg-url v0.5.0
github.com/northwood-labs/golang-utils/archstring v0.0.0-20240514195441-31b98331cf9f
github.com/northwood-labs/golang-utils/exiterrorf v0.0.0-20240514195441-31b98331cf9f
github.com/northwood-labs/cli-helpers v0.0.0-20240730151203-eb4931503c44
github.com/spf13/cobra v1.8.1
github.com/stretchr/testify v1.9.0
)

require (
github.com/BurntSushi/toml v1.2.1 // indirect
github.com/Kunde21/markdownfmt/v3 v3.1.0 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.2.0 // indirect
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
github.com/ProtonMail/go-crypto v1.1.2 // indirect
github.com/agext/levenshtein v1.2.3 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
github.com/armon/go-radix v1.0.0 // indirect
github.com/bgentry/speakeasy v0.1.0 // indirect
github.com/bits-and-blooms/bitset v1.14.3 // indirect
github.com/bmatcuk/doublestar/v4 v4.7.1 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/bits-and-blooms/bitset v1.15.0 // indirect
github.com/charmbracelet/bubbles v0.18.0 // indirect
github.com/charmbracelet/bubbletea v0.26.2 // indirect
github.com/charmbracelet/lipgloss v1.0.0 // indirect
github.com/charmbracelet/x/ansi v0.4.2 // indirect
github.com/cloudflare/circl v1.5.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
github.com/fatih/color v1.18.0 // indirect
github.com/go-test/deep v1.0.7 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/hashicorp/cli v1.1.6 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
Expand All @@ -58,52 +52,48 @@ require (
github.com/hashicorp/logutils v1.0.0 // indirect
github.com/hashicorp/terraform-exec v0.21.0 // indirect
github.com/hashicorp/terraform-json v0.23.0 // indirect
github.com/hashicorp/terraform-plugin-docs v0.20.0 // indirect
github.com/hashicorp/terraform-plugin-sdk/v2 v2.35.0 // indirect
github.com/hashicorp/terraform-registry-address v0.2.3 // indirect
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
github.com/hashicorp/yamux v0.1.2 // indirect
github.com/hexops/gotextdiff v1.0.3 // indirect
github.com/huandu/xstrings v1.3.3 // indirect
github.com/imdario/mergo v0.3.15 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/mattn/go-localereader v0.0.1 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
github.com/muesli/cancelreader v0.2.2 // indirect
github.com/muesli/reflow v0.3.0 // indirect
github.com/muesli/termenv v0.15.2 // indirect
github.com/northwood-labs/archstring v0.0.0-20240514202612-a86538822b29 // indirect
github.com/oklog/run v1.1.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/posener/complete v1.2.3 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/rogpeppe/go-internal v1.13.1 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
github.com/yuin/goldmark v1.7.7 // indirect
github.com/yuin/goldmark-meta v1.1.0 // indirect
github.com/zclconf/go-cty v1.15.0 // indirect
go.abhg.dev/goldmark/frontmatter v0.2.0 // indirect
golang.org/x/crypto v0.29.0 // indirect
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect
golang.org/x/mod v0.22.0 // indirect
golang.org/x/net v0.31.0 // indirect
golang.org/x/sync v0.9.0 // indirect
golang.org/x/sys v0.27.0 // indirect
golang.org/x/term v0.26.0 // indirect
golang.org/x/text v0.20.0 // indirect
golang.org/x/tools v0.26.0 // indirect
golang.org/x/tools v0.27.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 // indirect
google.golang.org/grpc v1.68.0 // indirect
google.golang.org/protobuf v1.35.1 // indirect
gopkg.in/yaml.v2 v2.3.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 59a5fb4

Please sign in to comment.