Skip to content

Commit 4858a5a

Browse files
committed
build: remove unused variables and add build constraints for go1.10 and go1.11
- Add a build constraint for go1.13 in `gorm/gorm_test.go` - Remove unused variable in `mongo/mongodriver/mongodriver.go` - Remove unused variable in `mongo/mongomgo/mongomgo.go` - Add an empty import in `postgres/postgres.go` - Add a test case in `postgres/postgres_test.go` - Add a build constraint for go1.10 in `session_options_go1.10.go` - Add a build constraint for go1.11 in `session_options_go1.11.go` - Remove unused import in `session_options_go1.11.go` - Add a build constraint for go1.10 in `tester/tester_options_samesite_go1.10.go` - Add a build constraint for go1.11 in `tester/tester_options_samesite_go1.11.go` Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
1 parent 03d5b2c commit 4858a5a

9 files changed

Lines changed: 12 additions & 8 deletions

File tree

gorm/gorm_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build go1.13
12
// +build go1.13
23

34
package gorm

mongo/mongodriver/mongodriver.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ import (
66
"go.mongodb.org/mongo-driver/mongo"
77
)
88

9-
var (
10-
_ sessions.Store = (*store)(nil)
11-
)
9+
var _ sessions.Store = (*store)(nil)
1210

1311
func NewStore(c *mongo.Collection, maxAge int, ensureTTL bool, keyPairs ...[]byte) sessions.Store {
1412
return &store{mongostore.NewMongoStore(c, maxAge, ensureTTL, keyPairs...)}

mongo/mongomgo/mongomgo.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ import (
66
"github.com/kidstuff/mongostore"
77
)
88

9-
var (
10-
_ sessions.Store = (*store)(nil)
11-
)
9+
var _ sessions.Store = (*store)(nil)
1210

1311
func NewStore(c *mgo.Collection, maxAge int, ensureTTL bool, keyPairs ...[]byte) sessions.Store {
1412
return &store{mongostore.NewMongoStore(c, maxAge, ensureTTL, keyPairs...)}

postgres/postgres.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package postgres
22

33
import (
44
"database/sql"
5+
56
"github.com/antonlindstrom/pgstore"
67
"github.com/gin-contrib/sessions"
78
)

postgres/postgres_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ package postgres
22

33
import (
44
"database/sql"
5+
"testing"
6+
57
"github.com/gin-contrib/sessions"
68
"github.com/gin-contrib/sessions/tester"
7-
"testing"
89
)
910

1011
const postgresTestServer = "postgres://testuser:testpw@localhost:5432/testdb?sslmode=disable"

session_options_go1.10.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build !go1.11
12
// +build !go1.11
23

34
package sessions

session_options_go1.11.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
//go:build go1.11
12
// +build go1.11
23

34
package sessions
45

56
import (
6-
gsessions "github.com/gorilla/sessions"
77
"net/http"
8+
9+
gsessions "github.com/gorilla/sessions"
810
)
911

1012
// Options stores configuration for a session or session store.

tester/tester_options_samesite_go1.10.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build !go1.11
12
// +build !go1.11
23

34
package tester

tester/tester_options_samesite_go1.11.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build go1.11
12
// +build go1.11
23

34
package tester

0 commit comments

Comments
 (0)