Fix gosmpl linter issues
Signed-off-by: Tyler Reid <tyler.reid@grafana.com>
This commit is contained in:
parent
889fa96439
commit
c48b54bdf8
|
@ -187,8 +187,8 @@ func checkTopicFifoAttribute(client *sns.SNS, topicARN string) (bool, error) {
|
|||
func validateAndTruncateMessage(message string) (string, bool, error) {
|
||||
if utf8.ValidString(message) {
|
||||
// if the message is larger than 256KB we have to truncate.
|
||||
if len(message) > 256*1024 {
|
||||
truncated := make([]byte, 256*1024, 256*1024)
|
||||
if len(message) > 256 * 1024 {
|
||||
truncated := make([]byte, 256 * 1024, 256 * 1024)
|
||||
copy(truncated, message)
|
||||
return string(truncated), true, nil
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ import (
|
|||
)
|
||||
|
||||
func TestValidateAndTruncateMessage(t *testing.T) {
|
||||
sBuff := make([]byte, 257*1024, 257*1024)
|
||||
sBuff := make([]byte, 257 * 1024)
|
||||
for i := range sBuff {
|
||||
sBuff[i] = byte(33)
|
||||
}
|
||||
|
@ -28,9 +28,9 @@ func TestValidateAndTruncateMessage(t *testing.T) {
|
|||
require.True(t, isTruncated)
|
||||
require.NoError(t, err)
|
||||
require.NotEqual(t, sBuff, truncatedMessage)
|
||||
require.Equal(t, len(truncatedMessage), 256*1024)
|
||||
require.Equal(t, len(truncatedMessage), 256 * 1024)
|
||||
|
||||
sBuff = make([]byte, 100, 100)
|
||||
sBuff = make([]byte, 100)
|
||||
for i := range sBuff {
|
||||
sBuff[i] = byte(33)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue