Skip to content

Commit bd0b27a

Browse files
committed
fix: gci section warnings
Signed-off-by: Mario Constanti <[email protected]>
1 parent 8fc001f commit bd0b27a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+166
-181
lines changed

apiserver/controllers/controllers.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ import (
2222
"net/http"
2323
"strings"
2424

25+
"github.com/gorilla/mux"
26+
"github.com/gorilla/websocket"
27+
"github.com/pkg/errors"
28+
2529
gErrors "github.com/cloudbase/garm-provider-common/errors"
2630
"github.com/cloudbase/garm-provider-common/util"
2731
"github.com/cloudbase/garm/apiserver/params"
@@ -30,10 +34,6 @@ import (
3034
runnerParams "github.com/cloudbase/garm/params"
3135
"github.com/cloudbase/garm/runner"
3236
wsWriter "github.com/cloudbase/garm/websocket"
33-
34-
"github.com/gorilla/mux"
35-
"github.com/gorilla/websocket"
36-
"github.com/pkg/errors"
3737
)
3838

3939
func NewAPIController(r *runner.Runner, authenticator *auth.Authenticator, hub *wsWriter.Hub) (*APIController, error) {

apiserver/controllers/enterprises.go

+2-5
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ import (
1919
"log/slog"
2020
"net/http"
2121

22+
"github.com/gorilla/mux"
23+
2224
gErrors "github.com/cloudbase/garm-provider-common/errors"
2325
"github.com/cloudbase/garm/apiserver/params"
2426
runnerParams "github.com/cloudbase/garm/params"
25-
26-
"github.com/gorilla/mux"
2727
)
2828

2929
// swagger:route POST /enterprises enterprises CreateEnterprise
@@ -165,7 +165,6 @@ func (a *APIController) DeleteEnterpriseHandler(w http.ResponseWriter, r *http.R
165165

166166
w.Header().Set("Content-Type", "application/json")
167167
w.WriteHeader(http.StatusOK)
168-
169168
}
170169

171170
// swagger:route PUT /enterprises/{enterpriseID} enterprises UpdateEnterprise
@@ -318,7 +317,6 @@ func (a *APIController) ListEnterprisePoolsHandler(w http.ResponseWriter, r *htt
318317
if err := json.NewEncoder(w).Encode(pools); err != nil {
319318
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to encode response")
320319
}
321-
322320
}
323321

324322
// swagger:route GET /enterprises/{enterpriseID}/pools/{poolID} enterprises pools GetEnterprisePool
@@ -414,7 +412,6 @@ func (a *APIController) DeleteEnterprisePoolHandler(w http.ResponseWriter, r *ht
414412

415413
w.Header().Set("Content-Type", "application/json")
416414
w.WriteHeader(http.StatusOK)
417-
418415
}
419416

420417
// swagger:route PUT /enterprises/{enterpriseID}/pools/{poolID} enterprises pools UpdateEnterprisePool

apiserver/controllers/instances.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ import (
2020
"net/http"
2121
"strconv"
2222

23+
"github.com/gorilla/mux"
24+
2325
gErrors "github.com/cloudbase/garm-provider-common/errors"
2426
"github.com/cloudbase/garm/apiserver/params"
2527
runnerParams "github.com/cloudbase/garm/params"
26-
27-
"github.com/gorilla/mux"
2828
)
2929

3030
// swagger:route GET /pools/{poolID}/instances instances ListPoolInstances

apiserver/controllers/metadata.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ import (
2020
"log/slog"
2121
"net/http"
2222

23-
"github.com/cloudbase/garm/apiserver/params"
2423
"github.com/gorilla/mux"
24+
25+
"github.com/cloudbase/garm/apiserver/params"
2526
)
2627

2728
func (a *APIController) InstanceGithubRegistrationTokenHandler(w http.ResponseWriter, r *http.Request) {

apiserver/controllers/organizations.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ import (
2020
"net/http"
2121
"strconv"
2222

23+
"github.com/gorilla/mux"
24+
2325
gErrors "github.com/cloudbase/garm-provider-common/errors"
2426
"github.com/cloudbase/garm/apiserver/params"
2527
runnerParams "github.com/cloudbase/garm/params"
26-
27-
"github.com/gorilla/mux"
2828
)
2929

3030
// swagger:route POST /organizations organizations CreateOrg
@@ -174,7 +174,6 @@ func (a *APIController) DeleteOrgHandler(w http.ResponseWriter, r *http.Request)
174174

175175
w.Header().Set("Content-Type", "application/json")
176176
w.WriteHeader(http.StatusOK)
177-
178177
}
179178

180179
// swagger:route PUT /organizations/{orgID} organizations UpdateOrg
@@ -423,7 +422,6 @@ func (a *APIController) DeleteOrgPoolHandler(w http.ResponseWriter, r *http.Requ
423422

424423
w.Header().Set("Content-Type", "application/json")
425424
w.WriteHeader(http.StatusOK)
426-
427425
}
428426

429427
// swagger:route PUT /organizations/{orgID}/pools/{poolID} organizations pools UpdateOrgPool

apiserver/controllers/pools.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ import (
1919
"log/slog"
2020
"net/http"
2121

22+
"github.com/gorilla/mux"
23+
2224
gErrors "github.com/cloudbase/garm-provider-common/errors"
2325
"github.com/cloudbase/garm/apiserver/params"
2426
runnerParams "github.com/cloudbase/garm/params"
25-
26-
"github.com/gorilla/mux"
2727
)
2828

2929
// swagger:route GET /pools pools ListPools
@@ -37,7 +37,6 @@ func (a *APIController) ListAllPoolsHandler(w http.ResponseWriter, r *http.Reque
3737
ctx := r.Context()
3838

3939
pools, err := a.r.ListAllPools(ctx)
40-
4140
if err != nil {
4241
slog.With(slog.Any("error", err)).ErrorContext(ctx, "listing pools")
4342
handleError(ctx, w, err)

apiserver/controllers/repositories.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ import (
2020
"net/http"
2121
"strconv"
2222

23+
"github.com/gorilla/mux"
24+
2325
gErrors "github.com/cloudbase/garm-provider-common/errors"
2426
"github.com/cloudbase/garm/apiserver/params"
2527
runnerParams "github.com/cloudbase/garm/params"
26-
27-
"github.com/gorilla/mux"
2828
)
2929

3030
// swagger:route POST /repositories repositories CreateRepo
@@ -173,7 +173,6 @@ func (a *APIController) DeleteRepoHandler(w http.ResponseWriter, r *http.Request
173173

174174
w.Header().Set("Content-Type", "application/json")
175175
w.WriteHeader(http.StatusOK)
176-
177176
}
178177

179178
// swagger:route PUT /repositories/{repoID} repositories UpdateRepo
@@ -422,7 +421,6 @@ func (a *APIController) DeleteRepoPoolHandler(w http.ResponseWriter, r *http.Req
422421

423422
w.Header().Set("Content-Type", "application/json")
424423
w.WriteHeader(http.StatusOK)
425-
426424
}
427425

428426
// swagger:route PUT /repositories/{repoID}/pools/{poolID} repositories pools UpdateRepoPool

apiserver/routers/routers.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func requestLogger(h http.Handler) http.Handler {
8787
// gathers metrics from the upstream handlers
8888
metrics := httpsnoop.CaptureMetrics(h, w, r)
8989

90-
//prints log and metrics
90+
9191
slog.Info(
9292
"access_log",
9393
slog.String("method", r.Method),

auth/auth.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ import (
1818
"context"
1919
"time"
2020

21+
jwt "github.com/golang-jwt/jwt/v5"
22+
"github.com/nbutton23/zxcvbn-go"
23+
"github.com/pkg/errors"
24+
"golang.org/x/crypto/bcrypt"
25+
2126
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
2227
"github.com/cloudbase/garm-provider-common/util"
2328
"github.com/cloudbase/garm/config"
2429
"github.com/cloudbase/garm/database/common"
2530
"github.com/cloudbase/garm/params"
26-
27-
jwt "github.com/golang-jwt/jwt/v5"
28-
"github.com/nbutton23/zxcvbn-go"
29-
"github.com/pkg/errors"
30-
"golang.org/x/crypto/bcrypt"
3131
)
3232

3333
func NewAuthenticator(cfg config.JWTAuth, store common.Store) *Authenticator {

auth/instance_middleware.go

+5-6
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ import (
2222
"strings"
2323
"time"
2424

25+
jwt "github.com/golang-jwt/jwt/v5"
26+
"github.com/pkg/errors"
27+
28+
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
29+
commonParams "github.com/cloudbase/garm-provider-common/params"
2530
"github.com/cloudbase/garm/config"
2631
dbCommon "github.com/cloudbase/garm/database/common"
2732
"github.com/cloudbase/garm/params"
2833
"github.com/cloudbase/garm/runner/common"
29-
30-
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
31-
commonParams "github.com/cloudbase/garm-provider-common/params"
32-
jwt "github.com/golang-jwt/jwt/v5"
33-
"github.com/pkg/errors"
3434
)
3535

3636
// InstanceJWTClaims holds JWT claims
@@ -132,7 +132,6 @@ func (amw *instanceMiddleware) Middleware(next http.Handler) http.Handler {
132132
}
133133
return []byte(amw.cfg.Secret), nil
134134
})
135-
136135
if err != nil {
137136
invalidAuthResponse(ctx, w)
138137
return

auth/jwt.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ import (
2222
"net/http"
2323
"strings"
2424

25+
jwt "github.com/golang-jwt/jwt/v5"
26+
2527
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
2628
apiParams "github.com/cloudbase/garm/apiserver/params"
2729
"github.com/cloudbase/garm/config"
2830
dbCommon "github.com/cloudbase/garm/database/common"
29-
30-
jwt "github.com/golang-jwt/jwt/v5"
3131
)
3232

3333
// JWTClaims holds JWT claims
@@ -108,7 +108,6 @@ func (amw *jwtMiddleware) Middleware(next http.Handler) http.Handler {
108108
}
109109
return []byte(amw.cfg.Secret), nil
110110
})
111-
112111
if err != nil {
113112
invalidAuthResponse(ctx, w)
114113
return

auth/metrics.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import (
66
"net/http"
77
"strings"
88

9-
"github.com/cloudbase/garm/config"
10-
119
jwt "github.com/golang-jwt/jwt/v5"
10+
11+
"github.com/cloudbase/garm/config"
1212
)
1313

1414
type MetricsMiddleware struct {
@@ -43,7 +43,6 @@ func (m *MetricsMiddleware) Middleware(next http.Handler) http.Handler {
4343
}
4444
return []byte(m.cfg.Secret), nil
4545
})
46-
4746
if err != nil {
4847
invalidAuthResponse(ctx, w)
4948
return

cmd/garm-cli/cmd/controller_info.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@ package cmd
1717
import (
1818
"fmt"
1919

20-
apiClientControllerInfo "github.com/cloudbase/garm/client/controller_info"
21-
"github.com/cloudbase/garm/params"
2220
"github.com/jedib0t/go-pretty/v6/table"
2321
"github.com/spf13/cobra"
22+
23+
apiClientControllerInfo "github.com/cloudbase/garm/client/controller_info"
24+
"github.com/cloudbase/garm/params"
2425
)
2526

2627
var infoCmd = &cobra.Command{

cmd/garm-cli/cmd/credentials.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ package cmd
1717
import (
1818
"fmt"
1919

20-
apiClientCreds "github.com/cloudbase/garm/client/credentials"
21-
"github.com/cloudbase/garm/params"
22-
2320
"github.com/jedib0t/go-pretty/v6/table"
2421
"github.com/spf13/cobra"
22+
23+
apiClientCreds "github.com/cloudbase/garm/client/credentials"
24+
"github.com/cloudbase/garm/params"
2525
)
2626

2727
// credentialsCmd represents the credentials command

cmd/garm-cli/cmd/enterprise.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ package cmd
1717
import (
1818
"fmt"
1919

20-
apiClientEnterprises "github.com/cloudbase/garm/client/enterprises"
21-
"github.com/cloudbase/garm/params"
22-
2320
"github.com/jedib0t/go-pretty/v6/table"
2421
"github.com/spf13/cobra"
22+
23+
apiClientEnterprises "github.com/cloudbase/garm/client/enterprises"
24+
"github.com/cloudbase/garm/params"
2525
)
2626

2727
var (

cmd/garm-cli/cmd/init.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ import (
1818
"fmt"
1919
"strings"
2020

21-
"github.com/cloudbase/garm/cmd/garm-cli/common"
22-
"github.com/cloudbase/garm/cmd/garm-cli/config"
23-
"github.com/cloudbase/garm/params"
24-
25-
apiClientFirstRun "github.com/cloudbase/garm/client/first_run"
26-
apiClientLogin "github.com/cloudbase/garm/client/login"
2721
"github.com/jedib0t/go-pretty/v6/table"
2822
"github.com/pkg/errors"
2923
"github.com/spf13/cobra"
24+
25+
apiClientFirstRun "github.com/cloudbase/garm/client/first_run"
26+
apiClientLogin "github.com/cloudbase/garm/client/login"
27+
"github.com/cloudbase/garm/cmd/garm-cli/common"
28+
"github.com/cloudbase/garm/cmd/garm-cli/config"
29+
"github.com/cloudbase/garm/params"
3030
)
3131

3232
// initCmd represents the init command

cmd/garm-cli/cmd/jobs.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@ import (
1818
"fmt"
1919
"strings"
2020

21-
apiClientJobs "github.com/cloudbase/garm/client/jobs"
22-
"github.com/cloudbase/garm/params"
2321
"github.com/google/uuid"
2422
"github.com/jedib0t/go-pretty/v6/table"
2523
"github.com/spf13/cobra"
24+
25+
apiClientJobs "github.com/cloudbase/garm/client/jobs"
26+
"github.com/cloudbase/garm/params"
2627
)
2728

2829
// runnerCmd represents the runner command

cmd/garm-cli/cmd/log.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ import (
1111
"os/signal"
1212
"time"
1313

14-
"github.com/cloudbase/garm-provider-common/util"
15-
apiParams "github.com/cloudbase/garm/apiserver/params"
16-
1714
"github.com/gorilla/websocket"
1815
"github.com/spf13/cobra"
16+
17+
"github.com/cloudbase/garm-provider-common/util"
18+
apiParams "github.com/cloudbase/garm/apiserver/params"
1919
)
2020

2121
var logCmd = &cobra.Command{

cmd/garm-cli/cmd/metrics.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ package cmd
1717
import (
1818
"fmt"
1919

20-
apiClientMetricToken "github.com/cloudbase/garm/client/metrics_token"
2120
"github.com/spf13/cobra"
21+
22+
apiClientMetricToken "github.com/cloudbase/garm/client/metrics_token"
2223
)
2324

2425
// orgPoolCmd represents the pool command

cmd/garm-cli/cmd/organization.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ package cmd
1717
import (
1818
"fmt"
1919

20+
"github.com/jedib0t/go-pretty/v6/table"
21+
"github.com/spf13/cobra"
22+
2023
"github.com/cloudbase/garm-provider-common/util"
2124
apiClientOrgs "github.com/cloudbase/garm/client/organizations"
2225
"github.com/cloudbase/garm/params"
23-
24-
"github.com/jedib0t/go-pretty/v6/table"
25-
"github.com/spf13/cobra"
2626
)
2727

2828
var (

0 commit comments

Comments
 (0)