Fix gosmpl linter issues

Signed-off-by: Tyler Reid <tyler.reid@grafana.com>
This commit is contained in:
Tyler Reid 2021-06-15 19:07:19 -05:00
parent 889fa96439
commit c48b54bdf8
2 changed files with 5 additions and 5 deletions

View File

@ -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
}

View File

@ -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)
}