Skip to content

Commit

Permalink
update linter config and fix linting issues in code
Browse files Browse the repository at this point in the history
  • Loading branch information
DoctorVin committed Apr 18, 2024
1 parent 48652ca commit 6f7d7b0
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ linters-settings:
local-prefixes: github.com/metal-toolbox/fleetdb
gofumpt:
extra-rules: true
stylecheck:
checks: ["all", "-ST1000"]

linters:
enable:
Expand Down
3 changes: 2 additions & 1 deletion internal/inventory/attribute_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import (
"database/sql"
"encoding/json"

"github.com/metal-toolbox/fleetdb/internal/models"
"github.com/volatiletech/null/v8"
"github.com/volatiletech/sqlboiler/v4/boil"
"github.com/volatiletech/sqlboiler/v4/queries/qm"
"github.com/volatiletech/sqlboiler/v4/types"

"github.com/metal-toolbox/fleetdb/internal/models"
)

// the "either server or server-component" facet of attributes makes this function a
Expand Down
1 change: 0 additions & 1 deletion internal/inventory/component_attributes.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//nolint:all // XXX remove this!
package inventory

import (
Expand Down
7 changes: 3 additions & 4 deletions internal/inventory/device_components.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
//nolint:all // XXX remove this!
package inventory

import (
"context"
"database/sql"

"github.com/bmc-toolbox/common"
"github.com/metal-toolbox/fleetdb/internal/dbtools"
"github.com/metal-toolbox/fleetdb/internal/models"
rivets "github.com/metal-toolbox/rivets/types"
"github.com/pkg/errors"
"github.com/volatiletech/null/v8"
"github.com/volatiletech/sqlboiler/v4/boil"
"github.com/volatiletech/sqlboiler/v4/queries/qm"

"github.com/metal-toolbox/fleetdb/internal/dbtools"
"github.com/metal-toolbox/fleetdb/internal/models"
)

var (
Expand Down Expand Up @@ -198,7 +198,6 @@ func retrieveComponentStatusVA(ctx context.Context, exec boil.ContextExecutor, p
func componentsFromDatabase(ctx context.Context, exec boil.ContextExecutor,
inband bool, deviceID string) ([]*rivets.Component, error) {
records, err := models.ServerComponents(
//models.ServerComponentWhere.Name.EQ(null.StringFrom(slug)),
models.ServerComponentWhere.ServerID.EQ(deviceID),
qm.OrderBy(models.ServerComponentColumns.CreatedAt+" DESC"),
).All(ctx, exec)
Expand Down
13 changes: 7 additions & 6 deletions internal/inventory/device_view.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
//nolint:all // XXX remove this!
package inventory

import (
"context"
"encoding/json"

"github.com/google/uuid"
"github.com/metal-toolbox/fleetdb/internal/dbtools"
"github.com/metal-toolbox/fleetdb/internal/models"
rivets "github.com/metal-toolbox/rivets/types"
"github.com/pkg/errors"
"github.com/volatiletech/null/v8"
"github.com/volatiletech/sqlboiler/v4/boil"
"github.com/volatiletech/sqlboiler/v4/queries/qm"

"github.com/metal-toolbox/fleetdb/internal/dbtools"
"github.com/metal-toolbox/fleetdb/internal/models"
)

/*
Expand All @@ -32,20 +32,21 @@ var (
// historically these values were determined/set by alloy, even though they are
// internal to the data storage layer, hence the names
alloyVendorNamespace = "sh.hollow.alloy.server_vendor_attributes"
//alloyMetadataNamespace = "sh.hollow.alloy.server_metadata_attributes"
//alloyUefiVarsNamespace = "sh.hollow.alloy.server_uefi_variables" // this is a versioned attribute, we expect it to change
// XXX: enable this when Server supports UEFI variables
// alloyUefiVarsNamespace = "sh.hollow.alloy.server_uefi_variables" // this is a versioned attribute, we expect it to change
serverStatusNamespace = "sh.hollow.alloy.server_status" // versioned

// metadata keys
modelKey = "model"
vendorKey = "vendor"
serialKey = "serial"
//uefiVarsKey = "uefi-variables"
// XXX: again, enable after UEFI Variables are a thing. uefiVarsKey = "uefi-variables"

errBadServer = errors.New("data is missing required field")
errBadComponent = errors.New("component data")
)

// DeviceView encapsulates everything we need to get and set inventory data for servers
// A reminder for maintenance: this type needs to be able to contain all the
// relevant fields from Component-Inventory or Alloy.
type DeviceView struct {
Expand Down

0 comments on commit 6f7d7b0

Please sign in to comment.