Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/welcome - nothing major, just icons #213

Merged
merged 9 commits into from
Nov 20, 2024
2 changes: 1 addition & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ linters:
- staticcheck
- dupl
- errorlint
- exportloopref
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARN The linter 'exportloopref' is deprecated (since v1.60.2) due to: Since Go1.22 (loopvar) this linter is no longer relevant. Replaced by copyloopvar.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

- copyloopvar
- goconst
- gocritic
- gocyclo
Expand Down
23 changes: 13 additions & 10 deletions gobrew.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,31 +114,33 @@ func (gb *GoBrew) Interactive(ask bool) {
fmt.Println()

if currentVersion == NoneVersion {
color.Warnln("GO Installed Version", ".......", currentVersion)
color.Warnln("🚨 Installed Version", ".......", currentVersion, "⚠️")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we use UTF-8 characters, how will this work on remote machines? Or where a different code page is used? Didn't check?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didn't check. UTF8 support should be there on most machines. User can always use gobrew <command>
This PR only effects the gobrew interactive command.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

} else {
var labels []string
if modVersion != NoneVersion && currentMajorVersion != modVersion {
labels = append(labels, "not same as go.mod")
labels = append(labels, "🔄 not same as go.mod")
}
if currentVersion != latestVersion {
labels = append(labels, "not latest")
labels = append(labels, "⬆️ not latest")
}
label := ""
if len(labels) > 0 {
label = "(" + strings.Join(labels, ", ") + ")"
label = " " + color.FgRed.Render(label)
}
color.Successln("GO Installed Version", ".......", currentVersion+label)
if currentVersion != latestVersion {
color.Successln("✅ Installed Version", ".......", currentVersion+label, "\t🌟", latestVersion, "available")
} else {
color.Successln("✅ Installed Version", ".......", currentVersion+label, "\t🎉", "on latest")
}
}

if modVersion != NoneVersion && latestMajorVersion != modVersion {
label := " " + color.FgYellow.Render("(not latest)")
color.Successln("GO go.mod Version", " .......", modVersion+label)
label := " " + color.FgYellow.Render("\t⚠️ not latest")
color.Successln("📄 go.mod Version", " .......", modVersion+label)
} else {
color.Successln("GO go.mod Version", " .......", modVersion)
color.Successln("📄 go.mod Version", " .......", modVersion)
}

color.Successln("GO Latest Version", " .......", latestVersion)
fmt.Println()

if currentVersion == NoneVersion {
Expand All @@ -154,7 +156,8 @@ func (gb *GoBrew) Interactive(ask bool) {
}

if modVersion != NoneVersion && currentMajorVersion != modVersion {
color.Warnf("GO Installed Version (%s) and go.mod Version (%s) are different.\n", currentMajorVersion, modVersion)
color.Warnf("⚠️ GO Installed Version (%s) and go.mod Version (%s) are different.\n", currentMajorVersion, modVersion)
fmt.Println(" Please consider updating your go.mod file")
c := true
if ask {
c = askForConfirmation("Do you want to use GO version same as go.mod version (" + modVersion + "@latest)?")
Expand Down
4 changes: 0 additions & 4 deletions helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ func TestJudgeVersion(t *testing.T) {
// },
}
for _, test := range tests {
test := test
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

╰─$ golangci-lint run ./...
helpers_test.go:61:3: The copy of the 'for' variable "test" can be deleted (Go 1.22+) (copyloopvar)
		test := test
		^
helpers_test.go:143:3: The copy of the 'for' variable "tt" can be deleted (Go 1.22+) (copyloopvar)
		tt := tt
		^
helpers_test.go:183:3: The copy of the 'for' variable "tt" can be deleted (Go 1.22+) (copyloopvar)
		tt := tt
		^
helpers_test.go:216:3: The copy of the 'for' variable "tt" can be deleted (Go 1.22+) (copyloopvar)
		tt := tt
		^

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

t.Run(test.version, func(t *testing.T) {
t.Parallel()
ts := httptest.NewServer(http.FileServer(http.Dir("testdata")))
Expand Down Expand Up @@ -140,7 +139,6 @@ func TestExtractMajorVersion(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
if got := extractMajorVersion(tt.args.version); got != tt.want {
Expand Down Expand Up @@ -180,7 +178,6 @@ func TestGoBrew_extract(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
ts := httptest.NewServer(http.FileServer(http.Dir("testdata")))
Expand Down Expand Up @@ -213,7 +210,6 @@ func Test_doRequest(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
ts := httptest.NewServer(http.FileServer(http.Dir("testdata")))
Expand Down
Loading