Skip to content

Commit 9c60043

Browse files
committed
Fix formatting to prevent
=== Errors Error: providers-sdk/v1/lr/docs/docs.go:56:21: non-constant format string in call to fmt.Sprintf Error: cli/components/list.go:51:48: non-constant format string in call to fmt.Fprintf Error: apps/cnquery/cmd/bundle.go:103:28: non-constant format string in call to fmt.Fprintf Error: apps/cnquery/cmd/bundle.go:141:28: non-constant format string in call to fmt.Fprintf Error: providers-sdk/v1/inventory/asset.go:44:22: non-constant format string in call to fmt.Sprintf Signed-off-by: Christian Zunker <christian@mondoo.com>
1 parent 68fec76 commit 9c60043

7 files changed

Lines changed: 9 additions & 8 deletions

File tree

apps/cnquery/cmd/bundle.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ var queryPackLintCmd = &cobra.Command{
100100
if len(errors) > 0 {
101101
log.Error().Msg("could not validate query pack")
102102
for i := range errors {
103-
fmt.Fprintf(os.Stderr, stringx.Indent(2, errors[i]))
103+
fmt.Fprint(os.Stderr, stringx.Indent(2, errors[i]))
104104
}
105105
cmd.SilenceUsage = true
106106
cmd.SilenceErrors = true
@@ -138,7 +138,7 @@ var queryPackPublishCmd = &cobra.Command{
138138
if len(bundleErrors) > 0 {
139139
log.Error().Msg("could not validate query pack")
140140
for i := range bundleErrors {
141-
fmt.Fprintf(os.Stderr, stringx.Indent(2, bundleErrors[i]))
141+
fmt.Fprint(os.Stderr, stringx.Indent(2, bundleErrors[i]))
142142
}
143143
cmd.SilenceUsage = true
144144
cmd.SilenceErrors = true

cli/components/list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func (d itemDelegate) Render(w io.Writer, m list.Model, index int, listItem list
4848
}
4949
}
5050

51-
fmt.Fprintf(w, fn(str))
51+
fmt.Fprint(w, fn(str))
5252
}
5353

5454
type listModel struct {

providers-sdk/v1/inventory/asset.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ var assetPrintableKeys = []string{"name", "platform-id"}
1919
func (a *Asset) PrintableKeys() []string {
2020
return assetPrintableKeys
2121
}
22+
2223
func (a *Asset) PrintableValue(index int) string {
2324
switch assetPrintableKeys[index] {
2425
case "name":
@@ -41,7 +42,7 @@ func (a *Asset) HumanName() string {
4142
}
4243

4344
if a.Platform != nil {
44-
return fmt.Sprintf(a.Name + " (" + a.Platform.Title + ")")
45+
return fmt.Sprint(a.Name + " (" + a.Platform.Title + ")")
4546
}
4647

4748
return a.Name

providers-sdk/v1/lr/docs/docs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ type LrDocsDocumentation struct {
5353
}
5454

5555
func (d LrDocsDocumentation) MarshalGo() string {
56-
return fmt.Sprintf("Description: " + strconv.Quote(d.Description) + ",\n")
56+
return fmt.Sprint("Description: " + strconv.Quote(d.Description) + ",\n")
5757
}
5858

5959
type LrDocsRefs struct {

providers/os/resources/auditpol.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func (p *mqlAuditpol) list() ([]interface{}, error) {
2222
cmd := o.(*mqlPowershell)
2323
out := cmd.GetStdout()
2424
if out.Error != nil {
25-
return nil, fmt.Errorf("could not run auditpol: " + out.Error.Error())
25+
return nil, fmt.Errorf("could not run auditpol: %s", out.Error.Error())
2626
}
2727

2828
entries, err := windows.ParseAuditpol(strings.NewReader(out.Data))

providers/os/resources/pam/parser.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func ParseLine(line string) (*PamLine, error) {
3737
}
3838

3939
if len(fields) < 3 {
40-
return &PamLine{}, fmt.Errorf("Invalid pam entry" + line)
40+
return &PamLine{}, fmt.Errorf("Invalid pam entry: %s", line)
4141
}
4242

4343
// parse modules

providers/os/resources/secpol.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func (s *mqlSecpol) policy() (*windows.Secpol, error) {
3333
cmd := o.(*mqlCommand)
3434
out := cmd.GetStdout()
3535
if out.Error != nil {
36-
return nil, fmt.Errorf("could not run auditpol: " + out.Error.Error())
36+
return nil, fmt.Errorf("could not run auditpol: %s", out.Error.Error())
3737
}
3838

3939
policy, err := windows.ParseSecpol(strings.NewReader(out.Data))

0 commit comments

Comments
 (0)