From c5bfedcd989fdead0475b2b3ba11ba5277b82b5a Mon Sep 17 00:00:00 2001 From: Julian Sommer <115516918+juliansommer@users.noreply.github.com> Date: Tue, 10 Feb 2026 09:10:42 +1000 Subject: [PATCH] chore: fmt --- cmd/hive/main.go | 2 +- hive/admin/admin.go | 1 - hive/config/config.go | 6 +++--- hive/daemon/daemon.go | 7 +------ hive/daemon/daemon_test.go | 2 +- hive/gateway/ec2/instance/RunInstances_test.go | 1 - hive/gateway/ec2/key/CreateKeyPair_test.go | 1 - hive/handlers/ec2/instance/service_impl.go | 2 +- hive/handlers/ec2/snapshot/service_impl.go | 1 - hive/handlers/ec2/snapshot/service_impl_test.go | 1 - hive/handlers/ec2/volume/service_impl_test.go | 1 - hive/nbd/nbd.go | 4 ++-- hive/utils/utils_test.go | 14 +++++++------- hive/vm/vm.go | 12 ++++++------ 14 files changed, 22 insertions(+), 33 deletions(-) diff --git a/cmd/hive/main.go b/cmd/hive/main.go index a3ef245a7..241ba357d 100644 --- a/cmd/hive/main.go +++ b/cmd/hive/main.go @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/hive/admin/admin.go b/hive/admin/admin.go index 34e449126..e130592b3 100644 --- a/hive/admin/admin.go +++ b/hive/admin/admin.go @@ -627,4 +627,3 @@ func ParsePredastoreNodeIDFromConfig(tomlContent string, ip string) int { } return FindNodeIDByIP(cfg.DB, ip) } - diff --git a/hive/config/config.go b/hive/config/config.go index a0743144c..31dfdf52d 100644 --- a/hive/config/config.go +++ b/hive/config/config.go @@ -127,9 +127,9 @@ type EBSSyncRequest struct { } type EBSSyncResponse struct { - Volume string - Synced bool - Error string + Volume string + Synced bool + Error string } type EBSDeleteRequest struct { diff --git a/hive/daemon/daemon.go b/hive/daemon/daemon.go index aa9a18e9a..569abae01 100644 --- a/hive/daemon/daemon.go +++ b/hive/daemon/daemon.go @@ -31,8 +31,8 @@ import ( handlers_ec2_key "github.com/mulgadc/hive/hive/handlers/ec2/key" handlers_ec2_snapshot "github.com/mulgadc/hive/hive/handlers/ec2/snapshot" handlers_ec2_tags "github.com/mulgadc/hive/hive/handlers/ec2/tags" - "github.com/mulgadc/hive/hive/objectstore" handlers_ec2_volume "github.com/mulgadc/hive/hive/handlers/ec2/volume" + "github.com/mulgadc/hive/hive/objectstore" "github.com/mulgadc/hive/hive/qmp" "github.com/mulgadc/hive/hive/utils" "github.com/mulgadc/hive/hive/vm" @@ -865,7 +865,6 @@ func (d *Daemon) WriteState() error { return nil } - // LoadState loads the instance state from JetStream KV store (required) func (d *Daemon) LoadState() error { if d.jsManager == nil { @@ -883,7 +882,6 @@ func (d *Daemon) LoadState() error { return nil } - func (d *Daemon) SendQMPCommand(q *qmp.QMPClient, cmd qmp.QMPCommand, instanceId string) (*qmp.QMPResponse, error) { // Confirm QMP client is initialized @@ -954,8 +952,6 @@ func (d *Daemon) SendQMPCommand(q *qmp.QMPClient, cmd qmp.QMPCommand, instanceId } } - - func (d *Daemon) stopInstance(instances map[string]*vm.VM, deleteVolume bool) error { // Signal to shutdown each VM @@ -1764,4 +1760,3 @@ func (rm *ResourceManager) deallocate(instanceType *ec2.InstanceTypeInfo) { rm.allocatedVCPU -= int(vCPUs) rm.allocatedMem -= memoryGB } - diff --git a/hive/daemon/daemon_test.go b/hive/daemon/daemon_test.go index c24efffc5..a69647bb0 100644 --- a/hive/daemon/daemon_test.go +++ b/hive/daemon/daemon_test.go @@ -15,8 +15,8 @@ import ( "github.com/aws/aws-sdk-go/service/ec2" "github.com/mulgadc/hive/hive/config" handlers_ec2_instance "github.com/mulgadc/hive/hive/handlers/ec2/instance" - "github.com/mulgadc/hive/hive/objectstore" handlers_ec2_volume "github.com/mulgadc/hive/hive/handlers/ec2/volume" + "github.com/mulgadc/hive/hive/objectstore" "github.com/mulgadc/hive/hive/qmp" "github.com/mulgadc/hive/hive/vm" "github.com/nats-io/nats-server/v2/server" diff --git a/hive/gateway/ec2/instance/RunInstances_test.go b/hive/gateway/ec2/instance/RunInstances_test.go index 9f6dc1726..3016ed65a 100644 --- a/hive/gateway/ec2/instance/RunInstances_test.go +++ b/hive/gateway/ec2/instance/RunInstances_test.go @@ -153,4 +153,3 @@ func TestParseRunInstances(t *testing.T) { // Additional test } - diff --git a/hive/gateway/ec2/key/CreateKeyPair_test.go b/hive/gateway/ec2/key/CreateKeyPair_test.go index 52a3cf8c6..d93992859 100644 --- a/hive/gateway/ec2/key/CreateKeyPair_test.go +++ b/hive/gateway/ec2/key/CreateKeyPair_test.go @@ -51,4 +51,3 @@ func TestValidateCreateKeyPairInput(t *testing.T) { }) } } - diff --git a/hive/handlers/ec2/instance/service_impl.go b/hive/handlers/ec2/instance/service_impl.go index 9f661ed07..10b713d0c 100644 --- a/hive/handlers/ec2/instance/service_impl.go +++ b/hive/handlers/ec2/instance/service_impl.go @@ -149,7 +149,7 @@ func (s *InstanceServiceImpl) RunInstance(input *ec2.RunInstancesInput) (*vm.VM, func (s *InstanceServiceImpl) GenerateVolumes(input *ec2.RunInstancesInput, instance *vm.VM) ([]VolumeInfo, error) { var size int = 4 * 1024 * 1024 * 1024 // 4GB default size - var deviceName = "/dev/xvda" // Default device name + var deviceName = "/dev/xvda" // Default device name var volumeType string var iops int var imageId string diff --git a/hive/handlers/ec2/snapshot/service_impl.go b/hive/handlers/ec2/snapshot/service_impl.go index 6ab4c5b0f..842b443e8 100644 --- a/hive/handlers/ec2/snapshot/service_impl.go +++ b/hive/handlers/ec2/snapshot/service_impl.go @@ -360,4 +360,3 @@ func (s *SnapshotServiceImpl) CopySnapshot(input *ec2.CopySnapshotInput) (*ec2.C SnapshotId: aws.String(newSnapshotID), }, nil } - diff --git a/hive/handlers/ec2/snapshot/service_impl_test.go b/hive/handlers/ec2/snapshot/service_impl_test.go index 19ce0912f..c58303d7c 100644 --- a/hive/handlers/ec2/snapshot/service_impl_test.go +++ b/hive/handlers/ec2/snapshot/service_impl_test.go @@ -317,4 +317,3 @@ func TestCopySnapshot_PreservesTags(t *testing.T) { assert.Equal(t, "Environment", *result.Snapshots[0].Tags[0].Key) assert.Equal(t, "test", *result.Snapshots[0].Tags[0].Value) } - diff --git a/hive/handlers/ec2/volume/service_impl_test.go b/hive/handlers/ec2/volume/service_impl_test.go index b2f6f2487..cc21796a2 100644 --- a/hive/handlers/ec2/volume/service_impl_test.go +++ b/hive/handlers/ec2/volume/service_impl_test.go @@ -250,4 +250,3 @@ func TestDescribeVolumeStatus_WithVolumeIDs(t *testing.T) { require.Error(t, err) assert.Equal(t, awserrors.ErrorInvalidVolumeNotFound, err.Error()) } - diff --git a/hive/nbd/nbd.go b/hive/nbd/nbd.go index 8cb31dad7..65938b7e0 100644 --- a/hive/nbd/nbd.go +++ b/hive/nbd/nbd.go @@ -8,8 +8,8 @@ import ( ) type NBDKitConfig struct { - Port int `json:"port"` // TCP port (when using TCP transport) - Socket string `json:"socket"` // Unix socket path (when using socket transport) + Port int `json:"port"` // TCP port (when using TCP transport) + Socket string `json:"socket"` // Unix socket path (when using socket transport) PidFile string `json:"pid_file"` PluginPath string `json:"plugin_path"` Verbose bool `json:"verbose"` diff --git a/hive/utils/utils_test.go b/hive/utils/utils_test.go index c05f9c8dc..15825278d 100644 --- a/hive/utils/utils_test.go +++ b/hive/utils/utils_test.go @@ -316,13 +316,13 @@ func TestValidateErrorPayload(t *testing.T) { func TestParseNBDURI(t *testing.T) { tests := []struct { - name string - uri string - wantType string - wantPath string - wantHost string - wantPort int - wantErr bool + name string + uri string + wantType string + wantPath string + wantHost string + wantPort int + wantErr bool }{ { name: "Unix socket", diff --git a/hive/vm/vm.go b/hive/vm/vm.go index 43f1903e9..14c1bc94e 100644 --- a/hive/vm/vm.go +++ b/hive/vm/vm.go @@ -32,13 +32,13 @@ qemu-system-x86_64 \ */ type VM struct { - ID string `json:"id"` - PID int `json:"pid"` - PTS int `json:"pts"` - Running bool `json:"running"` + ID string `json:"id"` + PID int `json:"pid"` + PTS int `json:"pts"` + Running bool `json:"running"` Status InstanceState `json:"status"` - InstanceType string `json:"instance_type"` - Config Config `json:"config"` + InstanceType string `json:"instance_type"` + Config Config `json:"config"` EBSRequests config.EBSRequests `json:"ebs_requests"`