Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3-cmds
Commits
6a8197cf
Commit
6a8197cf
authored
Dec 12, 2017
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix some go vet errors
parent
efc9d266
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
10 additions
and
13 deletions
+10
-13
chan.go
chan.go
+0
-2
http/handler.go
http/handler.go
+3
-3
http/responseemitter.go
http/responseemitter.go
+0
-1
legacy_test.go
legacy_test.go
+3
-3
request.go
request.go
+2
-2
response_test.go
response_test.go
+1
-1
responseemitter_test.go
responseemitter_test.go
+1
-1
No files found.
chan.go
View file @
6a8197cf
...
...
@@ -176,8 +176,6 @@ func (re *chanResponseEmitter) Emit(v interface{}) error {
case
<-
re
.
done
:
return
context
.
Canceled
}
return
nil
}
func
(
re
*
chanResponseEmitter
)
SetError
(
v
interface
{},
errType
cmdkit
.
ErrorType
)
{
...
...
http/handler.go
View file @
6a8197cf
...
...
@@ -199,7 +199,7 @@ func (i internalHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
select
{
case
<-
d
.
Done
()
:
case
<-
req
.
Context
()
.
Done
()
:
log
.
Error
(
"waiting for http.Responseemitter to close but then %s"
,
req
.
Context
()
.
Err
())
log
.
Error
f
(
"waiting for http.Responseemitter to close but then %s"
,
req
.
Context
()
.
Err
())
// too late to send an error, just return
}
...
...
@@ -219,7 +219,7 @@ func NewServerConfig() *ServerConfig {
return
cfg
}
func
(
cfg
ServerConfig
)
AllowedOrigins
()
[]
string
{
func
(
cfg
*
ServerConfig
)
AllowedOrigins
()
[]
string
{
cfg
.
cORSOptsRWMutex
.
RLock
()
defer
cfg
.
cORSOptsRWMutex
.
RUnlock
()
return
cfg
.
cORSOpts
.
AllowedOrigins
...
...
@@ -239,7 +239,7 @@ func (cfg *ServerConfig) AppendAllowedOrigins(origins ...string) {
cfg
.
cORSOpts
.
AllowedOrigins
=
append
(
cfg
.
cORSOpts
.
AllowedOrigins
,
origins
...
)
}
func
(
cfg
ServerConfig
)
AllowedMethods
()
[]
string
{
func
(
cfg
*
ServerConfig
)
AllowedMethods
()
[]
string
{
cfg
.
cORSOptsRWMutex
.
RLock
()
defer
cfg
.
cORSOptsRWMutex
.
RUnlock
()
return
[]
string
(
cfg
.
cORSOpts
.
AllowedMethods
)
...
...
http/responseemitter.go
View file @
6a8197cf
...
...
@@ -289,5 +289,4 @@ func flushCopy(w io.Writer, r io.Reader) error {
f
.
Flush
()
}
return
nil
}
legacy_test.go
View file @
6a8197cf
...
...
@@ -114,7 +114,7 @@ func TestOldCommand(t *testing.T) {
}
if
str
!=
expected
{
t
.
Fatal
(
"expected value %#v, got %#v"
,
expected
,
str
)
t
.
Fatal
f
(
"expected value %#v, got %#v"
,
expected
,
str
)
}
}
...
...
@@ -179,11 +179,11 @@ func TestTeeEmitter(t *testing.T) {
}
if
buf1
.
String
()
!=
expect
{
t
.
Fatal
(
"expected %#v, got %#v"
,
expect
,
buf1
.
String
())
t
.
Fatal
f
(
"expected %#v, got %#v"
,
expect
,
buf1
.
String
())
}
if
buf2
.
String
()
!=
expect
{
t
.
Fatal
(
"expected %#v, got %#v"
,
expect
,
buf2
.
String
())
t
.
Fatal
f
(
"expected %#v, got %#v"
,
expect
,
buf2
.
String
())
}
}
...
...
request.go
View file @
6a8197cf
...
...
@@ -119,11 +119,11 @@ func (r *request) Option(name string) *cmdkit.OptionValue {
for
_
,
n
:=
range
option
.
Names
()
{
val
,
found
:=
r
.
options
[
n
]
if
found
{
return
&
cmdkit
.
OptionValue
{
val
,
found
,
option
}
return
&
cmdkit
.
OptionValue
{
Value
:
val
,
ValueFound
:
found
,
Def
:
option
}
}
}
return
&
cmdkit
.
OptionValue
{
option
.
Default
(),
false
,
option
}
return
&
cmdkit
.
OptionValue
{
Value
:
option
.
Default
(),
ValueFound
:
false
,
Def
:
option
}
}
// Options returns a copy of the option map
...
...
response_test.go
View file @
6a8197cf
...
...
@@ -135,7 +135,7 @@ func TestHandleError(t *testing.T) {
go
func
()
{
for
v
,
err
:=
resFwd
.
Next
();
err
!=
io
.
EOF
;
{
t
.
Log
(
"received forwarded value %#v, error %#v"
,
v
,
err
)
t
.
Log
f
(
"received forwarded value %#v, error %#v"
,
v
,
err
)
}
}()
...
...
responseemitter_test.go
View file @
6a8197cf
...
...
@@ -44,6 +44,6 @@ func TestCopy(t *testing.T) {
_
,
err
=
res2
.
Next
()
if
err
!=
io
.
EOF
{
t
.
Fatal
(
"expected EOF but got err=%v"
,
err
)
t
.
Fatal
f
(
"expected EOF but got err=%v"
,
err
)
}
}
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