Skip to content

Commit

Permalink
fix: apply suggestion
Browse files Browse the repository at this point in the history
Signed-off-by: hlts2 <[email protected]>
  • Loading branch information
hlts2 committed Aug 27, 2020
1 parent c883f81 commit 1ebd8cd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions internal/compress/gob.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ type gobReader struct {
// Read returns the number of bytes for read p (0 <= n <= len(p)).
// If any errors occurs, it will return an error.
func (gr *gobReader) Read(p []byte) (n int, err error) {
err = gr.decoder.Decode(&p)
if err != nil {
if err = gr.decoder.Decode(&p); err != nil {
return 0, err
}

Expand All @@ -113,8 +112,7 @@ type gobWriter struct {
// write returns the number of bytes written from p (0 <= n <= len(p)).
// if any errors occurs, it will return an error.
func (gw *gobWriter) Write(p []byte) (n int, err error) {
err = gw.encoder.Encode(&p)
if err != nil {
if err = gw.encoder.Encode(&p); err != nil {
return 0, err
}

Expand Down
2 changes: 1 addition & 1 deletion internal/compress/gob_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func TestNewGob(t *testing.T) {
},

{
name: "returns (nil, error) when option apply fails",
name: "returns (nil, error) when option is not nil and option apply fails",
args: args{
opts: []GobOption{
func(c *gobCompressor) error {
Expand Down

0 comments on commit 1ebd8cd

Please sign in to comment.