Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/build_and_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ jobs:
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: ${{ env.PUSH_IMAGE }}
goreleaser:
if: github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
needs:
- native
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ jobs:
go-version: stable
- name: golangci-lint
# https://github.com/golangci/golangci-lint-action
uses: golangci/golangci-lint-action@55c2c1448f86e01eaae002a5a3a9624417608d84 # v6.5.2
uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0
with:
version: v1.64.5
version: v2.9.0
2 changes: 1 addition & 1 deletion cmd/aclsetup.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func NewAclSetupCmd() *cobra.Command {
if err != nil {
return err
}
fmt.Fprintln(cmd.OutOrStdout(), "Event ID: ", eventId)
_, _ = fmt.Fprintln(cmd.OutOrStdout(), "Event ID: ", eventId)
return nil
},
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/buildiso.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func NewBuildisoCmd() *cobra.Command {
if err != nil {
return err
}
fmt.Fprintf(cmd.OutOrStdout(), "Event ID: %s\n", eventId)
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "Event ID: %s\n", eventId)
return nil
},
}
Expand Down
10 changes: 5 additions & 5 deletions cmd/distro.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ func NewDistroAddCmd() (*cobra.Command, error) {
if err != nil {
return err
}
fmt.Fprintf(cmd.OutOrStdout(), "Distro %s created\n", distro.Name)
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "Distro %s created\n", distro.Name)
return nil
},
}
Expand Down Expand Up @@ -570,7 +570,7 @@ func reportDistros(cmd *cobra.Command, distroNames []string) error {
return err
}
printStructured(cmd, distro)
fmt.Fprintln(cmd.OutOrStdout(), "")
_, _ = fmt.Fprintln(cmd.OutOrStdout(), "")
}
return nil
}
Expand Down Expand Up @@ -656,15 +656,15 @@ func NewDistroExportCmd() *cobra.Command {
if err != nil {
return err
}
fmt.Fprintln(cmd.OutOrStdout(), string(jsonDocument))
_, _ = fmt.Fprintln(cmd.OutOrStdout(), string(jsonDocument))
}
if formatOption == "yaml" {
yamlDocument, err := yaml.Marshal(distro)
if err != nil {
return err
}
fmt.Fprintln(cmd.OutOrStdout(), "---")
fmt.Fprintln(cmd.OutOrStdout(), string(yamlDocument))
_, _ = fmt.Fprintln(cmd.OutOrStdout(), "---")
_, _ = fmt.Fprintln(cmd.OutOrStdout(), string(yamlDocument))
}
}
return nil
Expand Down
4 changes: 2 additions & 2 deletions cmd/distro_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func newDistroGroupAddCmd() *cobra.Command {
if err != nil {
return err
}
fmt.Fprintf(cmd.OutOrStdout(), "Distro group %s created\n", created.Name)
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "Distro group %s created\n", created.Name)
return nil
},
}
Expand Down Expand Up @@ -233,7 +233,7 @@ func newDistroGroupReportCmd() *cobra.Command {
return err
}
printStructured(cmd, g)
fmt.Fprintln(cmd.OutOrStdout(), "")
_, _ = fmt.Fprintln(cmd.OutOrStdout(), "")
}
return nil
},
Expand Down
8 changes: 4 additions & 4 deletions cmd/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func NewEventStatusCmd() *cobra.Command {
if err != nil {
return err
}
fmt.Fprintln(cmd.OutOrStdout(), event.State)
_, _ = fmt.Fprintln(cmd.OutOrStdout(), event.State)
return nil
},
}
Expand Down Expand Up @@ -84,13 +84,13 @@ func NewEventListCmd() *cobra.Command {
stateWidth = len(event.State)
}
}
fmt.Fprintf(cmd.OutOrStdout(), "%*s | %*s | %*s | %*s | %s \n", idWidth, "ID", nameWidth, "Name", stateWidth, "Task State", stateTimeWidth, "Time (last transitioned)", "Read by Who")
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "%*s | %*s | %*s | %*s | %s \n", idWidth, "ID", nameWidth, "Name", stateWidth, "Task State", stateTimeWidth, "Time (last transitioned)", "Read by Who")
for _, event := range events {
stateTimeStruct, err := covertFloatToUtcTime(event.StateTime)
if err != nil {
return err
}
fmt.Fprintf(cmd.OutOrStdout(), "%*s | %*s | %*s | %*s | %s \n", idWidth, event.ID, nameWidth, event.Name, stateWidth, event.State, stateTimeWidth, stateTimeStruct.Format(time.DateTime), event.ReadByWho)
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "%*s | %*s | %*s | %*s | %s \n", idWidth, event.ID, nameWidth, event.Name, stateWidth, event.State, stateTimeWidth, stateTimeStruct.Format(time.DateTime), event.ReadByWho)
}
return nil
},
Expand All @@ -117,7 +117,7 @@ func NewEventLogCmd() *cobra.Command {
if err != nil {
return err
}
fmt.Fprintln(cmd.OutOrStdout(), eventLog)
_, _ = fmt.Fprintln(cmd.OutOrStdout(), eventLog)
return nil
},
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/group_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ func writeExport(cmd *cobra.Command, format string, v interface{}) error {
if err != nil {
return err
}
fmt.Fprintln(cmd.OutOrStdout(), string(out))
_, _ = fmt.Fprintln(cmd.OutOrStdout(), string(out))
case "yaml":
out, err := yaml.Marshal(v)
if err != nil {
return err
}
fmt.Fprintln(cmd.OutOrStdout(), "---")
fmt.Fprintln(cmd.OutOrStdout(), string(out))
_, _ = fmt.Fprintln(cmd.OutOrStdout(), "---")
_, _ = fmt.Fprintln(cmd.OutOrStdout(), string(out))
default:
return fmt.Errorf("format must be json or yaml")
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/hardlink.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func NewHardlinkCmd() *cobra.Command {
if err != nil {
return err
}
fmt.Fprintf(cmd.OutOrStdout(), "Event ID: %s\n", eventId)
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "Event ID: %s\n", eventId)
return nil
},
}
Expand Down
10 changes: 5 additions & 5 deletions cmd/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ func NewImageAddCmd() *cobra.Command {
if err != nil {
return err
}
fmt.Fprintf(cmd.OutOrStdout(), "Image %s created\n", system.Name)
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "Image %s created\n", system.Name)
return nil
},
}
Expand Down Expand Up @@ -569,7 +569,7 @@ func reportImages(cmd *cobra.Command, imageNames []string) error {
return err
}
printStructured(cmd, system)
fmt.Fprintln(cmd.OutOrStdout(), "")
_, _ = fmt.Fprintln(cmd.OutOrStdout(), "")
}
return nil
}
Expand Down Expand Up @@ -655,15 +655,15 @@ func NewImageExportCmd() *cobra.Command {
if err != nil {
return err
}
fmt.Fprintln(cmd.OutOrStdout(), string(jsonDocument))
_, _ = fmt.Fprintln(cmd.OutOrStdout(), string(jsonDocument))
}
if formatOption == "yaml" {
yamlDocument, err := yaml.Marshal(image)
if err != nil {
return err
}
fmt.Fprintln(cmd.OutOrStdout(), "---")
fmt.Fprintln(cmd.OutOrStdout(), string(yamlDocument))
_, _ = fmt.Fprintln(cmd.OutOrStdout(), "---")
_, _ = fmt.Fprintln(cmd.OutOrStdout(), string(yamlDocument))
}
}
return nil
Expand Down
2 changes: 1 addition & 1 deletion cmd/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ See https://cobbler.readthedocs.io/en/latest/quickstart-guide.html#importing-you
if err != nil {
return err
}
fmt.Fprintf(cmd.OutOrStdout(), "Event ID: %s\n", eventId)
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "Event ID: %s\n", eventId)
return nil
},
}
Expand Down
14 changes: 7 additions & 7 deletions cmd/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func NewInterfaceAddCommand() *cobra.Command {
if err != nil {
return err
}
fmt.Fprintf(cmd.OutOrStdout(), "Network interface %s created\n", created.Name)
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "Network interface %s created\n", created.Name)
return nil
},
}
Expand Down Expand Up @@ -368,9 +368,9 @@ func NewInterfaceListCommand() *cobra.Command {
for _, systemName := range systemNames {
ifaceNames := grouped[systemName]
sort.Strings(ifaceNames)
fmt.Fprintf(cmd.OutOrStdout(), "%s:\n", systemName)
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "%s:\n", systemName)
for _, n := range ifaceNames {
fmt.Fprintf(cmd.OutOrStdout(), " %s\n", n)
_, _ = fmt.Fprintf(cmd.OutOrStdout(), " %s\n", n)
}
}
return nil
Expand Down Expand Up @@ -419,7 +419,7 @@ func NewInterfaceReportCommand() *cobra.Command {
}
for _, iface := range interfaces {
printStructured(cmd, iface)
fmt.Fprintln(cmd.OutOrStdout(), "")
_, _ = fmt.Fprintln(cmd.OutOrStdout(), "")
}
return nil
},
Expand Down Expand Up @@ -489,14 +489,14 @@ func NewInterfaceExportCmd() *cobra.Command {
if err != nil {
return err
}
fmt.Fprintln(cmd.OutOrStdout(), string(out))
_, _ = fmt.Fprintln(cmd.OutOrStdout(), string(out))
case "yaml":
out, err := yaml.Marshal(iface)
if err != nil {
return err
}
fmt.Fprintln(cmd.OutOrStdout(), "---")
fmt.Fprintln(cmd.OutOrStdout(), string(out))
_, _ = fmt.Fprintln(cmd.OutOrStdout(), "---")
_, _ = fmt.Fprintln(cmd.OutOrStdout(), string(out))
}
}
return nil
Expand Down
10 changes: 5 additions & 5 deletions cmd/item.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func FindItemNames(cmd *cobra.Command, args []string, what string) error {
case "config", "page", "items-per-page":
return
}
key := strings.Replace(flag.Name, "-", "_", -1)
key := strings.ReplaceAll(flag.Name, "-", "_")
criteria[key] = flag.Value.String()
})

