Skip to content

Commit

Permalink
Remove exhaustivestruct linter (#68)
Browse files Browse the repository at this point in the history
It's not really helpful.
  • Loading branch information
ozerovandrei authored Aug 25, 2021
1 parent d0673cf commit 02c93fa
Show file tree
Hide file tree
Showing 14 changed files with 0 additions and 30 deletions.
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ linters:
- durationcheck
- errorlint
- exhaustive
- exhaustivestruct
- exportloopref
- forbidigo
- forcetypeassert
Expand Down
2 changes: 0 additions & 2 deletions internal/metric/recorder.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ type Recorder struct {
}

// NewRecorder registers all metrics and returns a new metric recorder.
// nolint: exhaustivestruct
func NewRecorder() (*Recorder, error) {
registry := prometheus.NewRegistry()

Expand Down Expand Up @@ -83,7 +82,6 @@ func (r *Recorder) HTTPHandler() http.Handler {
// NewRequestDuration configures and returns a new request_duration_seconds histogram.
func NewRequestDuration() *prometheus.HistogramVec {
return prometheus.NewHistogramVec(
// nolint:exhaustivestruct
prometheus.HistogramOpts{
Name: requestDurMetricName,
Help: requestDurMetricHelp,
Expand Down
1 change: 0 additions & 1 deletion internal/metric/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ type Server struct {
// NewServer configures a new Server.
func NewServer(log *zerolog.Logger, metricCfg config.MetricsConfig, pRec PromRecorder) (*Server, error) {
return &Server{
// nolint: exhaustivestruct
httpServer: &http.Server{
Addr: metricCfg.Address,
ReadTimeout: time.Duration(metricCfg.ReadTimeoutSeconds) * time.Second,
Expand Down
2 changes: 0 additions & 2 deletions internal/servergrpc/chartapiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ func NewServer(log *zerolog.Logger, bCon backend.ConnSupervisor, gRPCCfg config.
interceptor.Observer(log, pRec),
),
)

// nolint: exhaustivestruct
chartAPIServer := &Server{
log: log,
grpcServer: grpcServer,
Expand Down
2 changes: 0 additions & 2 deletions internal/servergrpc/chartapiserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ func newTestingChartAPIEnv(ctx context.Context, t *testing.T, opts testingChartA
}()

log := zerolog.New(os.Stderr)

// nolint: exhaustivestruct
cfg := config.Config{
GRPC: config.GRPCConfig{
Address: tcputils.LocalhostWithRandomPort,
Expand Down
2 changes: 0 additions & 2 deletions internal/servergrpchealthcheck/healthcheckserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ func NewServer(log *zerolog.Logger, bCon backend.ConnSupervisor, hcCfg config.GR
}

grpcServer := grpc.NewServer()

// nolint: exhaustivestruct
hcServer := &Server{
log: log,
grpcServer: grpcServer,
Expand Down
2 changes: 0 additions & 2 deletions internal/servergrpchealthcheck/healthcheckserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ func TestCheck_OK(t *testing.T) {

hcClient := grpc_health_v1.NewHealthClient(testingHCEnv.hcServerConn)

// nolint: exhaustivestruct
hcReply, hcErr := hcClient.Check(ctx, &grpc_health_v1.HealthCheckRequest{})

assert.NoError(t, hcErr)
Expand All @@ -80,7 +79,6 @@ func TestCheck_Err(t *testing.T) {

hcClient := grpc_health_v1.NewHealthClient(testingHCEnv.hcServerConn)

// nolint: exhaustivestruct
hcReply, hcErr := hcClient.Check(ctx, &grpc_health_v1.HealthCheckRequest{})

assert.NoError(t, hcErr)
Expand Down
1 change: 0 additions & 1 deletion internal/serverhttp/chartapiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ type Server struct {
// NewServer configures a new Server.
func NewServer(log *zerolog.Logger, bCon backend.ConnSupervisor, httpCfg config.HTTPConfig, pRec metric.PromRecorder) (*Server, error) {
return &Server{
// nolint: exhaustivestruct
httpServer: &http.Server{
Addr: httpCfg.Address,
ReadTimeout: time.Duration(httpCfg.ReadTimeoutSeconds) * time.Second,
Expand Down
1 change: 0 additions & 1 deletion internal/serverhttp/v0/middleware/create_chart.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
func RequireCreateChartParams(log *zerolog.Logger) func(next http.Handler) http.Handler {
return func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// nolint: exhaustivestruct
createOptsJSON := view.CreateChartRequest{}

err := json.NewDecoder(r.Body).Decode(&createOptsJSON)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ func TestCreateChart_VerticalAndLineOK(t *testing.T) {
Chart *view.ChartReply `json:"chart"`
}

// nolint: exhaustivestruct
respBody := respChart{}

if err = json.Unmarshal(body, &respBody); err != nil {
Expand Down Expand Up @@ -231,7 +230,6 @@ func TestCreateChart_VerticalAndLineOKGZIP(t *testing.T) {
Chart *view.ChartReply `json:"chart"`
}

// nolint: exhaustivestruct
respBody := respChart{}

respReader, err := gzip.NewReader(resp.Body)
Expand Down
5 changes: 0 additions & 5 deletions internal/testutils/chartrequests.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ type CreateChartRequest struct {
}

func NewCreateChartRequest() *CreateChartRequest {
// nolint: exhaustivestruct
return &CreateChartRequest{&render.CreateChartRequest{}}
}

Expand Down Expand Up @@ -71,7 +70,6 @@ func (req *CreateChartRequest) SetBadMargins() *CreateChartRequest {
func (req *CreateChartRequest) SetBandBottomAxis() *CreateChartRequest {
axes := req.Axes
if axes == nil {
// nolint: exhaustivestruct
axes = &render.ChartAxes{}
}

Expand All @@ -84,7 +82,6 @@ func (req *CreateChartRequest) SetBandBottomAxis() *CreateChartRequest {
func (req *CreateChartRequest) SetBottomAxisLabel() *CreateChartRequest {
axes := req.Axes
if axes == nil {
// nolint: exhaustivestruct
axes = &render.ChartAxes{}
}

Expand All @@ -97,7 +94,6 @@ func (req *CreateChartRequest) SetBottomAxisLabel() *CreateChartRequest {
func (req *CreateChartRequest) SetLinearLeftAxis() *CreateChartRequest {
axes := req.Axes
if axes == nil {
// nolint: exhaustivestruct
axes = &render.ChartAxes{}
}

Expand All @@ -110,7 +106,6 @@ func (req *CreateChartRequest) SetLinearLeftAxis() *CreateChartRequest {
func (req *CreateChartRequest) SetLeftAxisLabel() *CreateChartRequest {
axes := req.Axes
if axes == nil {
// nolint: exhaustivestruct
axes = &render.ChartAxes{}
}

Expand Down
2 changes: 0 additions & 2 deletions internal/testutils/chartviews.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ func (v *ChartView) SetDefaultColors() *ChartView {
func (v *ChartView) SetFillAndStrokeColor() *ChartView {
colors := v.Colors
if colors == nil {
// nolint: exhaustivestruct
colors = &render.ChartViewColors{}
}

Expand All @@ -212,7 +211,6 @@ func (v *ChartView) SetFillAndStrokeColor() *ChartView {
func (v *ChartView) SetBadFillRGBColor() *ChartView {
colors := v.Colors
if colors == nil {
// nolint: exhaustivestruct
colors = &render.ChartViewColors{}
}

Expand Down
5 changes: 0 additions & 5 deletions internal/testutils/jsonchartrequests.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ type JSONCreateChartRequest struct {
}

func NewJSONCreateChartRequest() *JSONCreateChartRequest {
// nolint: exhaustivestruct
return &JSONCreateChartRequest{&view.CreateChartRequest{}}
}

Expand Down Expand Up @@ -46,7 +45,6 @@ func (req *JSONCreateChartRequest) SetMargins() *JSONCreateChartRequest {
func (req *JSONCreateChartRequest) SetBandBottomAxis() *JSONCreateChartRequest {
axes := req.Chart.Axes
if axes == nil {
// nolint: exhaustivestruct
axes = &view.ChartAxes{}
}

Expand All @@ -59,7 +57,6 @@ func (req *JSONCreateChartRequest) SetBandBottomAxis() *JSONCreateChartRequest {
func (req *JSONCreateChartRequest) SetBottomAxisLabel() *JSONCreateChartRequest {
axes := req.Chart.Axes
if axes == nil {
// nolint: exhaustivestruct
axes = &view.ChartAxes{}
}

Expand All @@ -72,7 +69,6 @@ func (req *JSONCreateChartRequest) SetBottomAxisLabel() *JSONCreateChartRequest
func (req *JSONCreateChartRequest) SetLinearLeftAxis() *JSONCreateChartRequest {
axes := req.Chart.Axes
if axes == nil {
// nolint: exhaustivestruct
axes = &view.ChartAxes{}
}

Expand All @@ -85,7 +81,6 @@ func (req *JSONCreateChartRequest) SetLinearLeftAxis() *JSONCreateChartRequest {
func (req *JSONCreateChartRequest) SetLeftAxisLabel() *JSONCreateChartRequest {
axes := req.Chart.Axes
if axes == nil {
// nolint: exhaustivestruct
axes = &view.ChartAxes{}
}

Expand Down
2 changes: 0 additions & 2 deletions internal/testutils/rendererserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ func NewTestingChartRendererServer(opts Opts) (*TestingChartRendererServer, erro
}

grpcServer := grpc.NewServer()

// nolint: exhaustivestruct
chartRendererServer := &TestingChartRendererServer{
failMsg: opts.FailMsg,
grpcServer: grpcServer,
Expand Down

0 comments on commit 02c93fa

Please sign in to comment.