Describe the bug
Sometimes swag init panics out of the blue, other times generates without error.
To Reproduce
$ make doc
cd srv && swag init -g main.go && cd ..
2018/09/03 15:36:00 Generate swagger docs....
2018/09/03 15:36:00 Generate general API Info
panic: assignment to entry in nil map
goroutine 1 [running]:
github.com/swaggo/swag.(*Operation).ParseParamComment(0xc42045a120, 0xc42002a34a, 0x31, 0xc4204e2b00, 0x7, 0x39)
/Users/lfaoro/go/src/github.com/swaggo/swag/operation.go:150 +0x83e
github.com/swaggo/swag.(*Operation).ParseComment(0xc42045a120, 0xc42002a340, 0x3b, 0xc4204e2b00, 0x0, 0x0)
/Users/lfaoro/go/src/github.com/swaggo/swag/operation.go:69 +0x3b8
github.com/swaggo/swag.(*Parser).ParseRouterAPIInfo(0xc4204cc5c0, 0xc4204e2b00)
/Users/lfaoro/go/src/github.com/swaggo/swag/parser.go:297 +0x17b
github.com/swaggo/swag.(*Parser).ParseAPI(0xc4204cc5c0, 0x14b1da9, 0x2, 0x7ffeefbff7bd, 0x7)
/Users/lfaoro/go/src/github.com/swaggo/swag/parser.go:89 +0x218
github.com/swaggo/swag/gen.(*Gen).Build(0xc420177988, 0x14b1da9, 0x2, 0x7ffeefbff7bd, 0x7, 0x14b52cc, 0xe, 0x14b395b, 0x9, 0x0, ...)
/Users/lfaoro/go/src/github.com/swaggo/swag/gen/gen.go:29 +0x2cc
main.main.func1(0xc4200da2c0, 0xc4204e2100, 0xc4200da2c0)
/Users/lfaoro/go/src/github.com/swaggo/swag/cmd/swag/main.go:33 +0x190
github.com/urfave/cli.HandleAction(0x1419020, 0x14cdec0, 0xc4200da2c0, 0x0, 0xc420084a20)
/Users/lfaoro/go/src/github.com/urfave/cli/app.go:501 +0xc8
github.com/urfave/cli.Command.Run(0x14b23b6, 0x4, 0x0, 0x0, 0xc4203bc0f0, 0x1, 0x1, 0x14b534a, 0xe, 0x0, ...)
/Users/lfaoro/go/src/github.com/urfave/cli/command.go:165 +0x47d
github.com/urfave/cli.(*App).Run(0xc42020a000, 0xc42001e180, 0x4, 0x4, 0x0, 0x0)
/Users/lfaoro/go/src/github.com/urfave/cli/app.go:259 +0x6e8
main.main()
/Users/lfaoro/go/src/github.com/swaggo/swag/cmd/swag/main.go:61 +0x4e2
make: *** [doc] Error 2
# lfaoro @ unidentifiedw in ~/go/src/gitlab.com/lfaoro/datacrib on git:master x [15:36:02] C:2
$ make doc
cd srv && swag init -g main.go && cd ..
2018/09/03 15:36:03 Generate swagger docs....
2018/09/03 15:36:03 Generate general API Info
2018/09/03 15:36:07 Generating mdl.Healthz
2018/09/03 15:36:07 Generating mdl.AccountPayload
2018/09/03 15:36:07 Generating mdl.Account
2018/09/03 15:36:07 create docs.go at docs/docs.go
Expected behavior
Shouldn't panic but display an error
Your swag version
swag version v1.3.2
Additional context
Started doing this behavior after adding this line:
// @Success 201 {object} mdl.Account
type Account struct {
ID uuid.UUID `json:"id" gorm:"primary_key,type:uuid"`
CreatedAt time.Time `json:"created_at,omitempty"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
DeletedAt *time.Time `json:"-" sql:"index"`
IPAddress string `json:"ip_address" valid:"ip"` // this validates ipv4 & ipv6
Status string `json:"status" valid:"in(active|inactive)"`
PaymentStatus string `json:"payment_status,omitempty" valid:"in(paid|unpaid)"`
CreditCard CreditCard `json:"creditcard" valid:""`
Tokens int64 `json:"tokens"`
Balance int64 `json:"balance"`
Mac string `json:"mac,omitempty"`
AccountPayload
}
Describe the bug
Sometimes
swag initpanics out of the blue, other times generates without error.To Reproduce
Expected behavior
Shouldn't panic but display an error
Your swag version
swag version v1.3.2
Additional context
Started doing this behavior after adding this line:
// @Success 201 {object} mdl.Account