Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dex
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
dex
Commits
248337b0
Commit
248337b0
authored
Jan 08, 2016
by
Eric Chiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pkg: improve base64 flag error message
Closes #258
parent
d5bdb2e7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
base64.go
pkg/flag/base64.go
+7
-3
No files found.
pkg/flag/base64.go
View file @
248337b0
...
...
@@ -31,7 +31,7 @@ func (f *Base64) Set(s string) error {
}
if
len
(
b
)
!=
f
.
len
{
return
fmt
.
Errorf
(
"expected %d-byte secret
"
,
f
.
len
)
return
fmt
.
Errorf
(
"expected %d-byte secret
, got %d-byte secret"
,
f
.
len
,
len
(
b
)
)
}
f
.
val
=
b
...
...
@@ -62,11 +62,15 @@ func (f *Base64List) Set(ss string) error {
if
ss
==
""
{
return
nil
}
for
i
,
s
:=
range
strings
.
Split
(
ss
,
","
)
{
splits
:=
strings
.
Split
(
ss
,
","
)
for
i
,
s
:=
range
splits
{
b64
:=
NewBase64
(
f
.
len
)
err
:=
b64
.
Set
(
s
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"error decoding string %d: %q"
,
i
,
err
)
if
len
(
splits
)
==
1
{
return
err
}
return
fmt
.
Errorf
(
"error decoding string %d: %v"
,
i
,
err
)
}
f
.
val
=
append
(
f
.
val
,
b64
.
Bytes
())
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment