Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit 626e923

Browse files
committed
fixup! Add golintci and fix errors
1 parent 18ae0da commit 626e923

File tree

8 files changed

+16
-17
lines changed

8 files changed

+16
-17
lines changed

.golangci.yml

-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,4 @@ linters-settings:
1313
funcs: # Run `go tool vet help printf` to see available settings for `printf` analyzer.
1414
- (cdr.dev/coder-cli/internal/clog).Tipf
1515
- (cdr.dev/coder-cli/internal/clog).Hintf
16-
- (cdr.dev/coder-cli/internal/clog).LogDebugf
1716
- (cdr.dev/coder-cli/internal/clog).Causef

internal/clog/error.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -112,18 +112,18 @@ func Bold(a string) string {
112112
return color.New(color.Bold).Sprint(a)
113113
}
114114

115-
// Tip formats according to the given format specifier and prepends a bolded "tip: " header.
116-
func Tip(format string, a ...interface{}) string {
115+
// Tipf formats according to the given format specifier and prepends a bolded "tip: " header.
116+
func Tipf(format string, a ...interface{}) string {
117117
return fmt.Sprintf("%s %s", Bold("tip:"), fmt.Sprintf(format, a...))
118118
}
119119

120-
// Hint formats according to the given format specifier and prepends a bolded "hint: " header.
121-
func Hint(format string, a ...interface{}) string {
120+
// Hintf formats according to the given format specifier and prepends a bolded "hint: " header.
121+
func Hintf(format string, a ...interface{}) string {
122122
return fmt.Sprintf("%s %s", Bold("hint:"), fmt.Sprintf(format, a...))
123123
}
124124

125-
// Cause formats according to the given format specifier and prepends a bolded "cause: " header.
126-
func Cause(format string, a ...interface{}) string {
125+
// Causef formats according to the given format specifier and prepends a bolded "cause: " header.
126+
func Causef(format string, a ...interface{}) string {
127127
return fmt.Sprintf("%s %s", Bold("cause:"), fmt.Sprintf(format, a...))
128128
}
129129

internal/cmd/auth.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414

1515
var errNeedLogin = clog.Fatal(
1616
"failed to read session credentials",
17-
clog.Hint(`did you run "coder login [https://coder.domain.com]"?`),
17+
clog.Hintf(`did you run "coder login [https://coder.domain.com]"?`),
1818
)
1919

2020
func newClient() (*coder.Client, error) {

internal/cmd/ceapi.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,6 @@ func findEnv(ctx context.Context, client *coder.Client, envName, userEmail strin
7878
"failed to find environment",
7979
fmt.Sprintf("environment %q not found in %q", envName, found),
8080
clog.BlankLine,
81-
clog.Tip("run \"coder envs ls\" to view your environments"),
81+
clog.Tipf("run \"coder envs ls\" to view your environments"),
8282
)
8383
}

internal/cmd/envs.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ coder envs --user charlie@coder.com ls -o json \
117117
if err = client.StopEnvironment(cmd.Context(), env.ID); err != nil {
118118
atomic.AddInt32(&fails, 1)
119119
err = clog.Fatal(fmt.Sprintf("stop environment %q", env.Name),
120-
clog.Cause(err.Error()), clog.BlankLine,
121-
clog.Hint("current environment status is %q", env.LatestStat.ContainerStatus),
120+
clog.Causef(err.Error()), clog.BlankLine,
121+
clog.Hintf("current environment status is %q", env.LatestStat.ContainerStatus),
122122
)
123123
clog.Log(err)
124124
return err
@@ -186,7 +186,7 @@ coder envs create --cpu 4 --disk 100 --memory 8 --image 5f443b16-30652892427b955
186186
clog.LogSuccess(
187187
"creating environment...",
188188
clog.BlankLine,
189-
clog.Tip(`run "coder envs watch-build %q" to trail the build logs`, args[0]),
189+
clog.Tipf(`run "coder envs watch-build %q" to trail the build logs`, args[0]),
190190
)
191191

192192
if follow {
@@ -205,7 +205,7 @@ coder envs create --cpu 4 --disk 100 --memory 8 --image 5f443b16-30652892427b955
205205
cmd.Flags().IntP("gpus", "g", defaultGPUs, "number GPUs an environment should be provisioned with.")
206206
cmd.Flags().StringVarP(&img, "image", "i", "", "ID of the image to base the environment off of.")
207207
cmd.Flags().BoolVar(&follow, "follow", false, "follow buildlog after initiating rebuild")
208-
cmd.MarkFlagRequired("image")
208+
_ = cmd.MarkFlagRequired("image")
209209
return cmd
210210
}
211211

@@ -296,7 +296,7 @@ coder envs edit back-end-env --disk 20`,
296296
clog.LogSuccess(
297297
"applied changes to the environment, rebuilding...",
298298
clog.BlankLine,
299-
clog.Tip(`run "coder envs watch-build %q" to trail the build logs`, envName),
299+
clog.Tipf(`run "coder envs watch-build %q" to trail the build logs`, envName),
300300
)
301301
return nil
302302
},

internal/cmd/rebuild.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ coder envs rebuild backend-env --force`,
5858
} else {
5959
clog.LogSuccess(
6060
"successfully started rebuild",
61-
clog.Tip("run \"coder envs watch-build %s\" to follow the build logs", env.Name),
61+
clog.Tipf("run \"coder envs watch-build %s\" to follow the build logs", env.Name),
6262
)
6363
}
6464
return nil

internal/cmd/resourcemanager.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ func printResourceTop(writer io.Writer, groups []groupable, labeler envLabeler,
214214
if len(userResources) == 0 {
215215
clog.LogInfo(
216216
"no groups for the given filters exist with active environments",
217-
clog.Tip("run \"--show-empty\" to see groups with no resources."),
217+
clog.Tipf("run \"--show-empty\" to see groups with no resources."),
218218
)
219219
}
220220
return nil

internal/cmd/shell.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ func networkErr(client *coder.Client, env *coder.Environment) error {
201201
fmt.Sprintf("environment %q is not running", env.Name),
202202
fmt.Sprintf("its current status is %q", env.LatestStat.ContainerStatus),
203203
clog.BlankLine,
204-
clog.Tip("run \"coder envs rebuild %s --follow\" to start the environment", env.Name),
204+
clog.Tipf("run \"coder envs rebuild %s --follow\" to start the environment", env.Name),
205205
)
206206
}
207207
return xerrors.Errorf("network error, is %q online?", env.Name)

0 commit comments

Comments
 (0)