Skip to content

Commit

Permalink
make lint-all now passes (fixed all govet and goconst)
Browse files Browse the repository at this point in the history
  • Loading branch information
romangithub1024 committed Jun 22, 2018
1 parent d6b226d commit 8f40926
Show file tree
Hide file tree
Showing 15 changed files with 26 additions and 24 deletions.
4 changes: 2 additions & 2 deletions pkg/api/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ func (api *coreAPI) handleLogin(writer http.ResponseWriter, request *http.Reques
api.contentType.WriteOne(writer, request, serverErr)
} else {
api.contentType.WriteOne(writer, request, &AuthSuccess{
AuthSuccessObject.GetTypeKind(),
api.newToken(user),
TypeKind: AuthSuccessObject.GetTypeKind(),
Token: api.newToken(user),
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/codec/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func NewContentTypeHandler(reg *runtime.Registry) *ContentTypeHandler {
codecs[YAML] = yaml.NewCodec(reg)
codecs[JSON] = yaml.NewJSONCodec(reg)

return &ContentTypeHandler{codecs}
return &ContentTypeHandler{codecs: codecs}
}

// GetCodecByContentType returns runtime codec for provided content type that should be used
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/dependency_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func (api *coreAPI) handleDependencyResourcesGet(writer http.ResponseWriter, req
// no error, do nothing (but we have to keep an empty default block)
}

api.contentType.WriteOne(writer, request, &dependencyResourcesWrapper{resources})
api.contentType.WriteOne(writer, request, &dependencyResourcesWrapper{Resources: resources})
}

func pluginForComponentInstance(instance *resolve.ComponentInstance, policy *lang.Policy, plugins plugin.Registry) (plugin.CodePlugin, error) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ type ServerError struct {

// NewServerError returns instance of the error based on the provided error
func NewServerError(error string) *ServerError {
return &ServerError{ServerErrorObject.GetTypeKind(), error}
return &ServerError{TypeKind: ServerErrorObject.GetTypeKind(), Error: error}
}
2 changes: 1 addition & 1 deletion pkg/api/middleware/recovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type panicHandler struct {
// NewPanicHandler returns HTTP handler for Panics processing
func NewPanicHandler(handler http.Handler) http.Handler {
contentTypeHandler := codec.NewContentTypeHandler(runtime.NewRegistry().Append(api.ServerErrorObject))
return &panicHandler{handler, contentTypeHandler}
return &panicHandler{handler: handler, contentType: contentTypeHandler}
}

func (h *panicHandler) ServeHTTP(writer http.ResponseWriter, request *http.Request) {
Expand Down
14 changes: 7 additions & 7 deletions pkg/client/rest/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,29 @@ type coreClient struct {

// New returns new instance of the Core API client http rest implementation
func New(cfg *config.Client, httpClient http.Client) client.Core {
return &coreClient{cfg, httpClient}
return &coreClient{cfg: cfg, httpClient: httpClient}
}

func (client *coreClient) Policy() client.Policy {
return &policyClient{client.cfg, client.httpClient}
return &policyClient{cfg: client.cfg, httpClient: client.httpClient}
}

func (client *coreClient) Dependency() client.Dependency {
return &dependencyClient{client.cfg, client.httpClient}
return &dependencyClient{cfg: client.cfg, httpClient: client.httpClient}
}

func (client *coreClient) Revision() client.Revision {
return &revisionClient{client.cfg, client.httpClient}
return &revisionClient{cfg: client.cfg, httpClient: client.httpClient}
}

func (client *coreClient) State() client.State {
return &stateClient{client.cfg, client.httpClient}
return &stateClient{cfg: client.cfg, httpClient: client.httpClient}
}

func (client *coreClient) User() client.User {
return &userClient{client.cfg, client.httpClient}
return &userClient{cfg: client.cfg, httpClient: client.httpClient}
}

func (client *coreClient) Version() client.Version {
return &versionClient{client.cfg, client.httpClient}
return &versionClient{cfg: client.cfg, httpClient: client.httpClient}
}
2 changes: 1 addition & 1 deletion pkg/client/rest/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func NewClient(cfg *config.Client) Client {
}
contentTypeHandler := codec.NewContentTypeHandler(runtime.NewRegistry().Append(api.Objects...))

return &httpClient{contentTypeHandler, client, cfg}
return &httpClient{contentType: contentTypeHandler, http: client, cfg: cfg}
}

func (client *httpClient) GET(path string, expected *runtime.Info) (runtime.Object, error) {
Expand Down
1 change: 1 addition & 0 deletions pkg/engine/diff/policy_resolution_diff_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// nolint: goconst
package diff

import (
Expand Down
2 changes: 1 addition & 1 deletion pkg/engine/resolve/component_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ type ComponentInstance struct {
func newComponentInstance(cik *ComponentInstanceKey) *ComponentInstance {
return &ComponentInstance{
TypeKind: ComponentInstanceObject.GetTypeKind(),
Metadata: &ComponentInstanceMetadata{cik},
Metadata: &ComponentInstanceMetadata{Key: cik},
DependencyKeys: make(map[string]int),
CalculatedLabels: lang.NewLabelSet(make(map[string]string)),
CalculatedDiscovery: util.NestedParameterMap{},
Expand Down
1 change: 1 addition & 0 deletions pkg/engine/resolve/policy_resolver_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// nolint: goconst
package resolve

import (
Expand Down
2 changes: 1 addition & 1 deletion pkg/event/hook_api_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (hook *HookAPIEvents) Levels() []logrus.Level {

// Fire processes a single log entry
func (hook *HookAPIEvents) Fire(e *logrus.Entry) error {
apiEvent := &APIEvent{e.Time, e.Level.String(), e.Message}
apiEvent := &APIEvent{Time: e.Time, LogLevel: e.Level.String(), Message: e.Message}
hook.events = append(hook.events, apiEvent)
return nil
}
4 changes: 2 additions & 2 deletions pkg/plugin/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ type ResourceRegistry struct {
// NewResourceRegistry creates new ResourceRegistry
func NewResourceRegistry() *ResourceRegistry {
return &ResourceRegistry{
make(map[string][]string),
make(map[string]ResourceTypeHandler),
headers: make(map[string][]string),
handlers: make(map[string]ResourceTypeHandler),
}
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/runtime/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ func (info *Info) New() Object {

// GetTypeKind returns TypeKind instance for the object described by info
func (info *Info) GetTypeKind() TypeKind {
return TypeKind{info.Kind}
return TypeKind{Kind: info.Kind}
}
2 changes: 1 addition & 1 deletion pkg/server/background.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func (j *job) start() {
}

func (server *Server) runInBackground(name string, infinite bool, f func()) {
p := job{name, server.backgroundErrors, f, infinite}
p := job{name: name, errors: server.backgroundErrors, f: f, infinite: infinite}
go p.start()
}

Expand Down
8 changes: 4 additions & 4 deletions pkg/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ var (
// GetBuildInfo returns BuildInfo for aptomi
func GetBuildInfo() *BuildInfo {
return &BuildInfo{
BuildInfoObject.GetTypeKind(),
gitVersion,
gitCommit,
buildDate,
TypeKind: BuildInfoObject.GetTypeKind(),
GitVersion: gitVersion,
GitCommit: gitCommit,
BuildDate: buildDate,
}
}

Expand Down

0 comments on commit 8f40926

Please sign in to comment.