Remove Staticcheck warnings (#5394)

* remove deprecated ioutil imports

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* remove duplicate imports

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* remove unused values

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* remove some unused types

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* remove deprecated ioutil import

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
Jörn Friedrich Dreyer
2023-01-13 15:29:14 +01:00
committed by GitHub
parent 544189b039
commit 3aa864aecc
17 changed files with 48 additions and 98 deletions
+1 -2
View File
@@ -17,7 +17,6 @@ import (
"github.com/owncloud/ocis/v2/ocis-pkg/log"
pkgmiddleware "github.com/owncloud/ocis/v2/ocis-pkg/middleware"
"github.com/owncloud/ocis/v2/ocis-pkg/service/grpc"
ogrpc "github.com/owncloud/ocis/v2/ocis-pkg/service/grpc"
"github.com/owncloud/ocis/v2/ocis-pkg/version"
settingssvc "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/settings/v0"
storesvc "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/store/v0"
@@ -51,7 +50,7 @@ func Server(cfg *config.Config) *cli.Command {
if err != nil {
return err
}
err = ogrpc.Configure(ogrpc.GetClientOptions(cfg.GRPCClientTLS)...)
err = grpc.Configure(grpc.GetClientOptions(cfg.GRPCClientTLS)...)
if err != nil {
return err
}
+1 -2
View File
@@ -5,7 +5,6 @@ import (
"time"
"github.com/go-chi/chi/v5/middleware"
chimiddleware "github.com/go-chi/chi/v5/middleware"
"github.com/owncloud/ocis/v2/ocis-pkg/log"
)
@@ -19,7 +18,7 @@ func AccessLog(logger log.Logger) func(http.Handler) http.Handler {
logger.Info().
Str("proto", r.Proto).
Str(log.RequestIDString, chimiddleware.GetReqID(r.Context())).
Str(log.RequestIDString, middleware.GetReqID(r.Context())).
Str("remote-addr", r.RemoteAddr).
Str("method", r.Method).
Int("status", wrap.Status()).
+10 -11
View File
@@ -6,14 +6,13 @@ import (
pkgcrypto "github.com/owncloud/ocis/v2/ocis-pkg/crypto"
"github.com/owncloud/ocis/v2/ocis-pkg/service/http"
svc "github.com/owncloud/ocis/v2/ocis-pkg/service/http"
"github.com/owncloud/ocis/v2/ocis-pkg/shared"
"github.com/owncloud/ocis/v2/ocis-pkg/version"
"go-micro.dev/v4"
)
// Server initializes the http service and server.
func Server(opts ...Option) (svc.Service, error) {
func Server(opts ...Option) (http.Service, error) {
options := newOptions(opts...)
l := options.Logger
httpCfg := options.Config.HTTP
@@ -33,19 +32,19 @@ func Server(opts ...Option) (svc.Service, error) {
}
chain := options.Middlewares.Then(options.Handler)
service, err := svc.NewService(
svc.Name(options.Config.Service.Name),
svc.Version(version.GetString()),
service, err := http.NewService(
http.Name(options.Config.Service.Name),
http.Version(version.GetString()),
http.TLSConfig(shared.HTTPServiceTLS{
Enabled: options.Config.HTTP.TLS,
Cert: options.Config.HTTP.TLSCert,
Key: options.Config.HTTP.TLSKey,
}),
svc.Logger(options.Logger),
svc.Address(options.Config.HTTP.Addr),
svc.Namespace(options.Config.HTTP.Namespace),
svc.Context(options.Context),
svc.Flags(options.Flags...),
http.Logger(options.Logger),
http.Address(options.Config.HTTP.Addr),
http.Namespace(options.Config.HTTP.Namespace),
http.Context(options.Context),
http.Flags(options.Flags...),
)
if err != nil {
options.Logger.Error().
@@ -55,7 +54,7 @@ func Server(opts ...Option) (svc.Service, error) {
}
if err := micro.RegisterHandler(service.Server(), chain); err != nil {
return svc.Service{}, err
return http.Service{}, err
}
return service, nil
+1 -1
View File
@@ -189,7 +189,7 @@ func (c *cs3backend) CreateUserFromClaims(ctx context.Context, claims map[string
if reread {
c.logger.Debug().Msg("User already exist, re-reading via libregraph")
gureq := lgClient.UserApi.GetUser(newctx, newUser.GetOnPremisesSamAccountName())
created, resp, err = gureq.Execute()
created, _, err = gureq.Execute()
if err != nil {
c.logger.Error().Err(err).Msg("Error trying to re-read user from graphAPI")
return nil, err