Skip to content

Modern Docker Management, Designed for Everyone

chore: clean up static analysis findings across Go modules

Kyle Mendell3938e1bce46c
diff --git a/.gitignore b/.gitignore
index ded0acf28..a1690189e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -55,3 +55,4 @@ backend/build-errors.log
cli/arcane-cli
completions
*.txt
+inspections/**
diff --git a/backend/api/api.go b/backend/api/api.go
index 45c157ec0..d86beec46 100644
--- a/backend/api/api.go
+++ b/backend/api/api.go
@@ -2,7 +2,7 @@ package api
import (
"context"
- json "encoding/json/v2"
+ "encoding/json/v2"
"io"
"maps"
"net/http"
diff --git a/backend/api/handlers/activities_test.go b/backend/api/handlers/activities_test.go
index 8a879d3c3..68b4a6df4 100644
--- a/backend/api/handlers/activities_test.go
+++ b/backend/api/handlers/activities_test.go
@@ -12,7 +12,7 @@ import (
"testing"
"time"
- sqlite "github.com/libtnb/sqlite"
+ "github.com/libtnb/sqlite"
"github.com/stretchr/testify/require"
"gorm.io/gorm"
diff --git a/backend/api/handlers/auth.go b/backend/api/handlers/auth.go
index c0f342431..44e784357 100644
--- a/backend/api/handlers/auth.go
+++ b/backend/api/handlers/auth.go
@@ -75,15 +75,17 @@ type LogoutAllOtherSessionsOutput struct {
Body base.ApiResponse[base.MessageResponse]
}
+type UpdateMyProfileBody struct {
+ DisplayName *string `json:"displayName,omitempty"`
+ Email *string `json:"email,omitempty"`
+ Locale *string `json:"locale,omitempty"`
+ TimeFormat *user.TimeFormat `json:"timeFormat,omitempty" enum:"auto,12h,24h"`
+ FontSize *int `json:"fontSize,omitempty" minimum:"12" maximum:"20"`
+ Preferences *user.Preferences `json:"preferences,omitempty"`
+}
+
type UpdateMyProfileInput struct {
- Body struct {
- DisplayName *string `json:"displayName,omitempty"`
- Email *string `json:"email,omitempty"`
- Locale *string `json:"locale,omitempty"`
- TimeFormat *user.TimeFormat `json:"timeFormat,omitempty" enum:"auto,12h,24h"`
- FontSize *int `json:"fontSize,omitempty" minimum:"12" maximum:"20"`
- Preferences *user.Preferences `json:"preferences,omitempty"`
- }
+ Body UpdateMyProfileBody
}
type UpdateMyProfileOutput struct {
diff --git a/backend/api/handlers/auth_time_format_test.go b/backend/api/handlers/auth_time_format_test.go
index 299ee1356..a611b90e1 100644
--- a/backend/api/handlers/auth_time_format_test.go
+++ b/backend/api/handlers/auth_time_format_test.go
@@ -10,7 +10,7 @@ import (
func TestUpdateMyProfileTimeFormatValidation(t *testing.T) {
registry := huma.NewMapRegistry("#/components/schemas/", huma.DefaultSchemaNamer)
- schema := registry.Schema(reflect.TypeOf(UpdateMyProfileInput{}.Body), true, "UpdateMyProfileBody")
+ schema := registry.Schema(reflect.TypeFor[UpdateMyProfileBody](), true, "UpdateMyProfileBody")
for _, test := range []struct {
name string
diff --git a/backend/api/handlers/dashboard_test.go b/backend/api/handlers/dashboard_test.go
index 464b26a8e..2822b7f78 100644
--- a/backend/api/handlers/dashboard_test.go
+++ b/backend/api/handlers/dashboard_test.go
@@ -18,7 +18,7 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/internal/services"
"github.com/getarcaneapp/arcane/backend/v2/pkg/authz"
dashboardtypes "github.com/getarcaneapp/arcane/types/v2/dashboard"
- sqlite "github.com/libtnb/sqlite"
+ "github.com/libtnb/sqlite"
dockercontainer "github.com/moby/moby/api/types/container"
dockerimage "github.com/moby/moby/api/types/image"
"github.com/stretchr/testify/require"
diff --git a/backend/api/handlers/environments.go b/backend/api/handlers/environments.go
index 58e4cb528..ab01e2f9e 100644
--- a/backend/api/handlers/environments.go
+++ b/backend/api/handlers/environments.go
@@ -4,7 +4,7 @@ import (
"archive/zip"
"bytes"
"context"
- json "encoding/json/v2"
+ "encoding/json/v2"
"fmt"
"log/slog"
"net/http"
diff --git a/backend/api/handlers/events.go b/backend/api/handlers/events.go
index 7a471b86e..81e7978b7 100644
--- a/backend/api/handlers/events.go
+++ b/backend/api/handlers/events.go
@@ -2,7 +2,7 @@ package handlers
import (
"context"
- json "encoding/json/v2"
+ "encoding/json/v2"
"log/slog"
"net/http"
"strings"
diff --git a/backend/api/handlers/events_test.go b/backend/api/handlers/events_test.go
index 00741ff8e..a6c56dbd0 100644
--- a/backend/api/handlers/events_test.go
+++ b/backend/api/handlers/events_test.go
@@ -15,7 +15,7 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/pkg/authz"
pkgutils "github.com/getarcaneapp/arcane/backend/v2/pkg/utils"
"github.com/labstack/echo/v5"
- sqlite "github.com/libtnb/sqlite"
+ "github.com/libtnb/sqlite"
"github.com/stretchr/testify/require"
"gorm.io/gorm"
)
diff --git a/backend/api/handlers/helpers.go b/backend/api/handlers/helpers.go
index d1e7c13ba..bc76ad8e9 100644
--- a/backend/api/handlers/helpers.go
+++ b/backend/api/handlers/helpers.go
@@ -2,7 +2,7 @@ package handlers
import (
"context"
- json "encoding/json/v2"
+ "encoding/json/v2"
stderrors "errors"
"mime/multipart"
"strings"
diff --git a/backend/api/handlers/notifications_test.go b/backend/api/handlers/notifications_test.go
index 96a190243..d8e90e555 100644
--- a/backend/api/handlers/notifications_test.go
+++ b/backend/api/handlers/notifications_test.go
@@ -22,7 +22,7 @@ import (
"github.com/getarcaneapp/arcane/types/v2/imageupdate"
notificationdto "github.com/getarcaneapp/arcane/types/v2/notification"
"github.com/labstack/echo/v5"
- sqlite "github.com/libtnb/sqlite"
+ "github.com/libtnb/sqlite"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.getarcane.app/sys/crypto"
diff --git a/backend/api/handlers/remenv_handlers_test.go b/backend/api/handlers/remenv_handlers_test.go
index f3a2eaaec..4fa4db2c9 100644
--- a/backend/api/handlers/remenv_handlers_test.go
+++ b/backend/api/handlers/remenv_handlers_test.go
@@ -18,7 +18,7 @@ import (
"github.com/getarcaneapp/arcane/types/v2/env"
"github.com/getarcaneapp/arcane/types/v2/jobschedule"
settingstypes "github.com/getarcaneapp/arcane/types/v2/settings"
- sqlite "github.com/libtnb/sqlite"
+ "github.com/libtnb/sqlite"
"github.com/stretchr/testify/require"
"gorm.io/gorm"
)
diff --git a/backend/api/handlers/settings_test.go b/backend/api/handlers/settings_test.go
index c8bc2e450..c749b03c1 100644
--- a/backend/api/handlers/settings_test.go
+++ b/backend/api/handlers/settings_test.go
@@ -15,7 +15,7 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/internal/services"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/edge"
apitypes "github.com/getarcaneapp/arcane/types/v2/settings"
- sqlite "github.com/libtnb/sqlite"
+ "github.com/libtnb/sqlite"
"github.com/stretchr/testify/require"
"gorm.io/gorm"
)
diff --git a/backend/api/handlers/templates.go b/backend/api/handlers/templates.go
index a9591f97d..faa1667c5 100644
--- a/backend/api/handlers/templates.go
+++ b/backend/api/handlers/templates.go
@@ -2,7 +2,7 @@ package handlers
import (
"context"
- json "encoding/json/v2"
+ "encoding/json/v2"
"net/url"
"emperror.dev/errors"
diff --git a/backend/api/handlers/templates_test.go b/backend/api/handlers/templates_test.go
index fdd686ba0..f137cf741 100644
--- a/backend/api/handlers/templates_test.go
+++ b/backend/api/handlers/templates_test.go
@@ -20,7 +20,7 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/pkg/authz"
"github.com/golang-jwt/jwt/v5"
"github.com/labstack/echo/v5"
- sqlite "github.com/libtnb/sqlite"
+ "github.com/libtnb/sqlite"
"github.com/stretchr/testify/require"
"gorm.io/gorm"
)
diff --git a/backend/api/handlers/users_test.go b/backend/api/handlers/users_test.go
index 10a20c29c..f56d00ecd 100644
--- a/backend/api/handlers/users_test.go
+++ b/backend/api/handlers/users_test.go
@@ -10,7 +10,7 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/internal/models"
"github.com/getarcaneapp/arcane/backend/v2/internal/services"
"github.com/getarcaneapp/arcane/backend/v2/pkg/authz"
- sqlite "github.com/libtnb/sqlite"
+ "github.com/libtnb/sqlite"
"github.com/stretchr/testify/require"
"gorm.io/gorm"
diff --git a/backend/api/handlers/variables_test.go b/backend/api/handlers/variables_test.go
index 350fc6099..996da4165 100644
--- a/backend/api/handlers/variables_test.go
+++ b/backend/api/handlers/variables_test.go
@@ -14,7 +14,7 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/internal/services"
"github.com/getarcaneapp/arcane/backend/v2/pkg/authz"
"github.com/labstack/echo/v5"
- sqlite "github.com/libtnb/sqlite"
+ "github.com/libtnb/sqlite"
"github.com/stretchr/testify/require"
"gorm.io/gorm"
)
diff --git a/backend/api/json_serializer.go b/backend/api/json_serializer.go
index c34339156..bce84eba0 100644
--- a/backend/api/json_serializer.go
+++ b/backend/api/json_serializer.go
@@ -3,7 +3,7 @@ package api
import (
jsonv1 "encoding/json"
"encoding/json/jsontext"
- json "encoding/json/v2"
+ "encoding/json/v2"
"fmt"
"net/http"
diff --git a/backend/api/middleware/auth_test.go b/backend/api/middleware/auth_test.go
index 83dbf1b11..c343d150f 100644
--- a/backend/api/middleware/auth_test.go
+++ b/backend/api/middleware/auth_test.go
@@ -17,7 +17,7 @@ import (
"github.com/getarcaneapp/arcane/types/v2/auth"
"github.com/golang-jwt/jwt/v5"
"github.com/labstack/echo/v5"
- sqlite "github.com/libtnb/sqlite"
+ "github.com/libtnb/sqlite"
"github.com/stretchr/testify/require"
"gorm.io/gorm"
)
diff --git a/backend/api/ws/diagnostics.go b/backend/api/ws/diagnostics.go
index 8a382a9c8..06768aa91 100644
--- a/backend/api/ws/diagnostics.go
+++ b/backend/api/ws/diagnostics.go
@@ -1,7 +1,7 @@
package ws
import (
- json "encoding/json/v2"
+ "encoding/json/v2"
"net/http"
"net/http/pprof"
"time"
diff --git a/backend/api/ws/handler.go b/backend/api/ws/handler.go
index 92888eb7f..d4333a4d9 100644
--- a/backend/api/ws/handler.go
+++ b/backend/api/ws/handler.go
@@ -2,7 +2,7 @@ package ws
import (
"context"
- json "encoding/json/v2"
+ "encoding/json/v2"
"io"
"log/slog"
"net/http"
diff --git a/backend/internal/bootstrap/bootstrap_test.go b/backend/internal/bootstrap/bootstrap_test.go
index 9f4d751af..b9ad8da34 100644
--- a/backend/internal/bootstrap/bootstrap_test.go
+++ b/backend/internal/bootstrap/bootstrap_test.go
@@ -238,8 +238,7 @@ func TestHTTP2APIResponsesDoNotUseAPIGzipInternal(t *testing.T) {
}
func TestHTTPServerStopCancelsStreamingRequestContextsInternal(t *testing.T) {
- appCtx, cancelApp := context.WithCancel(context.Background())
- defer cancelApp()
+ appCtx := t.Context()
handlerEntered := make(chan struct{})
router := echo.New()
@@ -339,8 +338,7 @@ func TestRollbackCancelHookRunsBeforeEarlierStopsInternal(t *testing.T) {
}
func TestJobSchedulerStopCancelsItsPrivateContextInternal(t *testing.T) {
- appCtx, cancelApp := context.WithCancel(context.Background())
- defer cancelApp()
+ appCtx := t.Context()
lifecycle := fxtest.NewLifecycle(t)
jobScheduler := newJobScheduler(appCtx, lifecycle, &config.Config{}, nil, nil, nil)
diff --git a/backend/internal/bootstrap/edge_bootstrap.go b/backend/internal/bootstrap/edge_bootstrap.go
index 308ace148..6ec79cbba 100644
--- a/backend/internal/bootstrap/edge_bootstrap.go
+++ b/backend/internal/bootstrap/edge_bootstrap.go
@@ -2,7 +2,7 @@ package bootstrap
import (
"context"
- json "encoding/json/v2"
+ "encoding/json/v2"
"fmt"
"log/slog"
diff --git a/backend/internal/bootstrap/jobs_bootstrap.go b/backend/internal/bootstrap/jobs_bootstrap.go
index b5d745591..18d2b4fc6 100644
--- a/backend/internal/bootstrap/jobs_bootstrap.go
+++ b/backend/internal/bootstrap/jobs_bootstrap.go
@@ -2,7 +2,7 @@ package bootstrap
import (
"context"
- json "encoding/json/v2"
+ "encoding/json/v2"
"log/slog"
"net/http"
diff --git a/backend/internal/bootstrap/router_bootstrap.go b/backend/internal/bootstrap/router_bootstrap.go
index 50fce2dcf..542ab95bd 100644
--- a/backend/internal/bootstrap/router_bootstrap.go
+++ b/backend/internal/bootstrap/router_bootstrap.go
@@ -229,7 +229,7 @@ func newRouter(p RouterParams) (*echo.Echo, *edge.TunnelServer) {
permissionMatcher := authz.NewPermissionMatcher()
envProxyMiddleware := middleware.NewEnvProxyMiddlewareWithParam(
- types.LOCAL_DOCKER_ENVIRONMENT_ID,
+ types.LocalDockerEnvironmentID,
"id",
envResolver,
createAuthValidatorInternal(deps),
diff --git a/backend/internal/configschema/schema.go b/backend/internal/configschema/schema.go
index a7de45cc1..74bcf7c7d 100644
--- a/backend/internal/configschema/schema.go
+++ b/backend/internal/configschema/schema.go
@@ -3,7 +3,7 @@ package configschema
import (
"bytes"
"encoding/json/jsontext"
- json "encoding/json/v2"
+ "encoding/json/v2"
"go/ast"
"go/format"
"go/parser"
diff --git a/backend/internal/database/database.go b/backend/internal/database/database.go
index ee107ace9..1ed3fbf97 100644
--- a/backend/internal/database/database.go
+++ b/backend/internal/database/database.go
@@ -16,8 +16,8 @@ import (
"emperror.dev/errors"
- sqlite "github.com/libtnb/sqlite"
- goose "github.com/pressly/goose/v3"
+ "github.com/libtnb/sqlite"
+ "github.com/pressly/goose/v3"
"gorm.io/driver/postgres"
"gorm.io/gorm"
"gorm.io/gorm/logger"
diff --git a/backend/internal/models/base.go b/backend/internal/models/base.go
index d9d533977..77b9610ee 100644
--- a/backend/internal/models/base.go
+++ b/backend/internal/models/base.go
@@ -2,7 +2,7 @@ package models
import (
"database/sql/driver"
- json "encoding/json/v2"
+ "encoding/json/v2"
"time"
"github.com/google/uuid"
diff --git a/backend/internal/models/environment_update_job.go b/backend/internal/models/environment_update_job.go
index 385de5762..8bfa20dd8 100644
--- a/backend/internal/models/environment_update_job.go
+++ b/backend/internal/models/environment_update_job.go
@@ -2,7 +2,7 @@ package models
import (
"database/sql/driver"
- json "encoding/json/v2"
+ "encoding/json/v2"
"time"
"emperror.dev/errors"
diff --git a/backend/internal/services/activity_service_test.go b/backend/internal/services/activity_service_test.go
index 20efca6df..2a9ec0aac 100644
--- a/backend/internal/services/activity_service_test.go
+++ b/backend/internal/services/activity_service_test.go
@@ -5,7 +5,7 @@ import (
"testing"
"time"
- sqlite "github.com/libtnb/sqlite"
+ "github.com/libtnb/sqlite"
"github.com/stretchr/testify/require"
"gorm.io/gorm"
diff --git a/backend/internal/services/api_key_service_test.go b/backend/internal/services/api_key_service_test.go
index 61123e525..7157f26e6 100644
--- a/backend/internal/services/api_key_service_test.go
+++ b/backend/internal/services/api_key_service_test.go
@@ -9,7 +9,7 @@ import (
"testing"
"time"
- sqlite "github.com/libtnb/sqlite"
+ "github.com/libtnb/sqlite"
"github.com/stretchr/testify/require"
"gorm.io/gorm"
diff --git a/backend/internal/services/auth_service_test.go b/backend/internal/services/auth_service_test.go
index 492b66274..3e56df30a 100644
--- a/backend/internal/services/auth_service_test.go
+++ b/backend/internal/services/auth_service_test.go
@@ -7,7 +7,7 @@ import (
"testing"
"time"
- sqlite "github.com/libtnb/sqlite"
+ "github.com/libtnb/sqlite"
"github.com/stretchr/testify/require"
"gorm.io/gorm"
@@ -297,10 +297,10 @@ func TestPersistOidcTokens_SetsFields(t *testing.T) {
t.Errorf("expiresAt nil")
}
// Check approx expiry within [start+7s, start+12s] to allow CI slop
- min := start.Add(7 * time.Second)
- max := start.Add(12 * time.Second)
- if user.OidcAccessTokenExpiresAt.Before(min) || user.OidcAccessTokenExpiresAt.After(max) {
- t.Errorf("expiresAt %v not in [%v,%v]", user.OidcAccessTokenExpiresAt, min, max)
+ earliest := start.Add(7 * time.Second)
+ latest := start.Add(12 * time.Second)
+ if user.OidcAccessTokenExpiresAt.Before(earliest) || user.OidcAccessTokenExpiresAt.After(latest) {
+ t.Errorf("expiresAt %v not in [%v,%v]", user.OidcAccessTokenExpiresAt, earliest, latest)
}
}
diff --git a/backend/internal/services/build_service.go b/backend/internal/services/build_service.go
index 6294c8105..ead94670c 100644
--- a/backend/internal/services/build_service.go
+++ b/backend/internal/services/build_service.go
@@ -20,7 +20,7 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/pkg/pagination"
imagetypes "github.com/getarcaneapp/arcane/types/v2/image"
buildapi "go.getarcane.app/builds/api"
- contextsource "go.getarcane.app/builds/pkg/utils/contextsource"
+ "go.getarcane.app/builds/pkg/utils/contextsource"
buildtypes "go.getarcane.app/builds/types"
"gorm.io/gorm"
)
diff --git a/backend/internal/services/build_service_test.go b/backend/internal/services/build_service_test.go
index 65c89059e..5ed1b5f41 100644
--- a/backend/internal/services/build_service_test.go
+++ b/backend/internal/services/build_service_test.go
@@ -3,7 +3,7 @@ package services
import (
"bytes"
"context"
- json "encoding/json/v2"
+ "encoding/json/v2"
"errors"
"io"
"os"
@@ -15,7 +15,7 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/internal/database"
"github.com/getarcaneapp/arcane/backend/v2/internal/models"
buildgit "github.com/getarcaneapp/arcane/backend/v2/pkg/gitutil"
- sqlite "github.com/libtnb/sqlite"
+ "github.com/libtnb/sqlite"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
buildtypes "go.getarcane.app/builds/types"
diff --git a/backend/internal/services/container_registry_service.go b/backend/internal/services/container_registry_service.go
index ed01ca1b8..c014bc9f6 100644
--- a/backend/internal/services/container_registry_service.go
+++ b/backend/internal/services/container_registry_service.go
@@ -2,7 +2,7 @@ package services
import (
"context"
- json "encoding/json/v2"
+ "encoding/json/v2"
stderrors "errors"
"log/slog"
"net/http"
diff --git a/backend/internal/services/container_service.go b/backend/internal/services/container_service.go
index 75158a094..90411a515 100644
--- a/backend/internal/services/container_service.go
+++ b/backend/internal/services/container_service.go
@@ -3,7 +3,7 @@ package services
import (
"context"
"encoding/json/jsontext"
- json "encoding/json/v2"
+ "encoding/json/v2"
"fmt"
"io"
"log/slog"
diff --git a/backend/internal/services/dashboard_service_test.go b/backend/internal/services/dashboard_service_test.go
index 89e76e243..530d5a2be 100644
--- a/backend/internal/services/dashboard_service_test.go
+++ b/backend/internal/services/dashboard_service_test.go
@@ -16,7 +16,7 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/internal/models"
dashboardtypes "github.com/getarcaneapp/arcane/types/v2/dashboard"
volumetypes "github.com/getarcaneapp/arcane/types/v2/volume"
- sqlite "github.com/libtnb/sqlite"
+ "github.com/libtnb/sqlite"
dockercontainer "github.com/moby/moby/api/types/container"
dockerimage "github.com/moby/moby/api/types/image"
dockermount "github.com/moby/moby/api/types/mount"
diff --git a/backend/internal/services/environment_service.go b/backend/internal/services/environment_service.go
index b04f7364e..32b09c40c 100644
--- a/backend/internal/services/environment_service.go
+++ b/backend/internal/services/environment_service.go
@@ -4,7 +4,7 @@ import (
"github.com/samber/mo"
"context"
- json "encoding/json/v2"
+ "encoding/json/v2"
"fmt"
"log/slog"
"maps"
diff --git a/backend/internal/services/environment_service_test.go b/backend/internal/services/environment_service_test.go
index 1b492755d..42f7787ad 100644
--- a/backend/internal/services/environment_service_test.go
+++ b/backend/internal/services/environment_service_test.go
@@ -13,7 +13,7 @@ import (
"testing"
"time"
- sqlite "github.com/libtnb/sqlite"
+ "github.com/libtnb/sqlite"
"github.com/stretchr/testify/require"
"gorm.io/gorm"
diff --git a/backend/internal/services/event_service.go b/backend/internal/services/event_service.go
index 4aef347dd..2b2cc9431 100644
--- a/backend/internal/services/event_service.go
+++ b/backend/internal/services/event_service.go
@@ -3,7 +3,7 @@ package services
import (
"bytes"
"context"
- json "encoding/json/v2"
+ "encoding/json/v2"
"fmt"
"io"
"log/slog"
diff --git a/backend/internal/services/event_service_test.go b/backend/internal/services/event_service_test.go
index 426477a10..279422936 100644
--- a/backend/internal/services/event_service_test.go
+++ b/backend/internal/services/event_service_test.go
@@ -14,7 +14,7 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/internal/models"
"github.com/getarcaneapp/arcane/backend/v2/pkg/pagination"
pkgutils "github.com/getarcaneapp/arcane/backend/v2/pkg/utils"
- sqlite "github.com/libtnb/sqlite"
+ "github.com/libtnb/sqlite"
"github.com/stretchr/testify/require"
"gorm.io/gorm"
)
diff --git a/backend/internal/services/federated_credential_service_test.go b/backend/internal/services/federated_credential_service_test.go
index a6a388aa1..18bbc81f1 100644
--- a/backend/internal/services/federated_credential_service_test.go
+++ b/backend/internal/services/federated_credential_service_test.go
@@ -16,7 +16,7 @@ import (
"emperror.dev/errors"
"github.com/golang-jwt/jwt/v5"
- sqlite "github.com/libtnb/sqlite"
+ "github.com/libtnb/sqlite"
"github.com/stretchr/testify/require"
"gorm.io/gorm"
diff --git a/backend/internal/services/git_repository_service.go b/backend/internal/services/git_repository_service.go
index ab3224c73..d6958816c 100644
--- a/backend/internal/services/git_repository_service.go
+++ b/backend/internal/services/git_repository_service.go
@@ -16,7 +16,7 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/pkg/utils/validation"
"github.com/getarcaneapp/arcane/types/v2/gitops"
"github.com/samber/mo"
- contextsource "go.getarcane.app/builds/pkg/utils/contextsource"
+ "go.getarcane.app/builds/pkg/utils/contextsource"
"go.getarcane.app/sys/crypto"
"gorm.io/gorm"
)
diff --git a/backend/internal/services/git_repository_service_test.go b/backend/internal/services/git_repository_service_test.go
index 8fc3b79a7..0df985319 100644
--- a/backend/internal/services/git_repository_service_test.go
+++ b/backend/internal/services/git_repository_service_test.go
@@ -7,7 +7,7 @@ import (
"testing"
"emperror.dev/errors"
- sqlite "github.com/libtnb/sqlite"
+ "github.com/libtnb/sqlite"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gorm.io/gorm"
diff --git a/backend/internal/services/gitops_sync_service.go b/backend/internal/services/gitops_sync_service.go
index 4cdae98a0..3bb7da28f 100644
--- a/backend/internal/services/gitops_sync_service.go
+++ b/backend/internal/services/gitops_sync_service.go
@@ -2,7 +2,7 @@ package services
import (
"context"
- json "encoding/json/v2"
+ "encoding/json/v2"
"fmt"
"log/slog"
"maps"
diff --git a/backend/internal/services/image_attestations_service.go b/backend/internal/services/image_attestations_service.go
index b5205c210..ebc98334a 100644
--- a/backend/internal/services/image_attestations_service.go
+++ b/backend/internal/services/image_attestations_service.go
@@ -4,7 +4,7 @@ import (
"bytes"
"compress/gzip"
"context"
- json "encoding/json/v2"
+ "encoding/json/v2"
"io"
"log/slog"
"net/http"
diff --git a/backend/internal/services/image_service_test.go b/backend/internal/services/image_service_test.go
index f9ca603b1..930617a43 100644
--- a/backend/internal/services/image_service_test.go
+++ b/backend/internal/services/image_service_test.go
@@ -12,7 +12,7 @@ import (
"testing"
"time"
- sqlite "github.com/libtnb/sqlite"
+ "github.com/libtnb/sqlite"
"github.com/stretchr/testify/require"
"gorm.io/gorm"
@@ -331,13 +331,13 @@ func TestImageServiceSearchImagesCallsDockerAPIInternal(t *testing.T) {
}
func TestShouldRetryAnonymousPullInternal_UnauthorizedWithAuth(t *testing.T) {
- err := errors.New(`Error response from daemon: Head "registry-1.docker.io/v2/library/nginx/manifests/latest": unauthorized: incorrect username or password`)
+ err := errors.New(`error response from daemon: Head "registry-1.docker.io/v2/library/nginx/manifests/latest": unauthorized: incorrect username or password`)
assert.True(t, shouldRetryAnonymousPullInternal(client.ImagePullOptions{RegistryAuth: "encoded-auth"}, err))
}
func TestShouldRetryAnonymousPullInternal_SkipsRetryWithoutUnauthorizedOrAuth(t *testing.T) {
- nonAuthErr := errors.New("Error response from daemon: i/o timeout")
+ nonAuthErr := errors.New("error response from daemon: i/o timeout")
unauthorizedErr := errors.New("unauthorized: authentication required")
assert.False(t, shouldRetryAnonymousPullInternal(client.ImagePullOptions{RegistryAuth: "encoded-auth"}, nonAuthErr))
diff --git a/backend/internal/services/image_update_service_test.go b/backend/internal/services/image_update_service_test.go
index 3835c959e..cf841ada0 100644
--- a/backend/internal/services/image_update_service_test.go
+++ b/backend/internal/services/image_update_service_test.go
@@ -19,7 +19,7 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/pkg/utils"
"github.com/getarcaneapp/arcane/types/v2/containerregistry"
"github.com/getarcaneapp/arcane/types/v2/imageupdate"
- sqlite "github.com/libtnb/sqlite"
+ "github.com/libtnb/sqlite"
dockertypescontainer "github.com/moby/moby/api/types/container"
dockertypesimage "github.com/moby/moby/api/types/image"
dockerregistry "github.com/moby/moby/api/types/registry"
@@ -694,7 +694,7 @@ func TestImageUpdateService_CheckImageUpdate_UsesRegistryFallback(t *testing.T)
registryService := NewContainerRegistryService(db, func(context.Context) (RegistryDaemonClient, error) {
return &fakeRegistryDaemonClient{
distributionInspectFn: func(ctx context.Context, imageRef string, options client.DistributionInspectOptions) (client.DistributionInspectResult, error) {
- return client.DistributionInspectResult{}, errors.New("Error response from daemon: Not Found")
+ return client.DistributionInspectResult{}, errors.New("error response from daemon: Not Found")
},
}, nil
}, nil)
@@ -734,7 +734,7 @@ func TestImageUpdateService_CheckMultipleImages_UsesRegistryFallback(t *testing.
registryService := NewContainerRegistryService(db, func(context.Context) (RegistryDaemonClient, error) {
return &fakeRegistryDaemonClient{
distributionInspectFn: func(ctx context.Context, imageRef string, options client.DistributionInspectOptions) (client.DistributionInspectResult, error) {
- return client.DistributionInspectResult{}, errors.New("Error response from daemon: <html><body><h1>403 Forbidden</h1> Request forbidden by administrative rules. </body></html>")
+ return client.DistributionInspectResult{}, errors.New("error response from daemon: <html><body><h1>403 Forbidden</h1> Request forbidden by administrative rules. </body></html>")
},
}, nil
}, nil)
@@ -983,7 +983,7 @@ func TestImageUpdateService_CheckMultipleImages_PersistsRefScopedErrorsWhenLocal
registryService := NewContainerRegistryService(db, func(context.Context) (RegistryDaemonClient, error) {
return &fakeRegistryDaemonClient{
distributionInspectFn: func(ctx context.Context, imageRef string, options client.DistributionInspectOptions) (client.DistributionInspectResult, error) {
- return client.DistributionInspectResult{}, errors.New("Error response from daemon: Not Found")
+ return client.DistributionInspectResult{}, errors.New("error response from daemon: Not Found")
},
}, nil
}, nil)
diff --git a/backend/internal/services/lifecycle_service_test.go b/backend/internal/services/lifecycle_service_test.go
index 787fecf9b..16f124b4e 100644
--- a/backend/internal/services/lifecycle_service_test.go
+++ b/backend/internal/services/lifecycle_service_test.go
@@ -8,7 +8,7 @@ import (
"testing"
"time"
- sqlite "github.com/libtnb/sqlite"
+ "github.com/libtnb/sqlite"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gorm.io/gorm"
diff --git a/backend/internal/services/notification_service.go b/backend/internal/services/notification_service.go
index 69f4a99ab..2fe677acb 100644
--- a/backend/internal/services/notification_service.go
+++ b/backend/internal/services/notification_service.go
@@ -3,7 +3,7 @@ package services
import (
"bytes"
"context"
- json "encoding/json/v2"
+ "encoding/json/v2"
"fmt"
"html"
"html/template"
diff --git a/backend/internal/services/notification_service_test.go b/backend/internal/services/notification_service_test.go
index 75c43f562..c66e448a2 100644
--- a/backend/internal/services/notification_service_test.go
+++ b/backend/internal/services/notification_service_test.go
@@ -14,7 +14,7 @@ import (
"testing"
"time"
- sqlite "github.com/libtnb/sqlite"
+ "github.com/libtnb/sqlite"
"github.com/stretchr/testify/require"
"gorm.io/gorm"
diff --git a/backend/internal/services/oidc_service.go b/backend/internal/services/oidc_service.go
index 3351f5967..cae4e693c 100644
--- a/backend/internal/services/oidc_service.go
+++ b/backend/internal/services/oidc_service.go
@@ -4,7 +4,7 @@ import (
"context"
"crypto/tls"
"encoding/base64"
- json "encoding/json/v2"
+ "encoding/json/v2"
"fmt"
"log/slog"
"net/http"
diff --git a/backend/internal/services/project_service.go b/backend/internal/services/project_service.go
index bf037c445..9f242748d 100644
--- a/backend/internal/services/project_service.go
+++ b/backend/internal/services/project_service.go
@@ -3,7 +3,7 @@ package services
import (
"bufio"
"context"
- json "encoding/json/v2"
+ "encoding/json/v2"
stderrors "errors"
"fmt"
"io"
@@ -2565,7 +2565,7 @@ func (s *ProjectService) buildServiceImageForDeploy(
project.Services[serviceName] = updatedSvc
}
- if _, err := s.buildService.BuildImage(ctx, types.LOCAL_DOCKER_ENVIRONMENT_ID, buildReq, progressWriter, serviceName, user); err != nil {
+ if _, err := s.buildService.BuildImage(ctx, types.LocalDockerEnvironmentID, buildReq, progressWriter, serviceName, user); err != nil {
return err
}
@@ -2748,7 +2748,7 @@ func (s *ProjectService) buildProjectServicesInternal(ctx context.Context, proje
}
buildCount++
- if _, err := s.buildService.BuildImage(ctx, types.LOCAL_DOCKER_ENVIRONMENT_ID, buildReq, progressWriter, name, user); err != nil {
+ if _, err := s.buildService.BuildImage(ctx, types.LocalDockerEnvironmentID, buildReq, progressWriter, name, user); err != nil {
return err
}
}
diff --git a/backend/internal/services/project_service_test.go b/backend/internal/services/project_service_test.go
index 77d5c389e..dc773ff27 100644
--- a/backend/internal/services/project_service_test.go
+++ b/backend/internal/services/project_service_test.go
@@ -29,7 +29,7 @@ import (
"github.com/getarcaneapp/arcane/types/v2/containerregistry"
imagetypes "github.com/getarcaneapp/arcane/types/v2/image"
projecttypes "github.com/getarcaneapp/arcane/types/v2/project"
- sqlite "github.com/libtnb/sqlite"
+ "github.com/libtnb/sqlite"
"github.com/moby/moby/api/types/container"
dockertypesimage "github.com/moby/moby/api/types/image"
dockerregistry "github.com/moby/moby/api/types/registry"
diff --git a/backend/internal/services/role_service.go b/backend/internal/services/role_service.go
index dadc41321..dacfa80fa 100644
--- a/backend/internal/services/role_service.go
+++ b/backend/internal/services/role_service.go
@@ -2,7 +2,7 @@ package services
import (
"context"
- json "encoding/json/v2"
+ "encoding/json/v2"
"log/slog"
"strings"
"time"
diff --git a/backend/internal/services/settings_service_test.go b/backend/internal/services/settings_service_test.go
index c6f747b7c..e35d76af6 100644
--- a/backend/internal/services/settings_service_test.go
+++ b/backend/internal/services/settings_service_test.go
@@ -5,7 +5,7 @@ import (
"path/filepath"
"testing"
- sqlite "github.com/libtnb/sqlite"
+ "github.com/libtnb/sqlite"
"github.com/stretchr/testify/require"
"gorm.io/gorm"
diff --git a/backend/internal/services/swarm_service.go b/backend/internal/services/swarm_service.go
index 2825010d5..a71f0cd70 100644
--- a/backend/internal/services/swarm_service.go
+++ b/backend/internal/services/swarm_service.go
@@ -4,8 +4,7 @@ import (
"bytes"
"context"
stdjson "encoding/json"
- json "encoding/json/v2"
- stderrors "errors"
+ "encoding/json/v2"
"fmt"
"io/fs"
"log/slog"
@@ -16,7 +15,6 @@ import (
"sort"
"strings"
"sync"
- "syscall"
"time"
"emperror.dev/errors"
@@ -2583,16 +2581,6 @@ func (s *SwarmService) deleteStackSourceInternal(ctx context.Context, environmen
environmentDir := filepath.Dir(stackSourceDir)
if environmentDir != rootDir {
if err := os.Remove(environmentDir); err != nil && !errors.Is(err, os.ErrNotExist) {
- if errno, ok := stderrors.AsType[syscall.Errno](err); ok && (errno == syscall.ENOTEMPTY || errno == syscall.EACCES) {
- slog.DebugContext(ctx, "swarm stack source environment directory cleanup skipped", "dir", environmentDir, "error", err)
- return nil
- }
-
- if errors.Is(err, os.ErrPermission) {
- slog.DebugContext(ctx, "swarm stack source environment directory cleanup skipped", "dir", environmentDir, "error", err)
- return nil
- }
-
slog.DebugContext(ctx, "swarm stack source environment directory cleanup skipped", "dir", environmentDir, "error", err)
}
}
diff --git a/backend/internal/services/system_upgrade_update_all_test.go b/backend/internal/services/system_upgrade_update_all_test.go
index 6df2f2516..fc3c19f5b 100644
--- a/backend/internal/services/system_upgrade_update_all_test.go
+++ b/backend/internal/services/system_upgrade_update_all_test.go
@@ -8,7 +8,7 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/internal/database"
"github.com/getarcaneapp/arcane/backend/v2/internal/models"
"github.com/getarcaneapp/arcane/types/v2/version"
- sqlite "github.com/libtnb/sqlite"
+ "github.com/libtnb/sqlite"
"github.com/stretchr/testify/require"
"gorm.io/gorm"
)
diff --git a/backend/internal/services/template_service.go b/backend/internal/services/template_service.go
index fa5fa6a7a..28de43c96 100644
--- a/backend/internal/services/template_service.go
+++ b/backend/internal/services/template_service.go
@@ -2,7 +2,7 @@ package services
import (
"context"
- json "encoding/json/v2"
+ "encoding/json/v2"
"fmt"
"io"
"log/slog"
diff --git a/backend/internal/services/template_service_test.go b/backend/internal/services/template_service_test.go
index 5e87cc2b6..8ae24d68a 100644
--- a/backend/internal/services/template_service_test.go
+++ b/backend/internal/services/template_service_test.go
@@ -14,7 +14,7 @@ import (
"testing"
"time"
- sqlite "github.com/libtnb/sqlite"
+ "github.com/libtnb/sqlite"
"github.com/samber/mo"
"github.com/stretchr/testify/require"
"gorm.io/gorm"
diff --git a/backend/internal/services/variable_service.go b/backend/internal/services/variable_service.go
index f677ce6a7..c8403aaa1 100644
--- a/backend/internal/services/variable_service.go
+++ b/backend/internal/services/variable_service.go
@@ -3,7 +3,7 @@ package services
import (
"bufio"
"context"
- json "encoding/json/v2"
+ "encoding/json/v2"
"fmt"
"log/slog"
"net/http"
diff --git a/backend/internal/services/variable_service_test.go b/backend/internal/services/variable_service_test.go
index 6d9561bbe..77e07175e 100644
--- a/backend/internal/services/variable_service_test.go
+++ b/backend/internal/services/variable_service_test.go
@@ -19,7 +19,7 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/internal/models"
"github.com/getarcaneapp/arcane/backend/v2/pkg/remenv"
envtypes "github.com/getarcaneapp/arcane/types/v2/env"
- sqlite "github.com/libtnb/sqlite"
+ "github.com/libtnb/sqlite"
"github.com/stretchr/testify/require"
"go.getarcane.app/sys/crypto"
"gorm.io/gorm"
diff --git a/backend/internal/services/version_service.go b/backend/internal/services/version_service.go
index f8785f048..8bce497b9 100644
--- a/backend/internal/services/version_service.go
+++ b/backend/internal/services/version_service.go
@@ -2,7 +2,7 @@ package services
import (
"context"
- json "encoding/json/v2"
+ "encoding/json/v2"
"fmt"
"log/slog"
"net/http"
diff --git a/backend/internal/services/vulnerability_service.go b/backend/internal/services/vulnerability_service.go
index 59ceeb483..d0ed184f8 100644
--- a/backend/internal/services/vulnerability_service.go
+++ b/backend/internal/services/vulnerability_service.go
@@ -5,7 +5,7 @@ import (
"bytes"
"context"
"encoding/json/jsontext"
- json "encoding/json/v2"
+ "encoding/json/v2"
"fmt"
"io"
"log/slog"
@@ -37,7 +37,7 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane"
activitylib "github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/activity"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/timeouts"
- vuln "github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/vuln"
+ "github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/vuln"
"github.com/getarcaneapp/arcane/backend/v2/pkg/pagination"
"github.com/getarcaneapp/arcane/backend/v2/pkg/projects"
"github.com/getarcaneapp/arcane/backend/v2/pkg/utils"
@@ -3470,17 +3470,15 @@ func (s *VulnerabilityService) saveScanResultWithRetryInternal(
break
}
- if retryDelay > 0 {
- delay := min(retryDelay*time.Duration(1<<(attempt-1)), defaultScanSaveRetryMaxDelay)
+ delay := min(retryDelay*time.Duration(1<<(attempt-1)), defaultScanSaveRetryMaxDelay)
- timer := time.NewTimer(delay)
- select {
- case <-ctx.Done():
- timer.Stop()
- s.saveScanResultStatusFallbackInternal(ctx, result, ctx.Err())
- return ctx.Err()
- case <-timer.C:
- }
+ timer := time.NewTimer(delay)
+ select {
+ case <-ctx.Done():
+ timer.Stop()
+ s.saveScanResultStatusFallbackInternal(ctx, result, ctx.Err())
+ return ctx.Err()
+ case <-timer.C:
}
}
}
diff --git a/backend/internal/services/vulnerability_service_test.go b/backend/internal/services/vulnerability_service_test.go
index df9df4c4f..bdef3dbb0 100644
--- a/backend/internal/services/vulnerability_service_test.go
+++ b/backend/internal/services/vulnerability_service_test.go
@@ -15,10 +15,10 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/internal/database"
"github.com/getarcaneapp/arcane/backend/v2/internal/models"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/timeouts"
- vuln "github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/vuln"
+ "github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/vuln"
"github.com/getarcaneapp/arcane/backend/v2/pkg/pagination"
"github.com/getarcaneapp/arcane/types/v2/vulnerability"
- sqlite "github.com/libtnb/sqlite"
+ "github.com/libtnb/sqlite"
containertypes "github.com/moby/moby/api/types/container"
mounttypes "github.com/moby/moby/api/types/mount"
networktypes "github.com/moby/moby/api/types/network"
diff --git a/backend/internal/services/webhook_service.go b/backend/internal/services/webhook_service.go
index 661a04e11..e226edf6b 100644
--- a/backend/internal/services/webhook_service.go
+++ b/backend/internal/services/webhook_service.go
@@ -64,7 +64,7 @@ func NewWebhookService(db *database.DB, containerService *ContainerService, upda
// isRemoteWebhookEnvironmentInternal reports whether environmentID refers to a
// remote environment (anything but the local Docker environment).
func isRemoteWebhookEnvironmentInternal(environmentID string) bool {
- return environmentID != "" && environmentID != types.LOCAL_DOCKER_ENVIRONMENT_ID
+ return environmentID != "" && environmentID != types.LocalDockerEnvironmentID
}
// generateWebhookTokenInternal creates a new random webhook token and returns the raw token
@@ -485,7 +485,7 @@ func (s *WebhookService) executeWebhookActionInternal(ctx context.Context, wh *m
// environment ID, matching the environment proxy's path-rewriting convention.
// wantResult reports whether the response carries an updater.Result payload.
func remoteWebhookRequestInternal(wh *models.Webhook, actionType string) (method, path string, wantResult bool, err error) {
- apiPrefix := "/api/environments/" + types.LOCAL_DOCKER_ENVIRONMENT_ID
+ apiPrefix := "/api/environments/" + types.LocalDockerEnvironmentID
switch wh.TargetType {
case models.WebhookTargetTypeContainer:
diff --git a/backend/internal/services/webhook_service_test.go b/backend/internal/services/webhook_service_test.go
index 5697f30cc..4d5021b68 100644
--- a/backend/internal/services/webhook_service_test.go
+++ b/backend/internal/services/webhook_service_test.go
@@ -10,7 +10,7 @@ import (
"testing"
"github.com/getarcaneapp/arcane/types/v2"
- sqlite "github.com/libtnb/sqlite"
+ "github.com/libtnb/sqlite"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
libcrypto "go.getarcane.app/sys/crypto"
@@ -591,7 +591,7 @@ func TestTriggerByToken_ContainerType_NilServiceReturnsError(t *testing.T) {
svc := newTestWebhookService(db) // updaterService is nil
rawToken := "arc_wh_ccddeeff01020304aabbccdd0102030405060708090a0b0c0d0e0f1011121314"
- insertWebhookDirect(t, ctx, db, rawToken, models.WebhookTargetTypeContainer, models.WebhookActionTypeUpdate, "container-id", types.LOCAL_DOCKER_ENVIRONMENT_ID)
+ insertWebhookDirect(t, ctx, db, rawToken, models.WebhookTargetTypeContainer, models.WebhookActionTypeUpdate, "container-id", types.LocalDockerEnvironmentID)
assert.Panics(t, func() {
_, _ = svc.TriggerByToken(ctx, rawToken) //nolint:errcheck
@@ -604,7 +604,7 @@ func TestTriggerByToken_UpdaterType_NilServiceReturnsError(t *testing.T) {
svc := newTestWebhookService(db) // updaterService is nil
rawToken := "arc_wh_1122334401020304aabbccdd0102030405060708090a0b0c0d0e0f1011121314"
- insertWebhookDirect(t, ctx, db, rawToken, models.WebhookTargetTypeUpdater, models.WebhookActionTypeRun, "", types.LOCAL_DOCKER_ENVIRONMENT_ID)
+ insertWebhookDirect(t, ctx, db, rawToken, models.WebhookTargetTypeUpdater, models.WebhookActionTypeRun, "", types.LocalDockerEnvironmentID)
// nil updaterService causes a panic, which we verify the dispatch path is reached
// by recovering — in production the service is always non-nil
@@ -619,7 +619,7 @@ func TestTriggerByToken_GitOpsType_NilServiceReturnsError(t *testing.T) {
svc := newTestWebhookService(db) // gitOpsSyncService is nil
rawToken := "arc_wh_aabbccdd11223344aabbccdd0102030405060708090a0b0c0d0e0f1011121314"
- insertWebhookDirect(t, ctx, db, rawToken, models.WebhookTargetTypeGitOps, models.WebhookActionTypeSync, "sync-id", types.LOCAL_DOCKER_ENVIRONMENT_ID)
+ insertWebhookDirect(t, ctx, db, rawToken, models.WebhookTargetTypeGitOps, models.WebhookActionTypeSync, "sync-id", types.LocalDockerEnvironmentID)
assert.Panics(t, func() {
_, _ = svc.TriggerByToken(ctx, rawToken) //nolint:errcheck
diff --git a/backend/pkg/authz/permission_set_test.go b/backend/pkg/authz/permission_set_test.go
index ec21860f5..cda86f047 100644
--- a/backend/pkg/authz/permission_set_test.go
+++ b/backend/pkg/authz/permission_set_test.go
@@ -1,6 +1,9 @@
package authz
-import "testing"
+import (
+ "slices"
+ "testing"
+)
func TestPermissionSetAllowsGlobal(t *testing.T) {
ps := NewPermissionSet()
@@ -221,7 +224,7 @@ func TestVariablePermissionsAreSeparateGlobalGrantsWithBuiltInAccess(t *testing.
if !IsOrgLevel(permission) {
t.Fatalf("variable permission %q must be global", permission)
}
- if permissionSliceContainsInternal(BuiltInMonitorPermissions(), permission) {
+ if slices.Contains(BuiltInMonitorPermissions(), permission) {
t.Fatalf("Monitor must not receive %q", permission)
}
}
@@ -232,7 +235,7 @@ func TestVariablePermissionsAreSeparateGlobalGrantsWithBuiltInAccess(t *testing.
"No-Shell Editor": BuiltInNoShellEditorPermissions(),
} {
for _, permission := range variablePermissions {
- if !permissionSliceContainsInternal(permissions, permission) {
+ if !slices.Contains(permissions, permission) {
t.Fatalf("%s must receive %q", name, permission)
}
}
@@ -242,11 +245,11 @@ func TestVariablePermissionsAreSeparateGlobalGrantsWithBuiltInAccess(t *testing.
"Viewer": BuiltInViewerPermissions(),
"Deployer": BuiltInDeployerPermissions(),
} {
- if !permissionSliceContainsInternal(permissions, PermVariablesRead) {
+ if !slices.Contains(permissions, PermVariablesRead) {
t.Fatalf("%s must receive %q", name, PermVariablesRead)
}
for _, permission := range variablePermissions[1:] {
- if permissionSliceContainsInternal(permissions, permission) {
+ if slices.Contains(permissions, permission) {
t.Fatalf("%s must not receive %q", name, permission)
}
}
@@ -261,15 +264,6 @@ func TestVariablePermissionsAreSeparateGlobalGrantsWithBuiltInAccess(t *testing.
}
}
-func permissionSliceContainsInternal(permissions []string, permission string) bool {
- for _, candidate := range permissions {
- if candidate == permission {
- return true
- }
- }
- return false
-}
-
func TestPermissionCatalogDerivesKnownPermissionsAndScopes(t *testing.T) {
catalog := PermissionCatalog()
if len(catalog) == 0 {
diff --git a/backend/pkg/dockerutil/progress.go b/backend/pkg/dockerutil/progress.go
index d26f95b5a..9ef6583db 100644
--- a/backend/pkg/dockerutil/progress.go
+++ b/backend/pkg/dockerutil/progress.go
@@ -2,7 +2,7 @@ package docker
import (
"bytes"
- json "encoding/json/v2"
+ "encoding/json/v2"
"io"
"strings"
"sync"
diff --git a/backend/pkg/dockerutil/render_test.go b/backend/pkg/dockerutil/render_test.go
index 9209167ad..bb41dcbe0 100644
--- a/backend/pkg/dockerutil/render_test.go
+++ b/backend/pkg/dockerutil/render_test.go
@@ -42,13 +42,11 @@ func TestLogLineWriterConcurrentWrites(t *testing.T) {
var wg sync.WaitGroup
for range 8 {
- wg.Add(1)
- go func() {
- defer wg.Done()
+ wg.Go(func() {
for range 200 {
_, _ = w.Write([]byte("Container test Created\n"))
}
- }()
+ })
}
wg.Wait()
_ = w.Close()
diff --git a/backend/pkg/libarcane/activity/handler.go b/backend/pkg/libarcane/activity/handler.go
index 9c83fa075..1804635dc 100644
--- a/backend/pkg/libarcane/activity/handler.go
+++ b/backend/pkg/libarcane/activity/handler.go
@@ -2,7 +2,7 @@ package activity
import (
"context"
- json "encoding/json/v2"
+ "encoding/json/v2"
"fmt"
"io"
"log/slog"
diff --git a/backend/pkg/libarcane/activity/writer.go b/backend/pkg/libarcane/activity/writer.go
index 1930ff96d..cf4569237 100644
--- a/backend/pkg/libarcane/activity/writer.go
+++ b/backend/pkg/libarcane/activity/writer.go
@@ -3,7 +3,7 @@ package activity
import (
"bytes"
"context"
- json "encoding/json/v2"
+ "encoding/json/v2"
"fmt"
"io"
"net/http"
diff --git a/backend/pkg/libarcane/edge/client_test.go b/backend/pkg/libarcane/edge/client_test.go
index 454e185bb..d37ae4bd5 100644
--- a/backend/pkg/libarcane/edge/client_test.go
+++ b/backend/pkg/libarcane/edge/client_test.go
@@ -26,8 +26,6 @@ import (
slogecho "github.com/samber/slog-echo/v2"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
- "golang.org/x/net/http2"
- "golang.org/x/net/http2/h2c"
"google.golang.org/grpc"
)
@@ -287,8 +285,7 @@ func TestTunnelClient_WebSocket_ReconnectClosesStreams(t *testing.T) {
return n
}
- ctx, cancel := context.WithCancel(context.Background())
- defer cancel()
+ ctx := t.Context()
defer close(stopManager)
go client.StartWithErrorChan(ctx, nil)
@@ -1656,7 +1653,7 @@ func startTestTunnelServiceOnAPIPathInternal(t *testing.T, ctx context.Context,
lis, err := lc.Listen(ctx, "tcp", "127.0.0.1:0")
require.NoError(t, err)
- handler := h2c.NewHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if !strings.HasPrefix(r.Header.Get("Content-Type"), "application/grpc") {
http.NotFound(w, r)
return
@@ -1676,10 +1673,15 @@ func startTestTunnelServiceOnAPIPathInternal(t *testing.T, ctx context.Context,
clone.URL = &cloneURL
clone.RequestURI = cloneURL.Path
grpcServer.ServeHTTP(w, clone)
- }), &http2.Server{})
+ })
+
+ protocols := new(http.Protocols)
+ protocols.SetHTTP1(true)
+ protocols.SetUnencryptedHTTP2(true)
httpServer := &http.Server{
Handler: handler,
+ Protocols: protocols,
ReadHeaderTimeout: 5 * time.Second,
}
@@ -2025,7 +2027,7 @@ func startTestPollAndGRPCManagerInternal(t *testing.T, ctx context.Context, serv
lis, err := lc.Listen(ctx, "tcp", "127.0.0.1:0")
require.NoError(t, err)
- handler := h2c.NewHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path == "/api/tunnel/poll" {
w.Header().Set("Content-Type", "application/json")
require.NoError(t, json.NewEncoder(w).Encode(pollResp))
@@ -2051,10 +2053,15 @@ func startTestPollAndGRPCManagerInternal(t *testing.T, ctx context.Context, serv
clone.URL = &cloneURL
clone.RequestURI = cloneURL.Path
grpcServer.ServeHTTP(w, clone)
- }), &http2.Server{})
+ })
+
+ protocols := new(http.Protocols)
+ protocols.SetHTTP1(true)
+ protocols.SetUnencryptedHTTP2(true)
httpServer := &http.Server{
Handler: handler,
+ Protocols: protocols,
ReadHeaderTimeout: 5 * time.Second,
}
diff --git a/backend/pkg/libarcane/edge/client_transport_poll.go b/backend/pkg/libarcane/edge/client_transport_poll.go
index 1728d4b54..9505356e6 100644
--- a/backend/pkg/libarcane/edge/client_transport_poll.go
+++ b/backend/pkg/libarcane/edge/client_transport_poll.go
@@ -3,7 +3,7 @@ package edge
import (
"bytes"
"context"
- json "encoding/json/v2"
+ "encoding/json/v2"
"io"
"log/slog"
"net/http"
diff --git a/backend/pkg/libarcane/edge/poll_control.go b/backend/pkg/libarcane/edge/poll_control.go
index 4cfe4bb89..836649683 100644
--- a/backend/pkg/libarcane/edge/poll_control.go
+++ b/backend/pkg/libarcane/edge/poll_control.go
@@ -3,7 +3,7 @@ package edge
import (
"github.com/samber/mo"
- json "encoding/json/v2"
+ "encoding/json/v2"
"io"
"log/slog"
"net/http"
diff --git a/backend/pkg/libarcane/edge/tls.go b/backend/pkg/libarcane/edge/tls.go
index 5238eedc8..bf9b319b5 100644
--- a/backend/pkg/libarcane/edge/tls.go
+++ b/backend/pkg/libarcane/edge/tls.go
@@ -8,7 +8,7 @@ import (
"crypto/rand"
"crypto/tls"
"crypto/x509"
- json "encoding/json/v2"
+ "encoding/json/v2"
"encoding/pem"
"fmt"
"io"
diff --git a/backend/pkg/libarcane/edge/tunnel.go b/backend/pkg/libarcane/edge/tunnel.go
index 55d6d1d1e..2f2654cf7 100644
--- a/backend/pkg/libarcane/edge/tunnel.go
+++ b/backend/pkg/libarcane/edge/tunnel.go
@@ -2,7 +2,7 @@ package edge
import (
"context"
- json "encoding/json/v2"
+ "encoding/json/v2"
"io"
"emperror.dev/errors"
diff --git a/backend/pkg/libarcane/inspect_compat.go b/backend/pkg/libarcane/inspect_compat.go
index 08b29b7d5..d6443ce02 100644
--- a/backend/pkg/libarcane/inspect_compat.go
+++ b/backend/pkg/libarcane/inspect_compat.go
@@ -3,7 +3,7 @@ package libarcane
import (
"bufio"
"context"
- json "encoding/json/v2"
+ "encoding/json/v2"
"io"
"net/http"
"net/netip"
diff --git a/backend/pkg/libarcane/system/gpu.go b/backend/pkg/libarcane/system/gpu.go
index 343a0b6fc..ca9e9cbc4 100644
--- a/backend/pkg/libarcane/system/gpu.go
+++ b/backend/pkg/libarcane/system/gpu.go
@@ -31,13 +31,13 @@ const (
// Detection is cached for gpuDetectionTTL; once a vendor is detected, subsequent Stats
// calls invoke the vendor-specific tool directly.
type GPUMonitor struct {
- enabled bool
configuredType string
- detectionMu sync.Mutex
- detectionDone bool
-
+ detectionMu sync.Mutex
detectionCache *hot.HotCache[struct{}, gpuDetection]
+ detectionDone bool
+
+ enabled bool
}
type gpuDetection struct {
diff --git a/backend/pkg/libarcane/volumehelper/helper_test.go b/backend/pkg/libarcane/volumehelper/helper_test.go
index 44feb71ea..c7a59acb3 100644
--- a/backend/pkg/libarcane/volumehelper/helper_test.go
+++ b/backend/pkg/libarcane/volumehelper/helper_test.go
@@ -131,9 +131,9 @@ func TestResolveHelperImage_ReturnsPullErrorWhenNoFallbackExists(t *testing.T) {
func newTestDockerClientInternal(t *testing.T, server *httptest.Server) *client.Client {
t.Helper()
- dockerClient, err := client.NewClientWithOpts(
+ dockerClient, err := client.New(
client.WithHost(server.URL),
- client.WithVersion("1.54"),
+ client.WithAPIVersion("1.54"),
)
require.NoError(t, err)
return dockerClient
diff --git a/backend/pkg/libarcane/volumes/volume_rename_safety_test.go b/backend/pkg/libarcane/volumes/volume_rename_safety_test.go
index 64b1ebf85..4266d8da5 100644
--- a/backend/pkg/libarcane/volumes/volume_rename_safety_test.go
+++ b/backend/pkg/libarcane/volumes/volume_rename_safety_test.go
@@ -2,7 +2,6 @@ package volumes
import (
"context"
- "encoding/base64"
"encoding/json"
"errors"
"net/http"
@@ -490,11 +489,3 @@ func TestDockerProjectVolumeRenameMigrationInternal_CommitPreflightsAllTargetsBe
require.False(t, firstSourceRemoved.Load(), "no source volume should be removed until every target is verified")
require.False(t, secondSourceRemoved.Load())
}
-
-func setProjectVolumeCopyArchiveStatHeaderInternal(t *testing.T, w http.ResponseWriter) {
- t.Helper()
-
- payload, err := json.Marshal(container.PathStat{Name: "."})
- require.NoError(t, err)
- w.Header().Set("X-Docker-Container-Path-Stat", base64.StdEncoding.EncodeToString(payload))
-}
diff --git a/backend/pkg/libarcane/vuln/trivy.go b/backend/pkg/libarcane/vuln/trivy.go
index 4295cf672..1c6fe0fd1 100644
--- a/backend/pkg/libarcane/vuln/trivy.go
+++ b/backend/pkg/libarcane/vuln/trivy.go
@@ -5,7 +5,7 @@ package vuln
import (
"encoding/base64"
- json "encoding/json/v2"
+ "encoding/json/v2"
"net/url"
"runtime"
"strings"
diff --git a/backend/pkg/libarcane/ws/bridge.go b/backend/pkg/libarcane/ws/bridge.go
index a7d1761fe..24560a35d 100644
--- a/backend/pkg/libarcane/ws/bridge.go
+++ b/backend/pkg/libarcane/ws/bridge.go
@@ -2,7 +2,7 @@ package ws
import (
"context"
- json "encoding/json/v2"
+ "encoding/json/v2"
"time"
)
diff --git a/backend/pkg/libarcane/ws/hub_test.go b/backend/pkg/libarcane/ws/hub_test.go
index 56a9d0110..d420e32c5 100644
--- a/backend/pkg/libarcane/ws/hub_test.go
+++ b/backend/pkg/libarcane/ws/hub_test.go
@@ -337,11 +337,9 @@ func TestHub_BroadcastOverloadAggregatesDropWarning(t *testing.T) {
const dropCount = 1000
var wg sync.WaitGroup
for range dropCount {
- wg.Add(1)
- go func() {
- defer wg.Done()
+ wg.Go(func() {
h.Broadcast([]byte("overload"))
- }()
+ })
}
wg.Wait()
@@ -377,7 +375,7 @@ func TestHub_ConcurrentOperations(t *testing.T) {
}, goroutines)
for i := range goroutines {
_, pairs[i].sc, pairs[i].cleanup = newTestWSPair(t)
- defer pairs[i].cleanup()
+ t.Cleanup(pairs[i].cleanup)
}
for i := range goroutines {
diff --git a/backend/pkg/pagination/skipcount_test.go b/backend/pkg/pagination/skipcount_test.go
index b7dfa9767..e7c1166a0 100644
--- a/backend/pkg/pagination/skipcount_test.go
+++ b/backend/pkg/pagination/skipcount_test.go
@@ -3,7 +3,7 @@ package pagination
import (
"testing"
- sqlite "github.com/libtnb/sqlite"
+ "github.com/libtnb/sqlite"
"github.com/stretchr/testify/require"
"gorm.io/gorm"
"gorm.io/gorm/logger"
diff --git a/backend/pkg/projects/build.go b/backend/pkg/projects/build.go
index 6d791c9fd..5317a9f34 100644
--- a/backend/pkg/projects/build.go
+++ b/backend/pkg/projects/build.go
@@ -6,7 +6,7 @@ import (
"emperror.dev/errors"
composetypes "github.com/compose-spec/compose-go/v2/types"
- contextsource "go.getarcane.app/builds/pkg/utils/contextsource"
+ "go.getarcane.app/builds/pkg/utils/contextsource"
)
// ResolveBuildContext resolves a service build context against workingDir.
diff --git a/backend/pkg/projects/image_refs.go b/backend/pkg/projects/image_refs.go
index eccd6c202..9d1d60aa6 100644
--- a/backend/pkg/projects/image_refs.go
+++ b/backend/pkg/projects/image_refs.go
@@ -1,7 +1,7 @@
package projects
import (
- json "encoding/json/v2"
+ "encoding/json/v2"
"sort"
"strings"
diff --git a/backend/pkg/projects/includes.go b/backend/pkg/projects/includes.go
index 4b69dbc0e..04a28c303 100644
--- a/backend/pkg/projects/includes.go
+++ b/backend/pkg/projects/includes.go
@@ -306,17 +306,20 @@ func ValidateIncludePathForWrite(projectDir, includePath string) (string, error)
// Resolve symlinks in the include path to prevent symlink-based path traversal attacks
evalPath := absFullPath
- if evalFullPath, err := filepath.EvalSymlinks(absFullPath); err == nil {
+ evalFullPath, err := filepath.EvalSymlinks(absFullPath)
+ switch {
+ case err == nil:
evalPath = evalFullPath
- } else if !errors.Is(err, os.ErrNotExist) {
+ case !errors.Is(err, os.ErrNotExist):
return "", errors.WrapIf(err, "failed to resolve include path")
- } else {
+ default:
// File doesn't exist yet - evaluate parent directory symlinks
- dir := filepath.Dir(absFullPath)
- if evalDir, err := filepath.EvalSymlinks(dir); err == nil {
+ evalDir, dirErr := filepath.EvalSymlinks(filepath.Dir(absFullPath))
+ if dirErr != nil && !errors.Is(dirErr, os.ErrNotExist) {
+ return "", errors.WrapIf(dirErr, "failed to resolve parent directory")
+ }
+ if dirErr == nil {
evalPath = filepath.Join(evalDir, filepath.Base(absFullPath))
- } else if !errors.Is(err, os.ErrNotExist) {
- return "", errors.WrapIf(err, "failed to resolve parent directory")
}
}
diff --git a/backend/pkg/remenv/client.go b/backend/pkg/remenv/client.go
index ef4550904..dab222282 100644
--- a/backend/pkg/remenv/client.go
+++ b/backend/pkg/remenv/client.go
@@ -3,7 +3,7 @@ package remenv
import (
"bytes"
"context"
- json "encoding/json/v2"
+ "encoding/json/v2"
"fmt"
"io"
"maps"
diff --git a/backend/pkg/scheduler/analytics_job.go b/backend/pkg/scheduler/analytics_job.go
index bb069c595..1c0287593 100644
--- a/backend/pkg/scheduler/analytics_job.go
+++ b/backend/pkg/scheduler/analytics_job.go
@@ -3,7 +3,7 @@ package scheduler
import (
"bytes"
"context"
- json "encoding/json/v2"
+ "encoding/json/v2"
"io"
"log/slog"
"net/http"
diff --git a/backend/pkg/scheduler/analytics_job_test.go b/backend/pkg/scheduler/analytics_job_test.go
index 4d5e0a60a..3fb806089 100644
--- a/backend/pkg/scheduler/analytics_job_test.go
+++ b/backend/pkg/scheduler/analytics_job_test.go
@@ -11,7 +11,7 @@ import (
"testing"
"time"
- sqlite "github.com/libtnb/sqlite"
+ "github.com/libtnb/sqlite"
"github.com/stretchr/testify/require"
"gorm.io/gorm"
diff --git a/backend/pkg/scheduler/auto_heal_job_test.go b/backend/pkg/scheduler/auto_heal_job_test.go
index ad59d5e0b..85345de3f 100644
--- a/backend/pkg/scheduler/auto_heal_job_test.go
+++ b/backend/pkg/scheduler/auto_heal_job_test.go
@@ -9,7 +9,7 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/internal/database"
"github.com/getarcaneapp/arcane/backend/v2/internal/models"
"github.com/getarcaneapp/arcane/backend/v2/internal/services"
- sqlite "github.com/libtnb/sqlite"
+ "github.com/libtnb/sqlite"
"github.com/moby/moby/api/types/container"
"github.com/moby/moby/client"
"github.com/stretchr/testify/require"
diff --git a/backend/pkg/scheduler/job_schedule_integration_test.go b/backend/pkg/scheduler/job_schedule_integration_test.go
index dc39bb23d..dcea6ab5b 100644
--- a/backend/pkg/scheduler/job_schedule_integration_test.go
+++ b/backend/pkg/scheduler/job_schedule_integration_test.go
@@ -10,7 +10,7 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/internal/models"
"github.com/getarcaneapp/arcane/backend/v2/internal/services"
"github.com/getarcaneapp/arcane/types/v2/jobschedule"
- sqlite "github.com/libtnb/sqlite"
+ "github.com/libtnb/sqlite"
"github.com/stretchr/testify/require"
"gorm.io/gorm"
"gorm.io/gorm/logger"
diff --git a/backend/pkg/scheduler/scheduled_prune_job_test.go b/backend/pkg/scheduler/scheduled_prune_job_test.go
index 8a291cbb8..a703c82e1 100644
--- a/backend/pkg/scheduler/scheduled_prune_job_test.go
+++ b/backend/pkg/scheduler/scheduled_prune_job_test.go
@@ -4,7 +4,7 @@ import (
"context"
"testing"
- sqlite "github.com/libtnb/sqlite"
+ "github.com/libtnb/sqlite"
"github.com/stretchr/testify/require"
"gorm.io/gorm"
diff --git a/backend/pkg/scheduler/scheduler_test.go b/backend/pkg/scheduler/scheduler_test.go
index 9059fea2e..51dff1105 100644
--- a/backend/pkg/scheduler/scheduler_test.go
+++ b/backend/pkg/scheduler/scheduler_test.go
@@ -118,8 +118,7 @@ func TestJobScheduler_StopWaitsForBusWatchers(t *testing.T) {
}
func TestJobScheduler_RegisterBusWatcherManualRunOption(t *testing.T) {
- ctx, cancel := context.WithCancel(context.Background())
- defer cancel()
+ ctx := t.Context()
js := NewJobScheduler(ctx, nil)
manualWatcher := &testBusWatcherInternal{
diff --git a/backend/pkg/scheduler/vulnerability_scan_job.go b/backend/pkg/scheduler/vulnerability_scan_job.go
index 6fd1a2595..f00fd7959 100644
--- a/backend/pkg/scheduler/vulnerability_scan_job.go
+++ b/backend/pkg/scheduler/vulnerability_scan_job.go
@@ -74,7 +74,7 @@ func (j *VulnerabilityScanJob) Run(ctx context.Context) {
slog.InfoContext(ctx, "cleaned up orphaned vulnerability scan records", "deleted", deleted)
}
- scanned, failed, err := j.vulnerabilityService.ScanAllImages(ctx, types.LOCAL_DOCKER_ENVIRONMENT_ID, vulnerabilityScanSystemUser)
+ scanned, failed, err := j.vulnerabilityService.ScanAllImages(ctx, types.LocalDockerEnvironmentID, vulnerabilityScanSystemUser)
if err != nil {
slog.ErrorContext(ctx, "scheduled vulnerability scan failed", "error", err)
return
diff --git a/backend/pkg/utils/dbutil/dbutil_test.go b/backend/pkg/utils/dbutil/dbutil_test.go
index 52bc2433c..13f42856c 100644
--- a/backend/pkg/utils/dbutil/dbutil_test.go
+++ b/backend/pkg/utils/dbutil/dbutil_test.go
@@ -5,7 +5,7 @@ import (
"errors"
"testing"
- sqlite "github.com/libtnb/sqlite"
+ "github.com/libtnb/sqlite"
"github.com/stretchr/testify/require"
"gorm.io/gorm"
)
diff --git a/backend/pkg/utils/jwtclaims/jwt.go b/backend/pkg/utils/jwtclaims/jwt.go
index f91c475e7..5d29dc478 100644
--- a/backend/pkg/utils/jwtclaims/jwt.go
+++ b/backend/pkg/utils/jwtclaims/jwt.go
@@ -3,7 +3,7 @@ package jwtclaims
import (
"crypto/rand"
"encoding/base64"
- json "encoding/json/v2"
+ "encoding/json/v2"
"fmt"
"strings"
diff --git a/backend/pkg/utils/notifications/config_credentials.go b/backend/pkg/utils/notifications/config_credentials.go
index df6a7f717..063aff8f2 100644
--- a/backend/pkg/utils/notifications/config_credentials.go
+++ b/backend/pkg/utils/notifications/config_credentials.go
@@ -2,7 +2,7 @@ package notifications
import (
"encoding/base64"
- json "encoding/json/v2"
+ "encoding/json/v2"
"log/slog"
"emperror.dev/errors"
diff --git a/backend/pkg/utils/notifications/generic_sender.go b/backend/pkg/utils/notifications/generic_sender.go
index 2cf847d43..8b986347a 100644
--- a/backend/pkg/utils/notifications/generic_sender.go
+++ b/backend/pkg/utils/notifications/generic_sender.go
@@ -3,7 +3,7 @@ package notifications
import (
"bytes"
"context"
- json "encoding/json/v2"
+ "encoding/json/v2"
"fmt"
"io"
"net/http"
diff --git a/cli/internal/client/client.go b/cli/internal/client/client.go
index a937ccaae..edd26c723 100644
--- a/cli/internal/client/client.go
+++ b/cli/internal/client/client.go
@@ -608,16 +608,11 @@ func (c *Client) DoRaw(ctx context.Context, method, path string, body any) ([]by
return b, nil
}
-// DecodeResponse decodes an API response into the given type.
-// It reads the response body, unmarshals it as JSON, and returns the typed
-// result. If the response indicates failure (Success=false) with a 4xx/5xx
-// status code, an error is returned with the error message from the API.
-// Note: This function closes the response body.
-func DecodeResponse[T any](resp *http.Response) (*APIResponse[T], error) {
- return DecodeResponseStrict[T](resp)
-}
-
-// DecodeResponseStrict decodes a response envelope and enforces HTTP and API success.
+// DecodeResponseStrict decodes an API response into the given type and enforces
+// HTTP and API success. It reads the response body, unmarshals it as JSON, and
+// returns the typed result. If the response indicates failure (Success=false) or
+// carries a non-2xx status code, an error is returned with the message from the
+// API. Note: This function closes the response body.
func DecodeResponseStrict[T any](resp *http.Response) (*APIResponse[T], error) {
defer func() { _ = resp.Body.Close() }()
diff --git a/cli/internal/cmdutil/context.go b/cli/internal/cmdutil/context.go
index a0d73b6cc..d8890701e 100644
--- a/cli/internal/cmdutil/context.go
+++ b/cli/internal/cmdutil/context.go
@@ -1,8 +1,6 @@
package cmdutil
import (
- "strings"
-
"emperror.dev/errors"
"github.com/getarcaneapp/arcane/cli/v2/internal/client"
@@ -57,17 +55,3 @@ func AssumeYes(cmd *cobra.Command) bool {
}
return false
}
-
-// ResolveOutputMode validates a free-form output mode value.
-func ResolveOutputMode(mode string) (runtimectx.OutputMode, error) {
- normalized := strings.ToLower(strings.TrimSpace(mode))
- if normalized == "" {
- return runtimectx.OutputModeText, nil
- }
- switch runtimectx.OutputMode(normalized) {
- case runtimectx.OutputModeText, runtimectx.OutputModeJSON:
- return runtimectx.OutputMode(normalized), nil
- default:
- return "", errors.Errorf("invalid output mode %q", mode)
- }
-}
diff --git a/cli/internal/cmdutil/limit.go b/cli/internal/cmdutil/limit.go
index 99930edb0..056e46afd 100644
--- a/cli/internal/cmdutil/limit.go
+++ b/cli/internal/cmdutil/limit.go
@@ -1,9 +1,6 @@
package cmdutil
import (
- "strconv"
- "strings"
-
"github.com/getarcaneapp/arcane/cli/v2/internal/config"
runtimectx "github.com/getarcaneapp/arcane/cli/v2/internal/runtime"
clitypes "github.com/getarcaneapp/arcane/cli/v2/internal/types"
@@ -45,20 +42,3 @@ func EffectiveLimit(cmd *cobra.Command, resource, flagName string, flagValue, fa
}
return 0
}
-
-// ParseResourceLimit parses a "resource=limit" pair.
-func ParseResourceLimit(pair string) (resource string, limit int, ok bool) {
- left, right, found := strings.Cut(pair, "=")
- if !found {
- return "", 0, false
- }
- resource = clitypes.NormalizePaginatedResource(left)
- if resource == "" {
- return "", 0, false
- }
- parsed, err := strconv.Atoi(strings.TrimSpace(right))
- if err != nil {
- return "", 0, false
- }
- return resource, parsed, true
-}
diff --git a/cli/internal/output/output.go b/cli/internal/output/output.go
index 77d6bb455..4a67d7e63 100644
--- a/cli/internal/output/output.go
+++ b/cli/internal/output/output.go
@@ -7,7 +7,7 @@
// # Example Usage
//
// output.Success("Operation completed")
-// output.Error("Something went wrong: %v", err)
+// output.Warning("Something looks off: %v", err)
// output.KeyValue("Status", "Running")
// output.Table([]string{"ID", "Name"}, rows)
package output
@@ -54,7 +54,6 @@ var (
var (
successStyle = lipgloss.NewStyle().Foreground(statusOnline)
- errorStyle = lipgloss.NewStyle().Foreground(statusOffline)
warnStyle = lipgloss.NewStyle().Foreground(statusWarn)
infoStyle = lipgloss.NewStyle().Foreground(arcanePurple)
headerStyle = lipgloss.NewStyle().Bold(true).Foreground(arcanePurple)
@@ -112,16 +111,6 @@ func Success(format string, a ...any) {
fmt.Printf("\n%s\n", render(successStyle, msg))
}
-// Error prints an error message in red.
-// The message is prefixed with a newline for visual separation.
-// Format specifiers and arguments work like fmt.Printf.
-//
-//nolint:goprintffuncname // printf-style output helper; *f rename across call sites tracked separately
-func Error(format string, a ...any) {
- msg := fmt.Sprintf(format, a...)
- fmt.Printf("\n%s\n", render(errorStyle, msg))
-}
-
// Warning prints a warning message in yellow.
// The message is prefixed with a newline for visual separation.
// Format specifiers and arguments work like fmt.Printf.
@@ -152,14 +141,6 @@ func Header(format string, a ...any) {
fmt.Printf("\n%s\n", render(headerStyle, msg))
}
-// Print prints a standard message without color formatting.
-// Use this for regular output that doesn't need status indication.
-//
-//nolint:goprintffuncname // printf-style output helper; *f rename across call sites tracked separately
-func Print(format string, a ...any) {
- fmt.Printf(format+"\n", a...)
-}
-
// KeyValue prints a key-value pair with the key in bold and value in blue.
// This is useful for displaying structured information like image details
// or configuration values.
diff --git a/types/base/json.go b/types/base/json.go
index b0359f336..895567be3 100644
--- a/types/base/json.go
+++ b/types/base/json.go
@@ -2,7 +2,7 @@ package base
import (
"database/sql/driver"
- json "encoding/json/v2"
+ "encoding/json/v2"
)
// JsonObject is a map-based representation of a JSON object that can be stored
diff --git a/types/dockerinfo/docker_info_test.go b/types/dockerinfo/docker_info_test.go
index 7fc0f2fd6..84a2992c0 100644
--- a/types/dockerinfo/docker_info_test.go
+++ b/types/dockerinfo/docker_info_test.go
@@ -1,7 +1,7 @@
package dockerinfo
import (
- json "encoding/json/v2"
+ "encoding/json/v2"
"testing"
"github.com/moby/moby/api/types/system"
diff --git a/types/project/marshal_utils.go b/types/project/marshal_utils.go
index e9c3d0d29..bbfbeed26 100644
--- a/types/project/marshal_utils.go
+++ b/types/project/marshal_utils.go
@@ -2,7 +2,7 @@ package project
import (
"encoding/json/jsontext"
- json "encoding/json/v2"
+ "encoding/json/v2"
"strconv"
"strings"
diff --git a/types/project/marshal_utils_test.go b/types/project/marshal_utils_test.go
index a904d4797..6a78640e6 100644
--- a/types/project/marshal_utils_test.go
+++ b/types/project/marshal_utils_test.go
@@ -1,7 +1,7 @@
package project
import (
- json "encoding/json/v2"
+ "encoding/json/v2"
"testing"
composetypes "github.com/compose-spec/compose-go/v2/types"
diff --git a/types/system/prune.go b/types/system/prune.go
index ad89c921e..0429dee79 100644
--- a/types/system/prune.go
+++ b/types/system/prune.go
@@ -2,7 +2,7 @@ package system
import (
stdjson "encoding/json"
- json "encoding/json/v2"
+ "encoding/json/v2"
)
type PruneContainerMode string
diff --git a/types/types.go b/types/types.go
index 750651d18..217d50f48 100644
--- a/types/types.go
+++ b/types/types.go
@@ -1,5 +1,3 @@
package types
-const (
- LOCAL_DOCKER_ENVIRONMENT_ID = "0"
-)
+const LocalDockerEnvironmentID = "0"