From 73abf2e3537c93998c289f8b4699b57b0040b6b6 Mon Sep 17 00:00:00 2001 From: sredny buitrago Date: Wed, 20 Mar 2024 18:21:02 -0300 Subject: [PATCH 01/16] receive by param the number of api keys to generate --- analytics/demo/demo.go | 26 +++++++++++------------ main.go | 5 +++-- pumps/csv_test.go | 2 +- pumps/mongo_aggregate_test.go | 2 +- serializer/serializer_test.go | 40 +++++++++++++++++------------------ 5 files changed, 38 insertions(+), 37 deletions(-) diff --git a/analytics/demo/demo.go b/analytics/demo/demo.go index bef7cc91c..03b7cf240 100644 --- a/analytics/demo/demo.go +++ b/analytics/demo/demo.go @@ -19,9 +19,9 @@ var ( log = logger.GetLogger() ) -func DemoInit(orgId, apiId, version string) { +func DemoInit(orgId, apiId, version string, apikeysCount int) { apiID = apiId - GenerateAPIKeys(orgId) + GenerateAPIKeys(orgId, apikeysCount) apiVersion = version if version == "" { apiVersion = "Default" @@ -120,8 +120,8 @@ func responseCode() int { return codes[rand.Intn(len(codes))] } -func GenerateAPIKeys(orgId string) { - set := make([]string, 50) +func GenerateAPIKeys(orgId string, apikeysQuantity int) { + set := make([]string, apikeysQuantity) for i := 0; i < len(set); i++ { set[i] = generateAPIKey(orgId) } @@ -137,9 +137,9 @@ func generateAPIKey(orgId string) string { return orgId + id } -func getRandomKey(orgId string) string { +func getRandomKey(orgId string, apiKeysCount int) string { if len(apiKeys) == 0 { - GenerateAPIKeys(orgId) + GenerateAPIKeys(orgId, apiKeysCount) } return apiKeys[rand.Intn(len(apiKeys))] } @@ -153,7 +153,7 @@ func country() string { return codes[rand.Intn(len(codes))] } -func GenerateDemoData(days, recordsPerHour int, orgID string, demoFutureData, trackPath bool, writer func([]interface{}, *health.Job, time.Time, int)) { +func GenerateDemoData(days, recordsPerHour int, orgID string, demoFutureData, trackPath bool, apiKeysCount int, writer func([]interface{}, *health.Job, time.Time, int)) { t := time.Now() start := time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, time.UTC) count := 0 @@ -161,7 +161,7 @@ func GenerateDemoData(days, recordsPerHour int, orgID string, demoFutureData, tr if demoFutureData { for d := 0; d < days; d++ { for h := 0; h < 24; h++ { - WriteDemoData(start, d, h, recordsPerHour, orgID, trackPath, writer) + WriteDemoData(start, d, h, recordsPerHour, orgID, trackPath, apiKeysCount, writer) } count++ log.Infof("Finished %d of %d\n", count, days) @@ -172,14 +172,14 @@ func GenerateDemoData(days, recordsPerHour int, orgID string, demoFutureData, tr // Otherwise, we want to start at the (current date - X days) and create data until yesterday's date for d := days; d > 0; d-- { for h := 0; h < 24; h++ { - WriteDemoData(start, -d, h, recordsPerHour, orgID, trackPath, writer) + WriteDemoData(start, -d, h, recordsPerHour, orgID, trackPath, apiKeysCount, writer) } count++ log.Infof("Finished %d of %d\n", count, days) } } -func WriteDemoData(start time.Time, d, h, recordsPerHour int, orgID string, trackPath bool, writer func([]interface{}, *health.Job, time.Time, int)) { +func WriteDemoData(start time.Time, d, h, recordsPerHour int, orgID string, trackPath bool, apikeysCount int, writer func([]interface{}, *health.Job, time.Time, int)) { set := []interface{}{} ts := start.AddDate(0, 0, d) ts = ts.Add(time.Duration(h) * time.Hour) @@ -193,7 +193,7 @@ func WriteDemoData(start time.Time, d, h, recordsPerHour int, orgID string, trac timeDifference := 3600 / volume // this is the difference in seconds between each record nextTimestamp := ts // this is the timestamp of the next record for i := 0; i < volume; i++ { - r := GenerateRandomAnalyticRecord(orgID, trackPath) + r := GenerateRandomAnalyticRecord(orgID, trackPath, apikeysCount) r.Day = nextTimestamp.Day() r.Month = nextTimestamp.Month() r.Year = nextTimestamp.Year() @@ -207,7 +207,7 @@ func WriteDemoData(start time.Time, d, h, recordsPerHour int, orgID string, trac writer(set, nil, time.Now(), 10) } -func GenerateRandomAnalyticRecord(orgID string, trackPath bool) analytics.AnalyticsRecord { +func GenerateRandomAnalyticRecord(orgID string, trackPath bool, apiKeysCount int) analytics.AnalyticsRecord { p := randomPath() api, apiID := randomAPI() ts := time.Now() @@ -222,7 +222,7 @@ func GenerateRandomAnalyticRecord(orgID string, trackPath bool) analytics.Analyt Year: ts.Year(), Hour: ts.Hour(), ResponseCode: responseCode(), - APIKey: getRandomKey(orgID), + APIKey: getRandomKey(orgID, apiKeysCount), TimeStamp: ts, APIVersion: apiVersion, APIName: api, diff --git a/main.go b/main.go index 2dcd1ea5c..483d2eeb0 100644 --- a/main.go +++ b/main.go @@ -47,6 +47,7 @@ var ( demoDays = kingpin.Flag("demo-days", "flag that determines the number of days for the analytics records").Default("30").Int() demoRecordsPerHour = kingpin.Flag("demo-records-per-hour", "flag that determines the number of records per hour for the analytics records").Default("0").Int() demoFutureData = kingpin.Flag("demo-future-data", "flag that determines if the demo data should be in the future").Default("false").Bool() + demoApiKeysCount = kingpin.Flag("demo-apikeys-count", "flag that determines the quantity of apikeys to generate in demo mode").Default("50").Int() debugMode = kingpin.Flag("debug", "enable debug mode").Bool() //lint:ignore U1000 Function is used when version flag is passed in command line version = kingpin.Version(pumps.Version) @@ -483,8 +484,8 @@ func main() { if *demoMode != "" { log.Info("BUILDING DEMO DATA AND EXITING...") log.Warning("Starting from date: ", time.Now().AddDate(0, 0, -30)) - demo.DemoInit(*demoMode, *demoApiMode, *demoApiVersionMode) - demo.GenerateDemoData(*demoDays, *demoRecordsPerHour, *demoMode, *demoFutureData, *demoTrackPath, writeToPumps) + demo.DemoInit(*demoMode, *demoApiMode, *demoApiVersionMode, *demoApiKeysCount) + demo.GenerateDemoData(*demoDays, *demoRecordsPerHour, *demoMode, *demoFutureData, *demoTrackPath, *demoApiKeysCount, writeToPumps) return } diff --git a/pumps/csv_test.go b/pumps/csv_test.go index 2fefa5462..be45091c6 100644 --- a/pumps/csv_test.go +++ b/pumps/csv_test.go @@ -201,7 +201,7 @@ func TestCSVPump_WriteData(t *testing.T) { var records []interface{} if !tt.wantErr { for i := 0; i < tt.args.numberOfRecords; i++ { - records = append(records, demo.GenerateRandomAnalyticRecord("orgid", false)) + records = append(records, demo.GenerateRandomAnalyticRecord("orgid", false, 50)) } } else { records = append(records, "invalid record") diff --git a/pumps/mongo_aggregate_test.go b/pumps/mongo_aggregate_test.go index 5a8a726a6..fcb83b704 100644 --- a/pumps/mongo_aggregate_test.go +++ b/pumps/mongo_aggregate_test.go @@ -315,7 +315,7 @@ func TestMongoAggregatePump_SelfHealing(t *testing.T) { var set []interface{} for { count++ - record := demo.GenerateRandomAnalyticRecord("org123", true) + record := demo.GenerateRandomAnalyticRecord("org123", true, 50) set = append(set, record) if count == 1000 { err := pmp1.WriteData(context.TODO(), set) diff --git a/serializer/serializer_test.go b/serializer/serializer_test.go index 5af8b72c8..8880459e4 100644 --- a/serializer/serializer_test.go +++ b/serializer/serializer_test.go @@ -109,16 +109,16 @@ func TestSerializer_GetSuffix(t *testing.T) { func BenchmarkProtobufEncoding(b *testing.B) { serializer := NewAnalyticsSerializer(PROTOBUF_SERIALIZER) records := []analytics.AnalyticsRecord{ - demo.GenerateRandomAnalyticRecord("org_1", true), - demo.GenerateRandomAnalyticRecord("org_1", true), - demo.GenerateRandomAnalyticRecord("org_1", true), - demo.GenerateRandomAnalyticRecord("org_1", true), - demo.GenerateRandomAnalyticRecord("org_1", true), - demo.GenerateRandomAnalyticRecord("org_2", true), - demo.GenerateRandomAnalyticRecord("org_2", true), - demo.GenerateRandomAnalyticRecord("org_2", true), - demo.GenerateRandomAnalyticRecord("org_2", true), - demo.GenerateRandomAnalyticRecord("org_2", true), + demo.GenerateRandomAnalyticRecord("org_1", true, 50), + demo.GenerateRandomAnalyticRecord("org_1", true, 50), + demo.GenerateRandomAnalyticRecord("org_1", true, 50), + demo.GenerateRandomAnalyticRecord("org_1", true, 50), + demo.GenerateRandomAnalyticRecord("org_1", true, 50), + demo.GenerateRandomAnalyticRecord("org_2", true, 50), + demo.GenerateRandomAnalyticRecord("org_2", true, 50), + demo.GenerateRandomAnalyticRecord("org_2", true, 50), + demo.GenerateRandomAnalyticRecord("org_2", true, 50), + demo.GenerateRandomAnalyticRecord("org_2", true, 50), } b.Helper() b.ReportAllocs() @@ -136,16 +136,16 @@ func BenchmarkProtobufEncoding(b *testing.B) { func BenchmarkMsgpEncoding(b *testing.B) { serializer := NewAnalyticsSerializer(MSGP_SERIALIZER) records := []analytics.AnalyticsRecord{ - demo.GenerateRandomAnalyticRecord("org_1", true), - demo.GenerateRandomAnalyticRecord("org_1", true), - demo.GenerateRandomAnalyticRecord("org_1", true), - demo.GenerateRandomAnalyticRecord("org_1", true), - demo.GenerateRandomAnalyticRecord("org_1", true), - demo.GenerateRandomAnalyticRecord("org_2", true), - demo.GenerateRandomAnalyticRecord("org_2", true), - demo.GenerateRandomAnalyticRecord("org_2", true), - demo.GenerateRandomAnalyticRecord("org_2", true), - demo.GenerateRandomAnalyticRecord("org_2", true), + demo.GenerateRandomAnalyticRecord("org_1", true, 50), + demo.GenerateRandomAnalyticRecord("org_1", true, 50), + demo.GenerateRandomAnalyticRecord("org_1", true, 50), + demo.GenerateRandomAnalyticRecord("org_1", true, 50), + demo.GenerateRandomAnalyticRecord("org_1", true, 50), + demo.GenerateRandomAnalyticRecord("org_2", true, 50), + demo.GenerateRandomAnalyticRecord("org_2", true, 50), + demo.GenerateRandomAnalyticRecord("org_2", true, 50), + demo.GenerateRandomAnalyticRecord("org_2", true, 50), + demo.GenerateRandomAnalyticRecord("org_2", true, 50), } b.Helper() b.ReportAllocs() From e52de3fb8c1687353f26068eb821a6d0d533bf2d Mon Sep 17 00:00:00 2001 From: sredny buitrago Date: Wed, 20 Mar 2024 18:31:06 -0300 Subject: [PATCH 02/16] update test of generate demo data --- analytics/demo/demo_test.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/analytics/demo/demo_test.go b/analytics/demo/demo_test.go index 2abd835ce..99004ba18 100644 --- a/analytics/demo/demo_test.go +++ b/analytics/demo/demo_test.go @@ -17,6 +17,7 @@ func TestGenerateDemoData(t *testing.T) { recordsPerHour int trackPath bool futureData bool + apikeysCount int } tests := []struct { @@ -31,6 +32,7 @@ func TestGenerateDemoData(t *testing.T) { orgID: "test", trackPath: false, futureData: true, + apikeysCount: 50, writer: func(data []interface{}, job *health.Job, ts time.Time, n int) { }, }, @@ -42,6 +44,7 @@ func TestGenerateDemoData(t *testing.T) { recordsPerHour: 1, orgID: "test", trackPath: true, + apikeysCount: 50, writer: func([]interface{}, *health.Job, time.Time, int) {}, }, }, @@ -52,6 +55,7 @@ func TestGenerateDemoData(t *testing.T) { recordsPerHour: 2, orgID: "test", trackPath: false, + apikeysCount: 50, writer: func([]interface{}, *health.Job, time.Time, int) {}, }, }, @@ -62,6 +66,7 @@ func TestGenerateDemoData(t *testing.T) { recordsPerHour: 2, orgID: "test", trackPath: true, + apikeysCount: 50, writer: func([]interface{}, *health.Job, time.Time, int) {}, }, }, @@ -72,6 +77,7 @@ func TestGenerateDemoData(t *testing.T) { recordsPerHour: 100, orgID: "test", trackPath: false, + apikeysCount: 50, writer: func([]interface{}, *health.Job, time.Time, int) {}, }, }, @@ -82,6 +88,7 @@ func TestGenerateDemoData(t *testing.T) { recordsPerHour: 0, orgID: "test", trackPath: true, + apikeysCount: 50, writer: func([]interface{}, *health.Job, time.Time, int) {}, }, }, @@ -92,6 +99,7 @@ func TestGenerateDemoData(t *testing.T) { recordsPerHour: 0, orgID: "test", trackPath: false, + apikeysCount: 50, writer: func([]interface{}, *health.Job, time.Time, int) {}, }, }, @@ -121,7 +129,7 @@ func TestGenerateDemoData(t *testing.T) { } } - GenerateDemoData(tt.args.days, tt.args.recordsPerHour, tt.args.orgID, tt.args.futureData, tt.args.trackPath, tt.args.writer) + GenerateDemoData(tt.args.days, tt.args.recordsPerHour, tt.args.orgID, tt.args.futureData, tt.args.trackPath, tt.args.apikeysCount, tt.args.writer) if tt.args.recordsPerHour == 0 { isValid := counter >= 300*tt.args.days || counter <= 500*tt.args.days assert.True(t, isValid) From 8f2a38c19d011236c8690a52391590b4c3502cb4 Mon Sep 17 00:00:00 2001 From: sredny buitrago Date: Mon, 20 May 2024 17:24:52 -0400 Subject: [PATCH 03/16] added comments to functions --- analytics/demo/demo.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/analytics/demo/demo.go b/analytics/demo/demo.go index 03b7cf240..725f6c790 100644 --- a/analytics/demo/demo.go +++ b/analytics/demo/demo.go @@ -153,6 +153,7 @@ func country() string { return codes[rand.Intn(len(codes))] } +// GenerateDemoData given the params for the demo mode func GenerateDemoData(days, recordsPerHour int, orgID string, demoFutureData, trackPath bool, apiKeysCount int, writer func([]interface{}, *health.Job, time.Time, int)) { t := time.Now() start := time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, time.UTC) @@ -179,6 +180,7 @@ func GenerateDemoData(days, recordsPerHour int, orgID string, demoFutureData, tr } } +// WriteDemoData writes the data generated in demo mode into store func WriteDemoData(start time.Time, d, h, recordsPerHour int, orgID string, trackPath bool, apikeysCount int, writer func([]interface{}, *health.Job, time.Time, int)) { set := []interface{}{} ts := start.AddDate(0, 0, d) @@ -207,6 +209,7 @@ func WriteDemoData(start time.Time, d, h, recordsPerHour int, orgID string, trac writer(set, nil, time.Now(), 10) } +// GenerateRandomAnalyticRecord generates one single analytics record for the demo mode func GenerateRandomAnalyticRecord(orgID string, trackPath bool, apiKeysCount int) analytics.AnalyticsRecord { p := randomPath() api, apiID := randomAPI() From 4e7512958980365c2b27d65e4ea0540a4b0d51b9 Mon Sep 17 00:00:00 2001 From: sredny buitrago Date: Tue, 21 May 2024 12:30:23 -0400 Subject: [PATCH 04/16] addressing lints --- analytics/demo/demo.go | 8 ++++---- main.go | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/analytics/demo/demo.go b/analytics/demo/demo.go index 725f6c790..0e80eed31 100644 --- a/analytics/demo/demo.go +++ b/analytics/demo/demo.go @@ -120,21 +120,21 @@ func responseCode() int { return codes[rand.Intn(len(codes))] } -func GenerateAPIKeys(orgId string, apikeysQuantity int) { +func GenerateAPIKeys(orgID string, apikeysQuantity int) { set := make([]string, apikeysQuantity) for i := 0; i < len(set); i++ { - set[i] = generateAPIKey(orgId) + set[i] = generateAPIKey(orgID) } apiKeys = set } -func generateAPIKey(orgId string) string { +func generateAPIKey(orgID string) string { u1, err := uuid.NewV4() if err != nil { log.WithError(err).Error("failed to generate UUID") } id := strings.Replace(u1.String(), "-", "", -1) - return orgId + id + return orgID + id } func getRandomKey(orgId string, apiKeysCount int) string { diff --git a/main.go b/main.go index 483d2eeb0..b07bdadc4 100644 --- a/main.go +++ b/main.go @@ -47,7 +47,7 @@ var ( demoDays = kingpin.Flag("demo-days", "flag that determines the number of days for the analytics records").Default("30").Int() demoRecordsPerHour = kingpin.Flag("demo-records-per-hour", "flag that determines the number of records per hour for the analytics records").Default("0").Int() demoFutureData = kingpin.Flag("demo-future-data", "flag that determines if the demo data should be in the future").Default("false").Bool() - demoApiKeysCount = kingpin.Flag("demo-apikeys-count", "flag that determines the quantity of apikeys to generate in demo mode").Default("50").Int() + demoAPIKeysCount = kingpin.Flag("demo-apikeys-count", "flag that determines the quantity of apikeys to generate in demo mode").Default("50").Int() debugMode = kingpin.Flag("debug", "enable debug mode").Bool() //lint:ignore U1000 Function is used when version flag is passed in command line version = kingpin.Version(pumps.Version) @@ -484,8 +484,8 @@ func main() { if *demoMode != "" { log.Info("BUILDING DEMO DATA AND EXITING...") log.Warning("Starting from date: ", time.Now().AddDate(0, 0, -30)) - demo.DemoInit(*demoMode, *demoApiMode, *demoApiVersionMode, *demoApiKeysCount) - demo.GenerateDemoData(*demoDays, *demoRecordsPerHour, *demoMode, *demoFutureData, *demoTrackPath, *demoApiKeysCount, writeToPumps) + demo.DemoInit(*demoMode, *demoApiMode, *demoApiVersionMode, *demoAPIKeysCount) + demo.GenerateDemoData(*demoDays, *demoRecordsPerHour, *demoMode, *demoFutureData, *demoTrackPath, *demoAPIKeysCount, writeToPumps) return } From 3a1efe254321b521b2d0058c5e7bca14a90962ce Mon Sep 17 00:00:00 2001 From: sredny buitrago Date: Thu, 23 May 2024 15:16:44 -0400 Subject: [PATCH 05/16] rename func from DemoInit to Start --- analytics/demo/demo.go | 7 ++++--- main.go | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/analytics/demo/demo.go b/analytics/demo/demo.go index 0e80eed31..0ed4756e2 100644 --- a/analytics/demo/demo.go +++ b/analytics/demo/demo.go @@ -19,7 +19,8 @@ var ( log = logger.GetLogger() ) -func DemoInit(orgId, apiId, version string, apikeysCount int) { +// Start initializes the demo mode +func Start(orgId, apiId, version string, apikeysCount int) { apiID = apiId GenerateAPIKeys(orgId, apikeysCount) apiVersion = version @@ -137,9 +138,9 @@ func generateAPIKey(orgID string) string { return orgID + id } -func getRandomKey(orgId string, apiKeysCount int) string { +func getRandomKey(orgID string, apiKeysCount int) string { if len(apiKeys) == 0 { - GenerateAPIKeys(orgId, apiKeysCount) + GenerateAPIKeys(orgID, apiKeysCount) } return apiKeys[rand.Intn(len(apiKeys))] } diff --git a/main.go b/main.go index b07bdadc4..dbc307c24 100644 --- a/main.go +++ b/main.go @@ -484,7 +484,7 @@ func main() { if *demoMode != "" { log.Info("BUILDING DEMO DATA AND EXITING...") log.Warning("Starting from date: ", time.Now().AddDate(0, 0, -30)) - demo.DemoInit(*demoMode, *demoApiMode, *demoApiVersionMode, *demoAPIKeysCount) + demo.Start(*demoMode, *demoApiMode, *demoApiVersionMode, *demoAPIKeysCount) demo.GenerateDemoData(*demoDays, *demoRecordsPerHour, *demoMode, *demoFutureData, *demoTrackPath, *demoAPIKeysCount, writeToPumps) return } From 44499a80f58804e352fcceae1b1497b7253ea049 Mon Sep 17 00:00:00 2001 From: sredny buitrago Date: Thu, 23 May 2024 15:28:07 -0400 Subject: [PATCH 06/16] rename orgId to orgID --- analytics/demo/demo.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/analytics/demo/demo.go b/analytics/demo/demo.go index 0ed4756e2..bc23483e3 100644 --- a/analytics/demo/demo.go +++ b/analytics/demo/demo.go @@ -20,9 +20,9 @@ var ( ) // Start initializes the demo mode -func Start(orgId, apiId, version string, apikeysCount int) { +func Start(orgID, apiId, version string, apikeysCount int) { apiID = apiId - GenerateAPIKeys(orgId, apikeysCount) + GenerateAPIKeys(orgID, apikeysCount) apiVersion = version if version == "" { apiVersion = "Default" From 11c70a909ab4d01d47a32fb9ca31399163d1630c Mon Sep 17 00:00:00 2001 From: sredny buitrago Date: Thu, 23 May 2024 17:10:16 -0400 Subject: [PATCH 07/16] update command for ci test --- .github/workflows/ci-test.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index 092c40871..1c7fa1b99 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -75,7 +75,17 @@ jobs: - name: golangci-lint if: ${{ github.event_name == 'pull_request' }} run: | - $(go env GOPATH)/bin/golangci-lint run --out-format checkstyle --timeout=300s --max-issues-per-linter=0 --max-same-issues=0 --new-from-rev=origin/${{ github.base_ref }} ./... > golanglint.xml + $(go env GOPATH)/bin/golangci-lint run \ + --out-format checkstyle \ + --timeout=300s \ + --enable shadow \ + --enable errcheck \ + --enable gofumpt \ + --enable staticcheck + --max-issues-per-linter=0 \ + --max-same-issues=0 \ + --new-from-rev=origin/${{ github.base_ref }} \ + ./... > golanglint.xml - name: golangci-lint if: ${{ github.event_name == 'push' }} From 467f5412023c830cc6221cfc1e64859876c73c69 Mon Sep 17 00:00:00 2001 From: sredny buitrago Date: Thu, 23 May 2024 18:52:13 -0400 Subject: [PATCH 08/16] set version of golangci-lint to use --- .github/workflows/ci-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index 1c7fa1b99..cefe8ede0 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -70,7 +70,7 @@ jobs: exit $result_code - name: Download golangci-lint - run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin + run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.58.2 - name: golangci-lint if: ${{ github.event_name == 'pull_request' }} @@ -81,7 +81,7 @@ jobs: --enable shadow \ --enable errcheck \ --enable gofumpt \ - --enable staticcheck + --enable staticcheck \ --max-issues-per-linter=0 \ --max-same-issues=0 \ --new-from-rev=origin/${{ github.base_ref }} \ From 24e06d39cdb43842878546dd8415fd687107a8e3 Mon Sep 17 00:00:00 2001 From: sredny buitrago Date: Thu, 23 May 2024 18:59:01 -0400 Subject: [PATCH 09/16] reverted changes in cilint --- .github/workflows/ci-test.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index cefe8ede0..d0efa608f 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -78,10 +78,6 @@ jobs: $(go env GOPATH)/bin/golangci-lint run \ --out-format checkstyle \ --timeout=300s \ - --enable shadow \ - --enable errcheck \ - --enable gofumpt \ - --enable staticcheck \ --max-issues-per-linter=0 \ --max-same-issues=0 \ --new-from-rev=origin/${{ github.base_ref }} \ From ddf53e5f7b73d58176701948cbaa23d9e6f7c920 Mon Sep 17 00:00:00 2001 From: sredny buitrago Date: Thu, 23 May 2024 19:14:10 -0400 Subject: [PATCH 10/16] downgrade cilint to 1.56.2 --- .github/workflows/ci-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index d0efa608f..435ca9587 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -70,7 +70,7 @@ jobs: exit $result_code - name: Download golangci-lint - run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.58.2 + run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.56.2 - name: golangci-lint if: ${{ github.event_name == 'pull_request' }} From c8c42b6b5a0a69eabd5abdbc6953084de87eac05 Mon Sep 17 00:00:00 2001 From: sredny buitrago Date: Thu, 23 May 2024 19:30:09 -0400 Subject: [PATCH 11/16] align --- .github/workflows/ci-test.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index 435ca9587..f1940fb7b 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -80,8 +80,7 @@ jobs: --timeout=300s \ --max-issues-per-linter=0 \ --max-same-issues=0 \ - --new-from-rev=origin/${{ github.base_ref }} \ - ./... > golanglint.xml + --new-from-rev=origin/${{ github.base_ref }} ./... > golanglint.xml - name: golangci-lint if: ${{ github.event_name == 'push' }} From d280ab3d6010cc9b320c946d10af982b246a62cd Mon Sep 17 00:00:00 2001 From: sredny buitrago Date: Thu, 23 May 2024 19:41:08 -0400 Subject: [PATCH 12/16] do not multiline --- .github/workflows/ci-test.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index f1940fb7b..d018e79f5 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -75,12 +75,7 @@ jobs: - name: golangci-lint if: ${{ github.event_name == 'pull_request' }} run: | - $(go env GOPATH)/bin/golangci-lint run \ - --out-format checkstyle \ - --timeout=300s \ - --max-issues-per-linter=0 \ - --max-same-issues=0 \ - --new-from-rev=origin/${{ github.base_ref }} ./... > golanglint.xml + $(go env GOPATH)/bin/golangci-lint run --out-format checkstyle --timeout=300s --max-issues-per-linter=0 --max-same-issues=0 --new-from-rev=origin/${{ github.base_ref }} ./... > golanglint.xml - name: golangci-lint if: ${{ github.event_name == 'push' }} From c867e212dec332287c8e90049875788eb0fe4140 Mon Sep 17 00:00:00 2001 From: sredny buitrago Date: Fri, 24 May 2024 18:42:13 -0400 Subject: [PATCH 13/16] set lintern to 1.55.2 --- .github/workflows/ci-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index d018e79f5..143256ac7 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -70,7 +70,7 @@ jobs: exit $result_code - name: Download golangci-lint - run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.56.2 + run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.55.2 - name: golangci-lint if: ${{ github.event_name == 'pull_request' }} From 674daf5afd1c9221aee1753d52694cc8c96f53f8 Mon Sep 17 00:00:00 2001 From: sredny buitrago Date: Mon, 27 May 2024 10:46:52 -0400 Subject: [PATCH 14/16] remove version of golintern --- .github/workflows/ci-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index 143256ac7..092c40871 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -70,7 +70,7 @@ jobs: exit $result_code - name: Download golangci-lint - run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.55.2 + run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin - name: golangci-lint if: ${{ github.event_name == 'pull_request' }} From 85e60fec4a8b3aa515e21309fec6454ee5409773 Mon Sep 17 00:00:00 2001 From: sredny buitrago Date: Mon, 27 May 2024 11:36:44 -0400 Subject: [PATCH 15/16] rename apiId param on start --- analytics/demo/demo.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/analytics/demo/demo.go b/analytics/demo/demo.go index bc23483e3..61c6e211f 100644 --- a/analytics/demo/demo.go +++ b/analytics/demo/demo.go @@ -20,8 +20,8 @@ var ( ) // Start initializes the demo mode -func Start(orgID, apiId, version string, apikeysCount int) { - apiID = apiId +func Start(orgID, newApiID, version string, apikeysCount int) { + apiID = newApiID GenerateAPIKeys(orgID, apikeysCount) apiVersion = version if version == "" { From 21e7eeba7077bff543791ae385d6d34d2d9f8205 Mon Sep 17 00:00:00 2001 From: sredny buitrago Date: Mon, 27 May 2024 11:48:51 -0400 Subject: [PATCH 16/16] rename to newAPIID --- analytics/demo/demo.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/analytics/demo/demo.go b/analytics/demo/demo.go index 61c6e211f..331e7eadb 100644 --- a/analytics/demo/demo.go +++ b/analytics/demo/demo.go @@ -20,8 +20,8 @@ var ( ) // Start initializes the demo mode -func Start(orgID, newApiID, version string, apikeysCount int) { - apiID = newApiID +func Start(orgID, newAAPIID, version string, apikeysCount int) { + apiID = newAAPIID GenerateAPIKeys(orgID, apikeysCount) apiVersion = version if version == "" {