Skip to content

Commit

Permalink
Reducing scope of PR
Browse files Browse the repository at this point in the history
  • Loading branch information
MovieStoreGuy committed Sep 26, 2024
1 parent 414407f commit 5b87781
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 16 deletions.
12 changes: 10 additions & 2 deletions config/confighttp/compression.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ var availableDecoders = map[string]func(body io.ReadCloser) (io.ReadCloser, erro
return nil, nil
},
"gzip": func(body io.ReadCloser) (io.ReadCloser, error) {
return gzip.NewReader(body)
gr, err := gzip.NewReader(body)
if err != nil {
return nil, err
}
return gr, nil
},
"zstd": func(body io.ReadCloser) (io.ReadCloser, error) {
zr, err := zstd.NewReader(
Expand All @@ -49,7 +53,11 @@ var availableDecoders = map[string]func(body io.ReadCloser) (io.ReadCloser, erro
return zr.IOReadCloser(), nil
},
"zlib": func(body io.ReadCloser) (io.ReadCloser, error) {
return zlib.NewReader(body)
zr, err := zlib.NewReader(body)
if err != nil {
return nil, err
}
return zr, nil
},
//nolint:unparam // Ignoring the linter request to remove error return since it needs to match the method signature
"snappy": func(body io.ReadCloser) (io.ReadCloser, error) {
Expand Down
2 changes: 1 addition & 1 deletion config/confighttp/compression_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ func TestHTTPContentDecompressionHandler(t *testing.T) {
encoding: "snappy",
reqBody: bytes.NewBuffer(testBody),
respCode: http.StatusBadRequest,
respBody: "snappy: corrupt input",
respBody: "snappy: corrupt input\n",
},
{
name: "UnsupportedCompression",
Expand Down
4 changes: 2 additions & 2 deletions config/confighttp/compressor.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"bytes"
"compress/gzip"
"compress/zlib"
"fmt"
"errors"
"io"
"sync"

Expand Down Expand Up @@ -61,7 +61,7 @@ func newCompressor(compressionType configcompression.Type) (*compressor, error)
case configcompression.TypeLz4:
return lz4Pool, nil
}
return nil, fmt.Errorf("unsupported compression type %q", compressionType)
return nil, errors.New("unsupported compression type, ")
}

func (p *compressor) compress(buf *bytes.Buffer, body io.ReadCloser) error {
Expand Down
2 changes: 0 additions & 2 deletions config/confighttp/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion exporter/otlphttpexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ require (
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pierrec/lz4/v4 v4.1.21 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rs/cors v1.11.1 // indirect
Expand Down
2 changes: 0 additions & 2 deletions exporter/otlphttpexporter/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion extension/zpagesextension/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ require (
github.com/knadh/koanf/v2 v2.1.1 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pierrec/lz4/v4 v4.1.21 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rs/cors v1.11.1 // indirect
Expand Down
2 changes: 0 additions & 2 deletions extension/zpagesextension/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion receiver/otlpreceiver/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/mostynb/go-grpc-compression v1.2.3 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pierrec/lz4/v4 v4.1.21 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rs/cors v1.11.1 // indirect
Expand Down
2 changes: 0 additions & 2 deletions receiver/otlpreceiver/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5b87781

Please sign in to comment.