Fix relevant go-vet/go-lint for server package
parent
2aadaf3ff6
commit
c161dd3cc1
|
@ -130,6 +130,7 @@ func (s *Service) OrganizationID(w http.ResponseWriter, r *http.Request) {
|
||||||
encodeJSON(w, http.StatusOK, res, s.Logger)
|
encodeJSON(w, http.StatusOK, res, s.Logger)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UpdateOrganization updates an organization in the organizations store
|
||||||
func (s *Service) UpdateOrganization(w http.ResponseWriter, r *http.Request) {
|
func (s *Service) UpdateOrganization(w http.ResponseWriter, r *http.Request) {
|
||||||
var req organizationRequest
|
var req organizationRequest
|
||||||
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
|
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
|
||||||
|
@ -171,6 +172,8 @@ func (s *Service) UpdateOrganization(w http.ResponseWriter, r *http.Request) {
|
||||||
encodeJSON(w, http.StatusOK, res, s.Logger)
|
encodeJSON(w, http.StatusOK, res, s.Logger)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RemoveOrganization removes an organization in the organizations store
|
||||||
func (s *Service) RemoveOrganization(w http.ResponseWriter, r *http.Request) {
|
func (s *Service) RemoveOrganization(w http.ResponseWriter, r *http.Request) {
|
||||||
ctx := r.Context()
|
ctx := r.Context()
|
||||||
idStr := httprouter.GetParamFromContext(ctx, "id")
|
idStr := httprouter.GetParamFromContext(ctx, "id")
|
||||||
|
|
|
@ -28,6 +28,8 @@ func hasOrganizationContext(ctx context.Context) (string, bool) {
|
||||||
|
|
||||||
type superAdminKey string
|
type superAdminKey string
|
||||||
|
|
||||||
|
// SuperAdminKey is the context key for retrieving is the context
|
||||||
|
// is for a super admin
|
||||||
const SuperAdminKey = superAdminKey("superadmin")
|
const SuperAdminKey = superAdminKey("superadmin")
|
||||||
|
|
||||||
// hasSuperAdminContext speficies if the context contains
|
// hasSuperAdminContext speficies if the context contains
|
||||||
|
@ -45,7 +47,7 @@ func hasSuperAdminContext(ctx context.Context) bool {
|
||||||
return sa
|
return sa
|
||||||
}
|
}
|
||||||
|
|
||||||
// DataSource is collection of resources that are used by the Service
|
// DataStore is collection of resources that are used by the Service
|
||||||
// Abstracting this into an interface was useful for isolated testing
|
// Abstracting this into an interface was useful for isolated testing
|
||||||
type DataStore interface {
|
type DataStore interface {
|
||||||
Sources(ctx context.Context) chronograf.SourcesStore
|
Sources(ctx context.Context) chronograf.SourcesStore
|
||||||
|
@ -126,7 +128,7 @@ func (s *Store) Dashboards(ctx context.Context) chronograf.DashboardsStore {
|
||||||
return &noop.DashboardsStore{}
|
return &noop.DashboardsStore{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DashboardsStore returns the underlying OrganizationsStore.
|
// Organizations returns the underlying OrganizationsStore.
|
||||||
func (s *Store) Organizations(ctx context.Context) chronograf.OrganizationsStore {
|
func (s *Store) Organizations(ctx context.Context) chronograf.OrganizationsStore {
|
||||||
return s.OrganizationsStore
|
return s.OrganizationsStore
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue