Unverified Commit cc4dd725 authored by Steven Allen's avatar Steven Allen Committed by GitHub

Merge pull request #41 from ipfs/fix/go-vet

fix some go vet errors
parents 2b5e4a02 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) {
......
......@@ -201,7 +201,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.Errorf("waiting for http.Responseemitter to close but then %s", req.Context().Err())
// too late to send an error, just return
}
......@@ -221,7 +221,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
......@@ -241,7 +241,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)
......
......@@ -289,5 +289,4 @@ func flushCopy(w io.Writer, r io.Reader) error {
f.Flush()
}
return nil
}
......@@ -114,7 +114,7 @@ func TestOldCommand(t *testing.T) {
}
if str != expected {
t.Fatal("expected value %#v, got %#v", expected, str)
t.Fatalf("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.Fatalf("expected %#v, got %#v", expect, buf1.String())
}
if buf2.String() != expect {
t.Fatal("expected %#v, got %#v", expect, buf2.String())
t.Fatalf("expected %#v, got %#v", expect, buf2.String())
}
}
......
......@@ -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
......
......@@ -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.Logf("received forwarded value %#v, error %#v", v, err)
}
}()
......
......@@ -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.Fatalf("expected EOF but got err=%v", err)
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment