From 4a3f158977ba07bcc7b2b425148eb8b27527e2c0 Mon Sep 17 00:00:00 2001 From: Julian Sommer <115516918+juliansommer@users.noreply.github.com> Date: Fri, 16 Jan 2026 03:45:28 +0000 Subject: [PATCH] run linters in ci --- .github/workflows/hive.yml | 21 +++++++++--- cmd/hive/cmd/root.go | 21 ++++++------ .../gateway/ec2/instance/RunInstances_test.go | 32 +------------------ 3 files changed, 29 insertions(+), 45 deletions(-) diff --git a/.github/workflows/hive.yml b/.github/workflows/hive.yml index fae6261ff..658ccc759 100644 --- a/.github/workflows/hive.yml +++ b/.github/workflows/hive.yml @@ -24,9 +24,22 @@ jobs: - name: Run Tests run: LOG_IGNORE=1 go test -v -timeout 120s ./... - - name: golang-govulncheck-action - uses: golang/govulncheck-action@v1.0.4 + # - name: Go Vet + # run: go vet ./... + + - name: Static Check + uses: dominikh/staticcheck-action@v1 + with: + version: 2025.1.1 + install-go: false + checks: "all,-ST1000,-ST1003,-ST1016,-ST1020,-ST1021,-ST1022,-SA1019,-SA9005" + + - name: Go Vulnerability Check + uses: golang/govulncheck-action@v1 with: repo-checkout: false -# - name: Security reports -# run: make security + + # - name: Gosec Security Scanner + # run: | + # go install github.com/securego/gosec/v2/cmd/gosec@latest + # gosec -exclude-generated ./... diff --git a/cmd/hive/cmd/root.go b/cmd/hive/cmd/root.go index 106a0904d..a1ccf3181 100644 --- a/cmd/hive/cmd/root.go +++ b/cmd/hive/cmd/root.go @@ -25,7 +25,8 @@ import ( ) var ( - cfgFile string + cfgFile string + //lint:ignore U1000 fixing config loading later appConfig *config.ClusterConfig ) @@ -34,16 +35,16 @@ var rootCmd = &cobra.Command{ Use: "hive", Short: "Hive - Open source AWS-compatible platform for secure edge deployments", Long: ` -__/\\\________/\\\__/\\\\\\\\\\\__/\\\________/\\\__/\\\\\\\\\\\\\\\_ - _\/\\\_______\/\\\_\/////\\\///__\/\\\_______\/\\\_\/\\\///////////__ - _\/\\\_______\/\\\_____\/\\\_____\//\\\______/\\\__\/\\\_____________ - _\/\\\\\\\\\\\\\\\_____\/\\\______\//\\\____/\\\___\/\\\\\\\\\\\_____ - _\/\\\/////////\\\_____\/\\\_______\//\\\__/\\\____\/\\\///////______ - _\/\\\_______\/\\\_____\/\\\________\//\\\/\\\_____\/\\\_____________ - _\/\\\_______\/\\\_____\/\\\_________\//\\\\\______\/\\\_____________ - _\/\\\_______\/\\\__/\\\\\\\\\\\______\//\\\_______\/\\\\\\\\\\\\\\\_ +__/\\\________/\\\__/\\\\\\\\\\\__/\\\________/\\\__/\\\\\\\\\\\\\\\_ + _\/\\\_______\/\\\_\/////\\\///__\/\\\_______\/\\\_\/\\\///////////__ + _\/\\\_______\/\\\_____\/\\\_____\//\\\______/\\\__\/\\\_____________ + _\/\\\\\\\\\\\\\\\_____\/\\\______\//\\\____/\\\___\/\\\\\\\\\\\_____ + _\/\\\/////////\\\_____\/\\\_______\//\\\__/\\\____\/\\\///////______ + _\/\\\_______\/\\\_____\/\\\________\//\\\/\\\_____\/\\\_____________ + _\/\\\_______\/\\\_____\/\\\_________\//\\\\\______\/\\\_____________ + _\/\\\_______\/\\\__/\\\\\\\\\\\______\//\\\_______\/\\\\\\\\\\\\\\\_ _\///________\///__\///////////________\///________\///////////////__ - + Hive – Open source AWS-compatible platform for secure edge deployments. Run EC2, VPC, S3, and EBS-like services on bare metal with full control. Built for environments where running in the cloud isn’t an option. diff --git a/hive/gateway/ec2/instance/RunInstances_test.go b/hive/gateway/ec2/instance/RunInstances_test.go index 95a985141..a7ad6f2d1 100644 --- a/hive/gateway/ec2/instance/RunInstances_test.go +++ b/hive/gateway/ec2/instance/RunInstances_test.go @@ -4,44 +4,14 @@ import ( "encoding/json" "errors" "testing" - "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ec2" - "github.com/mulgadc/hive/hive/handlers/ec2/instance" + handlers_ec2_instance "github.com/mulgadc/hive/hive/handlers/ec2/instance" "github.com/mulgadc/hive/hive/utils" - "github.com/nats-io/nats-server/v2/server" "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) -// startTestNATSServer starts an embedded NATS server for testing -func startTestNATSServer(t *testing.T) (*server.Server, string) { - opts := &server.Options{ - Host: "127.0.0.1", - Port: -1, // Auto-allocate available port - JetStream: false, - NoLog: true, - NoSigs: true, - } - - ns, err := server.NewServer(opts) - require.NoError(t, err, "Failed to create NATS server") - - // Start server in goroutine - go ns.Start() - - // Wait for server to be ready - if !ns.ReadyForConnections(5 * time.Second) { - t.Fatal("NATS server failed to start") - } - - url := ns.ClientURL() - t.Logf("Test NATS server started at: %s", url) - - return ns, url -} - var defaults = ec2.RunInstancesInput{ ImageId: aws.String("ami-0abcdef1234567890"), InstanceType: aws.String("t2.micro"),