Skip to content

Commit 405e748

Browse files
committed
Appease the linter
1 parent fcdadc4 commit 405e748

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

transform/encode.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func EncodeBase64URL(s string) string {
4444
return base64.URLEncoding.EncodeToString([]byte(s))
4545
}
4646

47-
// DecodeBase64 decodes base64 with standard encoding
47+
// DecodeBase64 decodes base64 with standard encoding.
4848
func DecodeBase64(s string) string {
4949
decoded, err := base64.StdEncoding.DecodeString(s)
5050
if err != nil {

transform/encode_test.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ import (
44
"testing"
55
)
66

7+
const (
8+
urlTestString = "Theskyabovetheportwasthecoloroftelevision,tunedtoadeadchannel.\xff\xff\xff\x3e\xfe\x00"
9+
)
10+
711
func TestURLEncodeString(t *testing.T) {
812
encoded := URLEncodeString("foo !~")
913

@@ -25,7 +29,7 @@ func TestEncodeBase64(t *testing.T) {
2529
}
2630

2731
func TestEncodeBase64URL(t *testing.T) {
28-
encoded := EncodeBase64URL("Theskyabovetheportwasthecoloroftelevision,tunedtoadeadchannel.\xff\xff\xff\x3e\xfe\x00")
32+
encoded := EncodeBase64URL(urlTestString)
2933

3034
if encoded != "VGhlc2t5YWJvdmV0aGVwb3J0d2FzdGhlY29sb3JvZnRlbGV2aXNpb24sdHVuZWR0b2FkZWFkY2hhbm5lbC7___8-_gA=" {
3135
t.Fatal(encoded)
@@ -37,7 +41,7 @@ func TestEncodeBase64URL(t *testing.T) {
3741
func TestDecodeBase64URL(t *testing.T) {
3842
decoded := DecodeBase64URL("VGhlc2t5YWJvdmV0aGVwb3J0d2FzdGhlY29sb3JvZnRlbGV2aXNpb24sdHVuZWR0b2FkZWFkY2hhbm5lbC7___8-_gA=")
3943

40-
if decoded != "Theskyabovetheportwasthecoloroftelevision,tunedtoadeadchannel.\xff\xff\xff\x3e\xfe\x00" {
44+
if decoded != urlTestString {
4145
t.Fatal(decoded)
4246
}
4347

@@ -47,7 +51,7 @@ func TestDecodeBase64URL(t *testing.T) {
4751
func TestDecodeBase64URL_NoPad(t *testing.T) {
4852
decoded := DecodeBase64URL("VGhlc2t5YWJvdmV0aGVwb3J0d2FzdGhlY29sb3JvZnRlbGV2aXNpb24sdHVuZWR0b2FkZWFkY2hhbm5lbC7___8-_gA")
4953

50-
if decoded != "Theskyabovetheportwasthecoloroftelevision,tunedtoadeadchannel.\xff\xff\xff\x3e\xfe\x00" {
54+
if decoded != urlTestString {
5155
t.Fatal(decoded)
5256
}
5357

@@ -57,7 +61,7 @@ func TestDecodeBase64URL_NoPad(t *testing.T) {
5761
func TestDecodeBase64URL_WayTooMuchPadding(t *testing.T) {
5862
decoded := DecodeBase64URL("VGhlc2t5YWJvdmV0aGVwb3J0d2FzdGhlY29sb3JvZnRlbGV2aXNpb24sdHVuZWR0b2FkZWFkY2hhbm5lbC7___8-_gA=======")
5963

60-
if decoded != "Theskyabovetheportwasthecoloroftelevision,tunedtoadeadchannel.\xff\xff\xff\x3e\xfe\x00" {
64+
if decoded != urlTestString {
6165
t.Fatal(decoded)
6266
}
6367

0 commit comments

Comments
 (0)