diff --git a/cmd/iam-apiserver/apiserver.go b/cmd/iam-apiserver/apiserver.go index c6e3da60..73803ec0 100644 --- a/cmd/iam-apiserver/apiserver.go +++ b/cmd/iam-apiserver/apiserver.go @@ -7,10 +7,11 @@ package main import ( - _ "go.uber.org/automaxprocs" "math/rand" "time" + _ "go.uber.org/automaxprocs" + "github.com/marmotedu/iam/internal/apiserver" ) diff --git a/cmd/iam-authz-server/authzserver.go b/cmd/iam-authz-server/authzserver.go index 91a8f40d..5188278f 100644 --- a/cmd/iam-authz-server/authzserver.go +++ b/cmd/iam-authz-server/authzserver.go @@ -7,10 +7,12 @@ package main import ( - "github.com/marmotedu/iam/internal/authzserver" - _ "go.uber.org/automaxprocs" "math/rand" "time" + + _ "go.uber.org/automaxprocs" + + "github.com/marmotedu/iam/internal/authzserver" ) func main() { diff --git a/cmd/iam-pump/pump.go b/cmd/iam-pump/pump.go index 50134db9..a8a9885c 100644 --- a/cmd/iam-pump/pump.go +++ b/cmd/iam-pump/pump.go @@ -7,10 +7,11 @@ package main import ( - _ "go.uber.org/automaxprocs" "math/rand" "time" + _ "go.uber.org/automaxprocs" + "github.com/marmotedu/iam/internal/pump" ) diff --git a/cmd/iam-watcher/watcher.go b/cmd/iam-watcher/watcher.go index ad718252..f8c77bb2 100644 --- a/cmd/iam-watcher/watcher.go +++ b/cmd/iam-watcher/watcher.go @@ -7,10 +7,11 @@ package main import ( - _ "go.uber.org/automaxprocs" "math/rand" "time" + _ "go.uber.org/automaxprocs" + "github.com/marmotedu/iam/internal/watcher" ) diff --git a/internal/apiserver/service/v1/user.go b/internal/apiserver/service/v1/user.go index b0ffd45e..35e87114 100644 --- a/internal/apiserver/service/v1/user.go +++ b/internal/apiserver/service/v1/user.go @@ -50,7 +50,7 @@ func (u *userService) List(ctx context.Context, opts metav1.ListOptions) (*v1.Us } wg := sync.WaitGroup{} - errChan := make(chan error, 1) + errChan := make(chan error, len(users.Items)) finished := make(chan bool, 1) var m sync.Map diff --git a/internal/apiserver/store/mysql/mysql.go b/internal/apiserver/store/mysql/mysql.go index 0e3d0ca1..ef915647 100644 --- a/internal/apiserver/store/mysql/mysql.go +++ b/internal/apiserver/store/mysql/mysql.go @@ -93,7 +93,7 @@ func GetMySQLFactoryOr(opts *genericoptions.MySQLOptions) (store.Factory, error) } // cleanDatabase tear downs the database tables. -// nolint:unused // may be reused in the feature, or just show a migrate usage. +//nolint:unused // may be reused in the feature, or just show a migrate usage. func cleanDatabase(db *gorm.DB) error { if err := db.Migrator().DropTable(&v1.User{}); err != nil { return errors.Wrap(err, "drop user table failed") @@ -110,7 +110,7 @@ func cleanDatabase(db *gorm.DB) error { // migrateDatabase run auto migration for given models, will only add missing fields, // won't delete/change current data. -// nolint:unused // may be reused in the feature, or just show a migrate usage. +//nolint:unused // may be reused in the feature, or just show a migrate usage. func migrateDatabase(db *gorm.DB) error { if err := db.AutoMigrate(&v1.User{}); err != nil { return errors.Wrap(err, "migrate user model failed") @@ -126,7 +126,7 @@ func migrateDatabase(db *gorm.DB) error { } // resetDatabase resets the database tables. -// nolint:unused,deadcode // may be reused in the feature, or just show a migrate usage. +//nolint:unused,deadcode // may be reused in the feature, or just show a migrate usage. func resetDatabase(db *gorm.DB) error { if err := cleanDatabase(db); err != nil { return err diff --git a/internal/pkg/code/code.go b/internal/pkg/code/code.go index 39b46190..701447eb 100644 --- a/internal/pkg/code/code.go +++ b/internal/pkg/code/code.go @@ -54,7 +54,7 @@ func (coder ErrCode) HTTPStatus() int { return coder.HTTP } -// nolint: unparam +//nolint: unparam func register(code int, httpStatus int, message string, refs ...string) { found, _ := gubrak.Includes([]int{200, 400, 401, 403, 404, 500}, httpStatus) if !found { diff --git a/internal/pkg/code/code_generated.go b/internal/pkg/code/code_generated.go index 45d042ca..a79aa8a1 100644 --- a/internal/pkg/code/code_generated.go +++ b/internal/pkg/code/code_generated.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a MIT style // license that can be found in the LICENSE file. -// Code generated by "codegen -type=int /home/colin/workspace/golang/src/github.com/marmotedu/iam/internal/pkg/code"; DO NOT EDIT. +// Code generated by "codegen -type=int /home/cyb/project/iam/internal/pkg/code"; DO NOT EDIT. package code diff --git a/internal/pkg/logger/sql.go b/internal/pkg/logger/sql.go index 027b7f88..43550e8f 100644 --- a/internal/pkg/logger/sql.go +++ b/internal/pkg/logger/sql.go @@ -33,7 +33,7 @@ const NULL = "NULL" var convertableTypes = []reflect.Type{reflect.TypeOf(time.Time{}), reflect.TypeOf(false), reflect.TypeOf([]byte{})} // ExplainSQL explain a SQL. -// nolint: gocognit,gocyclo +//nolint: gocognit,gocyclo func ExplainSQL(sql string, numericPlaceholder *regexp.Regexp, escaper string, avars ...interface{}) string { var convertParams func(interface{}, int) vars := make([]string, len(avars)) diff --git a/internal/pump/analytics/analytics_options.go b/internal/pump/analytics/analytics_options.go index a68bbb19..5e280afe 100644 --- a/internal/pump/analytics/analytics_options.go +++ b/internal/pump/analytics/analytics_options.go @@ -45,5 +45,4 @@ func (o *AnalyticsOptions) AddFlags(fs *pflag.FlagSet) { fs.BoolVar(&o.EnableDetailedRecording, "analytics.enable-detailed-recording", o.EnableDetailedRecording, "Set enable detailed recording") - } diff --git a/internal/pump/pumps/init.go b/internal/pump/pumps/init.go index 7e14964a..39fd2340 100644 --- a/internal/pump/pumps/init.go +++ b/internal/pump/pumps/init.go @@ -6,7 +6,7 @@ package pumps var availablePumps map[string]Pump -// nolint: gochecknoinits +//nolint: gochecknoinits func init() { availablePumps = make(map[string]Pump) diff --git a/internal/pump/pumps/kafka.go b/internal/pump/pumps/kafka.go index 15d334f5..ab2c2dda 100644 --- a/internal/pump/pumps/kafka.go +++ b/internal/pump/pumps/kafka.go @@ -72,7 +72,7 @@ func (k *KafkaPump) Init(config interface{}) error { } var tlsConfig *tls.Config - // nolint: nestif + //nolint: nestif if k.kafkaConf.UseSSL { if k.kafkaConf.SSLCertFile != "" && k.kafkaConf.SSLKeyFile != "" { var cert tls.Certificate diff --git a/internal/pump/pumps/mongo.go b/internal/pump/pumps/mongo.go index 558a2af6..a6c6e07e 100644 --- a/internal/pump/pumps/mongo.go +++ b/internal/pump/pumps/mongo.go @@ -143,13 +143,13 @@ func mongoType(session *mgo.Session) MongoType { return StandardMongo } -// nolint: gocognit +//nolint: gocognit func mongoDialInfo(conf BaseMongoConf) (dialInfo *mgo.DialInfo, err error) { if dialInfo, err = mgo.ParseURL(conf.MongoURL); err != nil { return dialInfo, errors.Wrap(err, "failed to parse mongo url") } - // nolint: nestif + //nolint: nestif if conf.MongoUseSSL { dialInfo.DialServer = func(addr *mgo.ServerAddr) (net.Conn, error) { tlsConfig := &tls.Config{} diff --git a/internal/pump/server.go b/internal/pump/server.go index 2b26dea0..ebb2287e 100644 --- a/internal/pump/server.go +++ b/internal/pump/server.go @@ -176,7 +176,7 @@ func filterData(pump pumps.Pump, keys []interface{}) []interface{} { if !filters.HasFilter() && !pump.GetOmitDetailedRecording() { return keys } - filteredKeys := keys[:] // nolint: gocritic + filteredKeys := keys[:] //nolint: gocritic newLenght := 0 for _, key := range filteredKeys { diff --git a/internal/watcher/watcher/all/all.go b/internal/watcher/watcher/all/all.go index 02c29d2f..8086c74a 100644 --- a/internal/watcher/watcher/all/all.go +++ b/internal/watcher/watcher/all/all.go @@ -4,7 +4,7 @@ package all -// nolint: golint +//nolint: golint import ( _ "github.com/marmotedu/iam/internal/watcher/watcher/clean" _ "github.com/marmotedu/iam/internal/watcher/watcher/task" diff --git a/pkg/storage/redis_cluster.go b/pkg/storage/redis_cluster.go index 83a25de9..7ccffd57 100644 --- a/pkg/storage/redis_cluster.go +++ b/pkg/storage/redis_cluster.go @@ -94,7 +94,7 @@ func singleton(cache bool) redis.UniversalClient { return nil } -// nolint: unparam +//nolint: unparam func connectSingleton(cache bool, config *Config) bool { if singleton(cache) == nil { log.Debug("Connecting to redis cluster") diff --git a/tools/codegen/codegen.go b/tools/codegen/codegen.go index e91fcc93..2cb3a62d 100644 --- a/tools/codegen/codegen.go +++ b/tools/codegen/codegen.go @@ -198,7 +198,7 @@ type Package struct { // parsePackage exits if there is an error. func (g *Generator) parsePackage(patterns []string, tags []string) { cfg := &packages.Config{ - // nolint: staticcheck + //nolint: staticcheck Mode: packages.LoadSyntax, // TODO: Need to think about constants in test files. Maybe write type_string_test.go // in a separate pass? For later. @@ -340,7 +340,7 @@ func (v *Value) ParseComment() (string, string) { return groups[1], groups[2] } -// nolint: gocognit +//nolint: gocognit // genDecl processes one declaration clause. func (f *File) genDecl(node ast.Node) bool { decl, ok := node.(*ast.GenDecl)