Skip to content

Commit

Permalink
replace the use of goto with a fallthrough instead
Browse files Browse the repository at this point in the history
  • Loading branch information
jmoiron committed Apr 14, 2013
1 parent f962e33 commit a92a00a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions sqlx.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,11 +378,10 @@ var fieldmapCache = map[reflect.Type]fieldmap{}
// Return the underlying slice's type, or an error if the type is
// not a slice or a pointer to a slice.
func baseSliceType(t reflect.Type) (reflect.Type, error) {
check:
switch t.Kind() {
case reflect.Ptr:
t = t.Elem()
goto check
fallthrough
case reflect.Slice:
default:
return nil, errors.New("Destination must be a slice.")
Expand All @@ -393,11 +392,10 @@ check:
// Return a reflect.Type's base struct type, or an error if it is not a struct
// or pointer to a struct.
func baseStructType(t reflect.Type) (reflect.Type, error) {
check:
switch t.Kind() {
case reflect.Ptr:
t = t.Elem()
goto check
fallthrough
case reflect.Struct:
default:
return nil, errors.New("Destination must be a struct type.")
Expand Down
2 changes: 1 addition & 1 deletion sqlx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ func init() {
}

func PostgresConnect() {
var username string
defer func() {
if r := recover(); r != nil {
fmt.Printf("Could not connect to postgres db, try `createdb sqlxtest`, disabling PG tests:\n %v", r)
TestPostgres = false
}
}()
var username string
u, err := user.Current()
if err != nil {
fmt.Printf("Could not find current user username, trying 'test' instead.")
Expand Down

0 comments on commit a92a00a

Please sign in to comment.