forked from argoproj/argo-cd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update golangci-lint (argoproj#8988)
* chore: update golangci-lint Signed-off-by: Michael Crenshaw <[email protected]> Signed-off-by: wojtekidd <[email protected]>
- Loading branch information
1 parent
14e869a
commit 33ade1d
Showing
5 changed files
with
77 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/bin/bash | ||
set -eux -o pipefail | ||
|
||
GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.38.0 | ||
GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.45.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package io | ||
|
||
import ( | ||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
"io" | ||
"testing" | ||
) | ||
|
||
func TestByteReadSeeker_Read(t *testing.T) { | ||
inString := "hello world" | ||
reader := NewByteReadSeeker([]byte(inString)) | ||
var bytes = make([]byte, 11) | ||
n, err := reader.Read(bytes) | ||
require.NoError(t, err) | ||
assert.Equal(t, len(inString), n) | ||
assert.Equal(t, inString, string(bytes)) | ||
_, err = reader.Read(bytes) | ||
assert.ErrorIs(t, err, io.EOF) | ||
} | ||
|
||
func TestByteReadSeeker_Seek_Start(t *testing.T) { | ||
inString := "hello world" | ||
reader := NewByteReadSeeker([]byte(inString)) | ||
offset, err := reader.Seek(6, io.SeekStart) | ||
require.NoError(t, err) | ||
assert.Equal(t, int64(6), offset) | ||
var bytes = make([]byte, 5) | ||
n, err := reader.Read(bytes) | ||
require.NoError(t, err) | ||
assert.Equal(t, 5, n) | ||
assert.Equal(t, "world", string(bytes)) | ||
} | ||
|
||
func TestByteReadSeeker_Seek_Current(t *testing.T) { | ||
inString := "hello world" | ||
reader := NewByteReadSeeker([]byte(inString)) | ||
offset, err := reader.Seek(3, io.SeekCurrent) | ||
require.NoError(t, err) | ||
assert.Equal(t, int64(3), offset) | ||
offset, err = reader.Seek(3, io.SeekCurrent) | ||
require.NoError(t, err) | ||
assert.Equal(t, int64(6), offset) | ||
var bytes = make([]byte, 5) | ||
n, err := reader.Read(bytes) | ||
require.NoError(t, err) | ||
assert.Equal(t, 5, n) | ||
assert.Equal(t, "world", string(bytes)) | ||
} | ||
|
||
func TestByteReadSeeker_Seek_End(t *testing.T) { | ||
inString := "hello world" | ||
reader := NewByteReadSeeker([]byte(inString)) | ||
offset, err := reader.Seek(-5, io.SeekEnd) | ||
require.NoError(t, err) | ||
assert.Equal(t, int64(6), offset) | ||
var bytes = make([]byte, 5) | ||
n, err := reader.Read(bytes) | ||
require.NoError(t, err) | ||
assert.Equal(t, 5, n) | ||
assert.Equal(t, "world", string(bytes)) | ||
} | ||
|
||
func TestByteReadSeeker_Seek_OutOfBounds(t *testing.T) { | ||
inString := "hello world" | ||
reader := NewByteReadSeeker([]byte(inString)) | ||
_, err := reader.Seek(12, io.SeekStart) | ||
assert.Error(t, err) | ||
_, err = reader.Seek(-1, io.SeekStart) | ||
assert.Error(t, err) | ||
} |