File tree 5 files changed +16
-20
lines changed
cmd/sponge/commands/generate
5 files changed +16
-20
lines changed Original file line number Diff line number Diff line change @@ -870,7 +870,7 @@ func adaptPgDsn(dsn string) string {
870
870
871
871
u , err := url .Parse (dsn )
872
872
if err != nil {
873
- panic ( err )
873
+ return dsn
874
874
}
875
875
876
876
if u .RawQuery == "" {
Original file line number Diff line number Diff line change @@ -87,16 +87,16 @@ func HTTPCommand() *cobra.Command {
87
87
return err
88
88
}
89
89
g := & httpGenerator {
90
- moduleName : moduleName ,
91
- serverName : serverName ,
92
- projectName : projectName ,
93
- repoAddr : repoAddr ,
94
- dbDSN : sqlArgs .DBDsn ,
95
- dbDriver : sqlArgs .DBDriver ,
96
- codes : codes ,
97
- outPath : outPath ,
98
- isExtendedAPI : sqlArgs .IsExtendedAPI ,
99
-
90
+ moduleName : moduleName ,
91
+ serverName : serverName ,
92
+ projectName : projectName ,
93
+ repoAddr : repoAddr ,
94
+ dbDSN : sqlArgs .DBDsn ,
95
+ dbDriver : sqlArgs .DBDriver ,
96
+ codes : codes ,
97
+ outPath : outPath ,
98
+ isExtendedAPI : sqlArgs .IsExtendedAPI ,
99
+ isEmbed : sqlArgs . IsEmbed ,
100
100
suitedMonoRepo : suitedMonoRepo ,
101
101
}
102
102
outPath , err = g .generateCode ()
Original file line number Diff line number Diff line change @@ -96,9 +96,9 @@ func WithEnableLog(log *zap.Logger) Option {
96
96
o .enableLog = true
97
97
if log != nil {
98
98
o .log = log
99
- } else {
100
- o .log = zap .NewNop ()
99
+ return
101
100
}
101
+ o .log , _ = zap .NewProduction ()
102
102
}
103
103
}
104
104
Original file line number Diff line number Diff line change @@ -347,18 +347,14 @@ func defaultOptions() *options {
347
347
// WithParams set params
348
348
func WithParams (params map [string ]interface {}) Option {
349
349
return func (o * options ) {
350
- if o .params != nil {
351
- o .params = params
352
- }
350
+ o .params = params
353
351
}
354
352
}
355
353
356
354
// WithHeaders set headers
357
355
func WithHeaders (headers map [string ]string ) Option {
358
356
return func (o * options ) {
359
- if o .headers != nil {
360
- o .headers = headers
361
- }
357
+ o .headers = headers
362
358
}
363
359
}
364
360
Original file line number Diff line number Diff line change @@ -130,7 +130,7 @@ func WithFileName(filename string) FileOption {
130
130
// WithFileMaxSize set maximum file size (MB)
131
131
func WithFileMaxSize (maxSize int ) FileOption {
132
132
return func (f * fileOptions ) {
133
- if f . maxSize > 0 {
133
+ if maxSize > 0 {
134
134
f .maxSize = maxSize
135
135
}
136
136
}
You can’t perform that action at this time.
0 commit comments