Expand All @@ -153,13 +153,13 @@ func FindItemNames(cmd *cobra.Command, args []string, what string) error {
for _, raw := range result.FoundItems {
if asMap, ok := raw.(map[string]interface{}); ok {
if name, ok := asMap["name"].(string); ok {
fmt.Fprintln(cmd.OutOrStdout(), name)
_, _ = fmt.Fprintln(cmd.OutOrStdout(), name)
continue
}
}
fmt.Fprintln(cmd.OutOrStdout(), raw)
_, _ = fmt.Fprintln(cmd.OutOrStdout(), raw)
}
fmt.Fprintf(cmd.OutOrStdout(), "# page %d of %d (%d total)\n",
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "# page %d of %d (%d total)\n",
result.PageInfo.Page, result.PageInfo.NumPages, result.PageInfo.NumItems)
return nil
}
Expand All @@ -169,7 +169,7 @@ func FindItemNames(cmd *cobra.Command, args []string, what string) error {
return err
}
for _, name := range itemNames {
fmt.Fprintln(cmd.OutOrStdout(), name)
_, _ = fmt.Fprintln(cmd.OutOrStdout(), name)
}
return nil
}
6 changes: 3 additions & 3 deletions cmd/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ Identical to 'cobbler report'`,
}

func listItems(cmd *cobra.Command, what string, items []string) {
fmt.Fprintf(cmd.OutOrStdout(), "%s:\n", what)
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "%s:\n", what)
sort.Strings(items)
for _, item := range items {
fmt.Fprintf(cmd.OutOrStdout(), " %s\n", item)
_, _ = fmt.Fprintf(cmd.OutOrStdout(), " %s\n", item)
}
fmt.Fprintln(cmd.OutOrStdout(), "")
_, _ = fmt.Fprintln(cmd.OutOrStdout(), "")
}
2 changes: 1 addition & 1 deletion cmd/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func Test_ListCmd(t *testing.T) {
t.Fatal(err)
}
stdoutString := string(stdoutBytes)
if !(strings.Contains(stdoutString, "distros:") && strings.Contains(stdoutString, "profiles")) {
if !strings.Contains(stdoutString, "distros:") || !strings.Contains(stdoutString, "profiles") {
fmt.Println(stdoutString)
t.Fatal("no heading for distros and profiles present")
}
Expand Down
10 changes: 5 additions & 5 deletions cmd/menu.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func NewMenuAddCmd() (*cobra.Command, error) {
if err != nil {
return err
}
fmt.Fprintf(cmd.OutOrStdout(), "Menu %s created\n", menu.Name)
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "Menu %s created\n", menu.Name)
return nil
},
}
Expand Down Expand Up @@ -341,7 +341,7 @@ func reportMenus(cmd *cobra.Command, menuNames []string) error {
return err
}
printStructured(cmd, menu)
fmt.Fprintln(cmd.OutOrStdout(), "")
_, _ = fmt.Fprintln(cmd.OutOrStdout(), "")
}
return nil
}
Expand Down Expand Up @@ -427,15 +427,15 @@ func NewMenuExportCmd() *cobra.Command {
if err != nil {
return err
}
fmt.Fprintln(cmd.OutOrStdout(), string(jsonDocument))
_, _ = fmt.Fprintln(cmd.OutOrStdout(), string(jsonDocument))
}
if formatOption == "yaml" {
yamlDocument, err := yaml.Marshal(menu)
if err != nil {
return err
}
fmt.Fprintln(cmd.OutOrStdout(), "---")
fmt.Fprintln(cmd.OutOrStdout(), string(yamlDocument))
_, _ = fmt.Fprintln(cmd.OutOrStdout(), "---")
_, _ = fmt.Fprintln(cmd.OutOrStdout(), string(yamlDocument))
}
}
return nil
Expand Down
2 changes: 1 addition & 1 deletion cmd/mkloaders.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The options are configured in the Cobbler settings file.`,
if err != nil {
return err
}
fmt.Fprintf(cmd.OutOrStdout(), "Event ID: %s\n", eventId)
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "Event ID: %s\n", eventId)
return nil
},
}
Expand Down
Loading
Loading