Skip to content

Commit

Permalink
test: re-enable staticcheck linter
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikołaj Świątek committed Sep 1, 2022
1 parent 307b0be commit 8ad5adc
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 16 deletions.
1 change: 1 addition & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ linters:
- typecheck
- unused
- gosimple
- staticcheck

issues:
# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
Expand Down
4 changes: 2 additions & 2 deletions pkg/exporter/sumologicexporter/compress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ func (e mockedEncrypter) Close() error {
return e.closeError
}

func getTestCompressor(w error, c error) compressor {
return compressor{
func getTestCompressor(w error, c error) *compressor {
return &compressor{
format: GZIPCompression,
writer: mockedEncrypter{
writeError: w,
Expand Down
10 changes: 5 additions & 5 deletions pkg/exporter/sumologicexporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func initExporter(cfg *Config, createSettings component.ExporterCreateSettings)
if err != nil {
return fmt.Errorf("failed to initialize compressor: %w", err)
}
return c
return &c
},
},
// NOTE: client is now set in start()
Expand Down Expand Up @@ -408,14 +408,14 @@ func (se *sumologicexporter) pushTracesData(ctx context.Context, td ptrace.Trace
return err
}

func (se *sumologicexporter) getCompressor() (compressor, error) {
func (se *sumologicexporter) getCompressor() (*compressor, error) {
switch c := se.compressorPool.Get().(type) {
case error:
return compressor{}, fmt.Errorf("%v", c)
case compressor:
return &compressor{}, fmt.Errorf("%v", c)
case *compressor:
return c, nil
default:
return compressor{}, fmt.Errorf("unknown compressor type: %T", c)
return &compressor{}, fmt.Errorf("unknown compressor type: %T", c)
}
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/exporter/sumologicexporter/sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ type sender struct {
config *Config
client *http.Client
sources sourceFormats
compressor compressor
compressor *compressor
prometheusFormatter prometheusFormatter
jsonLogsConfig JSONLogs
dataUrlMetrics string
Expand Down Expand Up @@ -165,7 +165,7 @@ func newSender(
cfg *Config,
cl *http.Client,
s sourceFormats,
c compressor,
c *compressor,
pf prometheusFormatter,
metricsUrl string,
logsUrl string,
Expand Down
8 changes: 4 additions & 4 deletions pkg/exporter/sumologicexporter/sender_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func prepareSenderTest(t *testing.T, cb []func(w http.ResponseWriter, req *http.
category: getTestSourceFormat(t, "source_category"),
name: getTestSourceFormat(t, "source_name"),
},
c,
&c,
pf,
"",
"",
Expand Down Expand Up @@ -154,7 +154,7 @@ func prepareOTLPSenderTest(t *testing.T, cb []func(w http.ResponseWriter, req *h
category: getTestSourceFormat(t, "source_category"),
name: getTestSourceFormat(t, "source_name"),
},
c,
&c,
pf,
testServer.URL,
testServer.URL,
Expand Down Expand Up @@ -1377,7 +1377,7 @@ func TestSendCompressGzip(t *testing.T) {
c, err := newCompressor("gzip")
require.NoError(t, err)

test.s.compressor = c
test.s.compressor = &c
reader := newCountingReader(0).withString("Some example log")

err = test.s.send(context.Background(), LogsPipeline, reader, fields{})
Expand Down Expand Up @@ -1405,7 +1405,7 @@ func TestSendCompressDeflate(t *testing.T) {
c, err := newCompressor("deflate")
require.NoError(t, err)

test.s.compressor = c
test.s.compressor = &c
reader := newCountingReader(0).withString("Some example log")

err = test.s.send(context.Background(), LogsPipeline, reader, fields{})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package credentials
import (
"encoding/json"
"fmt"
"io/ioutil"
"io"
"os"
"path"

Expand Down Expand Up @@ -123,7 +123,7 @@ func (cr LocalFsStore) Get(key string) (CollectorCredentials, error) {
}
defer creds.Close()

encryptedCreds, err := ioutil.ReadAll(creds)
encryptedCreds, err := io.ReadAll(creds)
if err != nil {
return CollectorCredentials{}, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/extension/sumologicextension/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ func (se *SumologicExtension) getHTTPClient(
httpClientSettings confighttp.HTTPClientSettings,
regInfo api.OpenRegisterResponsePayload,
) (*http.Client, error) {
httpClient, err := httpClientSettings.ToClientWithHost(
httpClient, err := httpClientSettings.ToClient(
se.host,
component.TelemetrySettings{},
)
Expand Down

0 comments on commit 8ad5adc

Please sign in to comment.