Skip to content

Commit

Permalink
improve coding style by go-staticcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonTian authored and peze committed Oct 12, 2023
1 parent f5d0fb0 commit e47be80
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 15 deletions.
12 changes: 0 additions & 12 deletions openapi/library_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,9 @@ import (
"github.com/stretchr/testify/assert"

"bytes"
"fmt"
"testing"
)

type reader_test struct {
content string
}

func (r *reader_test) ReadFrom(path string) ([]byte, error) {
if path == "" || r.content == "" {
return nil, fmt.Errorf("Please insert a valid path.")
}
return []byte(r.content), nil
}

func TestLibrary_PrintProducts(t *testing.T) {
w := new(bytes.Buffer)
library := NewLibrary(w, "en")
Expand Down
2 changes: 1 addition & 1 deletion openapi/restful.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
4 changes: 2 additions & 2 deletions openapi/waiter.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
Expand Down Expand Up @@ -104,7 +104,7 @@ func (a *Waiter) CallWith(invoker Invoker) (string, error) {
if v == a.to {
return resp.GetHttpContentString(), nil
}
duration := time.Now().Sub(begin)
duration := time.Since(begin)
if duration > timeout {
return "", fmt.Errorf("wait '%s' to '%s' timeout(%dseconds), last='%s'",
a.expr, a.to, timeout/time.Second, v)
Expand Down

0 comments on commit e47be80

Please sign in to comment.