Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 86e2b55

Browse filesBrowse files
committed
Merge pull request revel#611 from landr0id/fix-vet-problems
Fix "go vet" problems
2 parents f895742 + 761b2ca commit 86e2b55
Copy full SHA for 86e2b55

File tree

Expand file treeCollapse file tree

4 files changed

+25
-11
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+25
-11
lines changed

‎i18n_test.go

Copy file name to clipboardExpand all lines: i18n_test.go
+13-1Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,19 @@ func loadTestI18nConfigWithoutLanguageCookieOption(t *testing.T) {
187187
func buildRequestWithCookie(name, value string) *Request {
188188
httpRequest, _ := http.NewRequest("GET", "/", nil)
189189
request := NewRequest(httpRequest)
190-
request.AddCookie(&http.Cookie{name, value, "", "", time.Now(), "", 0, false, false, "", nil})
190+
request.AddCookie(&http.Cookie{
191+
Name: name,
192+
Value: value,
193+
Path: "",
194+
Domain: "",
195+
Expires: time.Now(),
196+
RawExpires: "",
197+
MaxAge: 0,
198+
Secure: false,
199+
HttpOnly: false,
200+
Raw: "",
201+
Unparsed: nil,
202+
})
191203
return request
192204
}
193205

‎intercept_test.go

Copy file name to clipboardExpand all lines: intercept_test.go
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,6 @@ func testInterceptorController(t *testing.T, appControllerPtr reflect.Value, met
7676
func testInterception(t *testing.T, intc *Interception, arg reflect.Value) {
7777
val := intc.Invoke(arg)
7878
if !val.IsNil() {
79-
t.Errorf("Failed (%s): Expected nil got %s", intc, val)
79+
t.Errorf("Failed (%s): Expected nil got %v", intc, val)
8080
}
8181
}

‎router.go

Copy file name to clipboardExpand all lines: router.go
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ package revel
33
import (
44
"encoding/csv"
55
"fmt"
6-
"github.com/robfig/pathtree"
76
"io"
87
"io/ioutil"
98
"net/http"
109
"net/url"
1110
"path"
1211
"regexp"
1312
"strings"
13+
14+
"github.com/robfig/pathtree"
1415
)
1516

1617
type Route struct {
@@ -269,7 +270,7 @@ func routeError(err error, routesPath, content string, n int) *Error {
269270
if content == "" {
270271
contentBytes, err := ioutil.ReadFile(routesPath)
271272
if err != nil {
272-
ERROR.Println("Failed to read route file %s: %s", routesPath, err)
273+
ERROR.Printf("Failed to read route file %s: %s\n", routesPath, err)
273274
} else {
274275
content = string(contentBytes)
275276
}

‎validators_test.go

Copy file name to clipboardExpand all lines: validators_test.go
+8-7Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ func TestEmail(t *testing.T) {
193193
// unicode char included
194194
validStartingCharacters := strings.Split("!#$%^&*_+1234567890abcdefghijklmnopqrstuvwxyzñ", "")
195195
invalidCharacters := strings.Split(" ()", "")
196+
196197
definiteInvalidDomains := []string{
197198
"", // any empty string (x@)
198199
".com", // only the TLD (x@.com)
@@ -212,20 +213,20 @@ func TestEmail(t *testing.T) {
212213
for _, startingChar := range validStartingCharacters {
213214
currentEmail = fmt.Sprintf("%sñbc+123@do-main.com", startingChar)
214215
if email.IsSatisfied(currentEmail) {
215-
t.Errorf(noErrorsMessage, fmt.Sprintf("email = %s", currentEmail))
216+
t.Errorf(noErrorsMessage, "starting characters", fmt.Sprintf("email = %s", currentEmail))
216217
}
217218

218219
// validation should fail because of multiple @ symbols
219220
currentEmail = fmt.Sprintf("%s@ñbc+123@do-main.com", startingChar)
220221
if email.IsSatisfied(currentEmail) {
221-
t.Errorf(errorsMessage, fmt.Sprintf("email = %s", currentEmail))
222+
t.Errorf(errorsMessage, "starting characters with multiple @ symbols", fmt.Sprintf("email = %s", currentEmail))
222223
}
223224

224225
// should fail simply because of the invalid char
225226
for _, invalidChar := range invalidCharacters {
226227
currentEmail = fmt.Sprintf("%sñbc%s+123@do-main.com", startingChar, invalidChar)
227228
if email.IsSatisfied(currentEmail) {
228-
t.Errorf(errorsMessage, fmt.Sprintf("email = %s", currentEmail))
229+
t.Errorf(errorsMessage, "invalid starting characters", fmt.Sprintf("email = %s", currentEmail))
229230
}
230231
}
231232
}
@@ -234,21 +235,21 @@ func TestEmail(t *testing.T) {
234235
for _, invalidDomain := range definiteInvalidDomains {
235236
currentEmail = fmt.Sprintf("a@%s", invalidDomain)
236237
if email.IsSatisfied(currentEmail) {
237-
t.Errorf(errorsMessage, fmt.Sprintf("email = %s", currentEmail))
238+
t.Errorf(errorsMessage, "invalid domain", fmt.Sprintf("email = %s", currentEmail))
238239
}
239240
}
240241

241242
// should always be satisfied
242243
if !email.IsSatisfied("t0.est+email123@1abc0-def.com") {
243-
t.Errorf(noErrorsMessage, fmt.Sprintf("email = %s", "t0.est+email123@1abc0-def.com"))
244+
t.Errorf(noErrorsMessage, "guarunteed valid email", fmt.Sprintf("email = %s", "t0.est+email123@1abc0-def.com"))
244245
}
245246

246247
// should never be satisfied (this is redundant given the loops above)
247248
if email.IsSatisfied("a@xcom") {
248-
t.Errorf(noErrorsMessage, fmt.Sprintf("email = %s", "a@xcom"))
249+
t.Errorf(noErrorsMessage, "guaranteed invalid email", fmt.Sprintf("email = %s", "a@xcom"))
249250
}
250251
if email.IsSatisfied("a@@x.com") {
251-
t.Errorf(noErrorsMessage, fmt.Sprintf("email = %s", "a@@x.com"))
252+
t.Errorf(noErrorsMessage, "guaranteed invaild email", fmt.Sprintf("email = %s", "a@@x.com"))
252253
}
253254
}
254255
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.