Skip to content

Commit

Permalink
Improve goreport (#33)
Browse files Browse the repository at this point in the history
Signed-off-by: Valentin Pichard <7628998+w3st3ry@users.noreply.github.com>
  • Loading branch information
w3st3ry authored and pablito-perez committed Nov 25, 2019
1 parent 8f08b11 commit dd2d2e3
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 4 deletions.
1 change: 1 addition & 0 deletions api/handler/resolution.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/juju/errors"
"github.com/loopfz/gadgeto/zesty"
"github.com/sirupsen/logrus"

"github.com/ovh/utask"
"github.com/ovh/utask/engine"
"github.com/ovh/utask/engine/step"
Expand Down
4 changes: 3 additions & 1 deletion api/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/juju/errors"
"github.com/sirupsen/logrus"

"github.com/ovh/utask"
"github.com/ovh/utask/pkg/auth"
)
Expand Down Expand Up @@ -52,7 +53,8 @@ func authMiddleware(authProvider func(*http.Request) (string, error)) func(c *gi
c.AbortWithError(http.StatusUnauthorized, err)
return
}
c.Set(auth.IdentityProviderCtxKey, user)
ctxKey := string(auth.IdentityProviderCtxKey)
c.Set(ctxKey, user)
c.Next()
}
}
Expand Down
1 change: 1 addition & 0 deletions cmd/utask/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"

"github.com/spf13/cobra"

"github.com/ovh/utask"
)

Expand Down
1 change: 1 addition & 0 deletions engine/collector_retry.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

"github.com/loopfz/gadgeto/zesty"
"github.com/sirupsen/logrus"

"github.com/ovh/utask"
"github.com/ovh/utask/db/pgjuju"
"github.com/ovh/utask/models/resolution"
Expand Down
1 change: 1 addition & 0 deletions engine/step/step.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

"github.com/juju/errors"
"github.com/sirupsen/logrus"

"github.com/ovh/utask"
"github.com/ovh/utask/engine/values"
"github.com/ovh/utask/pkg/jsonschema"
Expand Down
4 changes: 2 additions & 2 deletions engine/values/values.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ func (v *Values) GetError(stepName string) interface{} {
return v.getStepData(stepName, ErrorKey)
}

// SetChildren stores the error resulting from a failed step
// SetError stores the error resulting from a failed step
func (v *Values) SetError(stepName string, value interface{}) {
v.setStepData(stepName, ErrorKey, value)
}

// UnsetChildren empties the error from a failed step
// UnsetError empties the error from a failed step
func (v *Values) UnsetError(stepName string) {
v.unsetStepData(stepName, ErrorKey)
}
Expand Down
7 changes: 6 additions & 1 deletion pkg/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ import (
"github.com/ovh/utask/pkg/utils"
)

// CtxKey is a custom type based on string type
// used to fix golint when IdentityProviderCtxKey
// is set
type CtxKey string

// IdentityProviderCtxKey is the key used to store/retrieve identity data from Context
const IdentityProviderCtxKey = "__identity_provider_key"

Expand All @@ -22,7 +27,7 @@ var (

// WithIdentity adds identity data to a context
func WithIdentity(ctx context.Context, id string) context.Context {
return context.WithValue(ctx, IdentityProviderCtxKey, id)
return context.WithValue(ctx, CtxKey(IdentityProviderCtxKey), id)
}

// Init reads authorization from configstore, bootstraps values
Expand Down
1 change: 1 addition & 0 deletions pkg/jsonschema/jsonschema.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/juju/errors"
"github.com/santhosh-tekuri/jsonschema"

"github.com/ovh/utask/pkg/utils"
)

Expand Down
1 change: 1 addition & 0 deletions pkg/plugins/builtin/ssh/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

"github.com/juju/errors"
"golang.org/x/crypto/ssh"

"github.com/ovh/utask/pkg/plugins/taskplugin"
)

Expand Down
1 change: 1 addition & 0 deletions pkg/plugins/plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/ovh/configstore"
"github.com/sirupsen/logrus"

"github.com/ovh/utask/api"
"github.com/ovh/utask/engine/step"
)
Expand Down

0 comments on commit dd2d2e3

Please # to comment.