Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix: fix golangci-lint errors (#2405)
Danny Xu0d363b3cb21a
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.ymlindex a9f808b343..9735e135d6 100644--- a/.github/workflows/tests.yml+++ b/.github/workflows/tests.yml@@ -27,7 +27,7 @@ jobs:- name: golangci-lintuses: golangci/golangci-lint-action@v3with:- version: v1.45.2+ version: v1.49.0args: -vskip-cache: truediff --git a/.pre-commit-config.yaml b/.pre-commit-config.yamlindex 43d180ece3..5077539cc8 100644--- a/.pre-commit-config.yaml+++ b/.pre-commit-config.yaml@@ -29,6 +29,6 @@ repos:- id: end-of-file-fixer- id: trailing-whitespace- repo: https://github.com/golangci/golangci-lint- rev: v1.44.0+ rev: v1.49.0hooks:- id: golangci-lintdiff --git a/api/api.go b/api/api.goindex a7aeeac87a..d930ca1200 100644--- a/api/api.go+++ b/api/api.go@@ -1,3 +1,4 @@+// Package api provides the definition of all APIs.package apiimport (diff --git a/bin/bb/main.go b/bin/bb/main.goindex d89d35c4f6..058cb46465 100644--- a/bin/bb/main.go+++ b/bin/bb/main.go@@ -1,4 +1,4 @@-// Bytebase cli command.+// Package main is the main package for bb CLI.package mainimport (diff --git a/bin/server/cmd/root.go b/bin/server/cmd/root.goindex a1b4dd1f67..3a97fe16a2 100644--- a/bin/server/cmd/root.go+++ b/bin/server/cmd/root.go@@ -1,3 +1,4 @@+// Package cmd implements the cobra CLI for Bytebase server.package cmdimport (diff --git a/bin/server/main.go b/bin/server/main.goindex 63b7762129..04dd5eb3f0 100644--- a/bin/server/main.go+++ b/bin/server/main.go@@ -1,3 +1,4 @@+// Package main is the main binary for Bytebase service.package mainimport (diff --git a/bin/sql-service/cmd/root.go b/bin/sql-service/cmd/root.goindex 5e0475f604..01164600cb 100644--- a/bin/sql-service/cmd/root.go+++ b/bin/sql-service/cmd/root.go@@ -1,3 +1,4 @@+// Package cmd provides the cobra CLI implementation for SQL review service.package cmdimport (diff --git a/bin/sql-service/main.go b/bin/sql-service/main.goindex e3fa786d62..74b6ad8f98 100644--- a/bin/sql-service/main.go+++ b/bin/sql-service/main.go@@ -1,3 +1,4 @@+// Package main is the main binary for SQL review service.package mainimport (diff --git a/common/docs.go b/common/docs.gonew file mode 100644index 0000000000..1cf0812cd5--- /dev/null+++ b/common/docs.go@@ -0,0 +1,2 @@+// Package common provides common libraries for the service.+package commondiff --git a/common/log/logger.go b/common/log/logger.goindex 0ed3eab522..4a615fee99 100644--- a/common/log/logger.go+++ b/common/log/logger.go@@ -1,3 +1,4 @@+// Package log implements a simple logging package.package logimport (diff --git a/enterprise/api/license.go b/enterprise/api/license.goindex 09d57169cd..6ce87afcdb 100644--- a/enterprise/api/license.go+++ b/enterprise/api/license.go@@ -1,3 +1,4 @@+// Package api provides the API definition for enterprise service.package apiimport (diff --git a/enterprise/config/config.go b/enterprise/config/config.goindex 00ad08dd0e..a0325ad436 100644--- a/enterprise/config/config.go+++ b/enterprise/config/config.go@@ -1,3 +1,4 @@+// Package config provides configuration interface for enterprise licensing.package configimport (diff --git a/enterprise/service/license.go b/enterprise/service/license.goindex 329f4712f5..161729d4b7 100644--- a/enterprise/service/license.go+++ b/enterprise/service/license.go@@ -1,3 +1,4 @@+// Package service implements the enterprise license service.package serviceimport (diff --git a/metric/collector/docs.go b/metric/collector/docs.gonew file mode 100644index 0000000000..f115b8298a--- /dev/null+++ b/metric/collector/docs.go@@ -0,0 +1,2 @@+// Package collector implements the collector for metrics reporting.+package collectordiff --git a/metric/metric.go b/metric/metric.goindex 61c454a907..8ca7643484 100644--- a/metric/metric.go+++ b/metric/metric.go@@ -1,3 +1,4 @@+// Package metric provides the API definition for metrics.package metricimport (diff --git a/plugin/advisor/catalog/catalog.go b/plugin/advisor/catalog/catalog.goindex 846e325428..b13fcaea02 100644--- a/plugin/advisor/catalog/catalog.go+++ b/plugin/advisor/catalog/catalog.go@@ -1,3 +1,4 @@+// Package catalog provides API definition for catalog service.package catalogimport (diff --git a/plugin/advisor/db/db.go b/plugin/advisor/db/db.goindex f6d6da35a3..c1612d087b 100644--- a/plugin/advisor/db/db.go+++ b/plugin/advisor/db/db.go@@ -1,3 +1,4 @@+// Package db provides the database utility for SQL advisor.package dbimport (diff --git a/plugin/advisor/fake/fake_advisor.go b/plugin/advisor/fake/fake_advisor.goindex 3789a65eb3..cd5434d300 100644--- a/plugin/advisor/fake/fake_advisor.go+++ b/plugin/advisor/fake/fake_advisor.go@@ -1,3 +1,4 @@+// Package fake implements a fake SQL advisor.package fakeimport (diff --git a/plugin/advisor/generator/main.go b/plugin/advisor/generator/main.goindex fecba64054..2458e05a00 100644--- a/plugin/advisor/generator/main.go+++ b/plugin/advisor/generator/main.go@@ -1,3 +1,4 @@+// Package main is the Go code generator for SQL review rules.package mainimport (diff --git a/plugin/advisor/mysql/utils.go b/plugin/advisor/mysql/utils.goindex 29939c04fd..ce6f3ef670 100644--- a/plugin/advisor/mysql/utils.go+++ b/plugin/advisor/mysql/utils.go@@ -1,3 +1,4 @@+// Package mysql implements the SQL advisor rules for MySQL.package mysqlimport (diff --git a/plugin/advisor/pg/utils.go b/plugin/advisor/pg/utils.goindex 9e69f953d2..1102dcf57c 100644--- a/plugin/advisor/pg/utils.go+++ b/plugin/advisor/pg/utils.go@@ -1,3 +1,4 @@+// Package pg implements the SQL advisor rules for PostgreSQL.package pgimport (diff --git a/plugin/db/clickhouse/clickhouse.go b/plugin/db/clickhouse/clickhouse.goindex cf5b7e304c..d5110fdc7e 100644--- a/plugin/db/clickhouse/clickhouse.go+++ b/plugin/db/clickhouse/clickhouse.go@@ -1,3 +1,4 @@+// Package clickhouse is the plugin for ClickHouse driver.package clickhouseimport (diff --git a/plugin/db/driver.go b/plugin/db/driver.goindex 1ba2a6d00c..e8a22af367 100644--- a/plugin/db/driver.go+++ b/plugin/db/driver.go@@ -1,3 +1,4 @@+// Package db provides the interfaces and libraries for database driver plugins.package dbimport (diff --git a/plugin/db/mysql/mysql.go b/plugin/db/mysql/mysql.goindex 0912c46787..03bae06075 100644--- a/plugin/db/mysql/mysql.go+++ b/plugin/db/mysql/mysql.go@@ -1,3 +1,4 @@+// Package mysql is the plugin for MySQL driver.package mysqlimport (diff --git a/plugin/db/mysql/restore_test.go b/plugin/db/mysql/restore_test.goindex 7fef92c3df..031ab530b2 100644--- a/plugin/db/mysql/restore_test.go+++ b/plugin/db/mysql/restore_test.go@@ -317,7 +317,7 @@ func TestParseBinlogEventTsInLine(t *testing.T) {}{// normal case{- line: "#220620 13:23:55 server id 1 end_log_pos 126 CRC32 0x9a60fe57 Start: binlog v 4, server v 8.0.28 created 220620 13:23:55 at startup",+ line: "#220620 13:23:55 server id 1 end_log_pos 126 CRC32 0x9a60fe57 Start: binlog v 4, server v 8.0.28 created 220620 13:23:55 at startup",eventTs: time.Date(2022, 6, 20, 13, 23, 55, 0, time.Local).Unix(),found: true,err: false,@@ -331,7 +331,7 @@ func TestParseBinlogEventTsInLine(t *testing.T) {},// fake event with "end_log_pos 0"{- line: "#220609 11:59:57 server id 1 end_log_pos 0 CRC32 0x031d41f6 Start: binlog v 4, server v 8.0.28 created 220609 11:59:57",+ line: "#220609 11:59:57 server id 1 end_log_pos 0 CRC32 0x031d41f6 Start: binlog v 4, server v 8.0.28 created 220609 11:59:57",eventTs: 0,found: false,err: false,@@ -345,7 +345,7 @@ func TestParseBinlogEventTsInLine(t *testing.T) {},// parse time error{- line: "#220620 99:99:99 server id 1 end_log_pos 126 CRC32 0x9a60fe57 Start: binlog v 4, server v 8.0.28 created 220620 13:23:55 at startup",+ line: "#220620 99:99:99 server id 1 end_log_pos 126 CRC32 0x9a60fe57 Start: binlog v 4, server v 8.0.28 created 220620 13:23:55 at startup",eventTs: 0,found: false,err: true,diff --git a/plugin/db/pg/pg.go b/plugin/db/pg/pg.goindex 8bcbb1be7e..8425ae5492 100644--- a/plugin/db/pg/pg.go+++ b/plugin/db/pg/pg.go@@ -1,3 +1,4 @@+// Package pg is the plugin for PostgreSQL driver.package pgimport (diff --git a/plugin/db/snowflake/snowflake.go b/plugin/db/snowflake/snowflake.goindex fe1fc1e80a..bb4de677d5 100644--- a/plugin/db/snowflake/snowflake.go+++ b/plugin/db/snowflake/snowflake.go@@ -1,3 +1,4 @@+// Package snowflake is the plugin for Snowflake driver.package snowflakeimport (diff --git a/plugin/db/sqlite/sqlite.go b/plugin/db/sqlite/sqlite.goindex 5c84ae5476..106f96cfb6 100644--- a/plugin/db/sqlite/sqlite.go+++ b/plugin/db/sqlite/sqlite.go@@ -1,3 +1,4 @@+// Package sqlite is the plugin for SQLite driver.package sqliteimport (diff --git a/plugin/db/util/driverutil.go b/plugin/db/util/driverutil.goindex d23096a214..948c53e4f0 100644--- a/plugin/db/util/driverutil.go+++ b/plugin/db/util/driverutil.go@@ -1,3 +1,4 @@+// Package util provides the library for database drivers.package utilimport (diff --git a/plugin/metric/metric.go b/plugin/metric/metric.goindex 22b4e0b9d1..2e3b0f8fcf 100644--- a/plugin/metric/metric.go+++ b/plugin/metric/metric.go@@ -1,3 +1,4 @@+// Package metric is the interfaces for telemetry metrics.package metric// Name is the metric name.diff --git a/plugin/metric/segment/reporter.go b/plugin/metric/segment/reporter.goindex a933a7eee2..01c80640ff 100644--- a/plugin/metric/segment/reporter.go+++ b/plugin/metric/segment/reporter.go@@ -1,3 +1,4 @@+// Package segment implements the reporter for segment.package segmentimport (diff --git a/plugin/parser/ast/constraint_def.go b/plugin/parser/ast/constraint_def.goindex 0131ce065e..3b68a6a786 100644--- a/plugin/parser/ast/constraint_def.go+++ b/plugin/parser/ast/constraint_def.go@@ -26,17 +26,20 @@ const (// ConstraintDef is struct for constraint definition.// For PRIMARY:-// Name: It's the PK constraint name.-// KeyList: It's the name list of the columns in PK.+//+// Name: It's the PK constraint name.+// KeyList: It's the name list of the columns in PK.//// For UNIQUE-// Name: It's the UK constraint name.-// KeyList: It's the name list of the columns in UK.+//+// Name: It's the UK constraint name.+// KeyList: It's the name list of the columns in UK.//// For Foreign-// Name: It's the FK constraint name.-// KeyList: It's the name list of the columns in FK.-// Foreign: It's the reference content for this FK.+//+// Name: It's the FK constraint name.+// KeyList: It's the name list of the columns in FK.+// Foreign: It's the reference content for this FK.type ConstraintDef struct {nodediff --git a/plugin/parser/ast/docs.go b/plugin/parser/ast/docs.gonew file mode 100644index 0000000000..636b5d2467--- /dev/null+++ b/plugin/parser/ast/docs.go@@ -0,0 +1,2 @@+// Package ast implements a simple ast for SQL.+package astdiff --git a/plugin/parser/engine/pg/parser.go b/plugin/parser/engine/pg/parser.goindex c3229b55db..68a44d0cc6 100644--- a/plugin/parser/engine/pg/parser.go+++ b/plugin/parser/engine/pg/parser.go@@ -1,3 +1,4 @@+// Package pg implements the parser for PostgreSQL.package pgimport (diff --git a/plugin/parser/parser.go b/plugin/parser/parser.goindex 80aeaebd30..1b8e1e8dce 100644--- a/plugin/parser/parser.go+++ b/plugin/parser/parser.go@@ -1,3 +1,4 @@+// Package parser provides the interfaces and libraries for SQL parser.package parserimport (diff --git a/plugin/parser/tokenizer.go b/plugin/parser/tokenizer.goindex bd901a6fbb..c077b6da23 100644--- a/plugin/parser/tokenizer.go+++ b/plugin/parser/tokenizer.go@@ -399,19 +399,20 @@ func (t *tokenizer) splitMySQLMultiSQL() ([]SingleSQL, error) {// splitPostgreSQLMultiSQL splits the statement to a string slice.// We mainly considered:-// - comments-// - style /* comments */-// - style -- comments-// - string-// - style 'string'-// - style $$ string $$-// - identifier-// - style "indentifier"+//+// comments+// - style /* comments */+// - style -- comments+// string+// - style 'string'+// - style $$ string $$+// identifier+// - style "indentifier"//// Notice:// - We support PostgreSQL CREATE PROCEDURE statement with $$ $$ style,-// but do not support BEGIN ATOMIC ... END; style.-// See https://www.postgresql.org/docs/14/sql-createprocedure.html.+// but do not support BEGIN ATOMIC ... END; style.+// See https://www.postgresql.org/docs/14/sql-createprocedure.html.func (t *tokenizer) splitPostgreSQLMultiSQL() ([]SingleSQL, error) {var res []SingleSQL@@ -506,15 +507,8 @@ func (t *tokenizer) scanIdentifier(delimiter rune) error {}}-// There are two ways to include a single quote('), using \' or ''.-// We only handle the case \', because the second case '' does not require special handling.-// In more detail, we can think of-// 'this is a string contains ''.'-// as-// 'this is a string contains '-// and-// '.'-//.+// There are two ways to include a single quote('), using \' or two single-quotes.+// We only handle the case \', because the second case does not require special handling.// And this is extensible.// For MySQL, user can enclose string within double quote(").func (t *tokenizer) scanString(delimiter rune) error {@@ -668,12 +662,14 @@ func (t *tokenizer) processStreaming(statement string) error {}// truncate will return the buffer after pos.-// Before:-// buffer [.............]-// |-// pos-// After: |-// buffer [.......].+/*+Before:+buffer [.............]+ |+ pos+After: |+buffer [.......].+*/func (t *tokenizer) truncate(pos uint) {if pos > t.len {pos = t.lendiff --git a/plugin/storage/s3/s3.go b/plugin/storage/s3/s3.goindex 1b523ebbe9..21863d2fc3 100644--- a/plugin/storage/s3/s3.go+++ b/plugin/storage/s3/s3.go@@ -1,3 +1,4 @@+// Package s3 provides the client for AWS S3 storage.package s3import (diff --git a/plugin/vcs/github/github.go b/plugin/vcs/github/github.goindex 43a132ac16..7c6a3c9782 100644--- a/plugin/vcs/github/github.go+++ b/plugin/vcs/github/github.go@@ -1,3 +1,4 @@+// Package github is the plugin for GitHub.package githubimport (@@ -473,7 +474,9 @@ func (p *Provider) ExchangeOAuthToken(ctx context.Context, instanceURL string, oif err != nil {return nil, errors.Wrapf(err, "failed to read OAuth response body, code %v", resp.StatusCode)}- defer func() { _ = resp.Body.Close() }()+ defer func() {+ _ = resp.Body.Close()+ }()oauthResp := new(oauthResponse)if err := json.Unmarshal(body, oauthResp); err != nil {diff --git a/plugin/vcs/gitlab/gitlab.go b/plugin/vcs/gitlab/gitlab.goindex 1827e63626..02a280af98 100644--- a/plugin/vcs/gitlab/gitlab.go+++ b/plugin/vcs/gitlab/gitlab.go@@ -1,3 +1,4 @@+// Package gitlab is the plugin for GitLab.package gitlabimport (@@ -243,7 +244,9 @@ func (p *Provider) ExchangeOAuthToken(ctx context.Context, instanceURL string, oif err != nil {return nil, errors.Wrapf(err, "failed to read OAuth response body, code %v", resp.StatusCode)}- defer func() { _ = resp.Body.Close() }()+ defer func() {+ _ = resp.Body.Close()+ }()oauthResp := new(oauthResponse)if err := json.Unmarshal(body, oauthResp); err != nil {diff --git a/plugin/vcs/internal/oauth/oauth.go b/plugin/vcs/internal/oauth/oauth.goindex 59312ab4c5..6f33032c53 100644--- a/plugin/vcs/internal/oauth/oauth.go+++ b/plugin/vcs/internal/oauth/oauth.go@@ -1,3 +1,4 @@+// Package oauth provides library for VCS plugins.package oauthimport (diff --git a/plugin/vcs/internal/oauth/oauth_test.go b/plugin/vcs/internal/oauth/oauth_test.goindex df361442cc..4251dd889d 100644--- a/plugin/vcs/internal/oauth/oauth_test.go+++ b/plugin/vcs/internal/oauth/oauth_test.go@@ -116,7 +116,9 @@ func TestRetry_Exceeded(t *testing.T) {token := "expired"_, _, err := retry(ctx, nil, &token,- func(_ context.Context, _ *http.Client, _ *string) error { return nil },+ func(_ context.Context, _ *http.Client, _ *string) error {+ return nil+ },func() (*http.Response, error) {return &http.Response{StatusCode: http.StatusBadRequest,diff --git a/plugin/vcs/util.go b/plugin/vcs/util.goindex c158739a79..eb8175fd49 100644--- a/plugin/vcs/util.go+++ b/plugin/vcs/util.go@@ -1,3 +1,4 @@+// Package vcs provides the utilities for VCS plugins.package vcsimport (diff --git a/plugin/webhook/webhook.go b/plugin/webhook/webhook.goindex 933ab872f0..023067c361 100644--- a/plugin/webhook/webhook.go+++ b/plugin/webhook/webhook.go@@ -1,3 +1,4 @@+// Package webhook provides the webhook implementations for various messaging platforms.package webhookimport (diff --git a/resources/mysql/mysql.go b/resources/mysql/mysql.goindex eee8c07437..60f5b053e4 100644--- a/resources/mysql/mysql.go+++ b/resources/mysql/mysql.go@@ -1,6 +1,7 @@//go:build mysql// +build mysql+// Package mysql provides the resource for MySQL server and utility packages.package mysqlimport (@@ -35,7 +36,9 @@ type Instance struct {}// Port returns the port of the mysql instance.-func (i Instance) Port() int { return i.port }+func (i Instance) Port() int {+ return i.port+}// Start starts the mysql instance on the given port, outputs to stdout and stderr.// Waits at most `waitSec` seconds for the mysql instance to ready for connection.diff --git a/resources/mysql/resources_darwin.go b/resources/mysql/resources_darwin.goindex a3d0c0811a..cb77ab0c0f 100644--- a/resources/mysql/resources_darwin.go+++ b/resources/mysql/resources_darwin.go@@ -8,7 +8,8 @@ import "embed"// f1943053b12428e4c0e4ed309a636fd0 is the md5 hash.//go:generate ./fetch_mysql.sh mysql-8.0.28-macos11-arm64.tar.gz f1943053b12428e4c0e4ed309a636fd0-//go:embed mysql-8.0.28-macos11-arm64.tar.gz// To use this package in testing, download the MySQL binary first:// go generate -tags mysql ./...+//+//go:embed mysql-8.0.28-macos11-arm64.tar.gzvar resources embed.FSdiff --git a/resources/mysql/resources_linux.go b/resources/mysql/resources_linux.goindex 5ac9c6961a..de1f209908 100644--- a/resources/mysql/resources_linux.go+++ b/resources/mysql/resources_linux.go@@ -8,7 +8,8 @@ import "embed"// 55a7759e25cc527416150c8181ce3f6d is the md5 hash.//go:generate ./fetch_mysql.sh mysql-8.0.28-linux-glibc2.17-x86_64-minimal.tar.xz 55a7759e25cc527416150c8181ce3f6d-//go:embed mysql-8.0.28-linux-glibc2.17-x86_64-minimal.tar.xz// To use this package in testing, download the MySQL binary first:// go generate -tags mysql ./...+//+//go:embed mysql-8.0.28-linux-glibc2.17-x86_64-minimal.tar.xzvar resources embed.FSdiff --git a/resources/mysqlutil/mysqlutil.go b/resources/mysqlutil/mysqlutil.goindex b0e52ecbd6..3b0bf483ba 100644--- a/resources/mysqlutil/mysqlutil.go+++ b/resources/mysqlutil/mysqlutil.go@@ -1,3 +1,4 @@+// Package mysqlutil provides the resource for MySQL utility packages.package mysqlutilimport (@@ -43,7 +44,7 @@ func GetPath(binName binaryName, resourceDir string) string {return "UNKNOWN_BINARY"}-// getExecutableVersion returns the raw output of ``binName` -V`.+// getExecutableVersion returns the raw output of "binName -V".func getExecutableVersion(binName binaryName, resourceDir string) (string, error) {var cmd *exec.Cmdvar version bytes.Bufferdiff --git a/resources/postgres/postgres.go b/resources/postgres/postgres.goindex ed806db9c9..b23fe32daa 100644--- a/resources/postgres/postgres.go+++ b/resources/postgres/postgres.go@@ -1,3 +1,4 @@+// Package postgres provides the resource for PostgreSQL server and utility packages.package postgresimport (diff --git a/resources/utils/extract.go b/resources/utils/extract.goindex 059cc9de76..f4ac42e419 100644--- a/resources/utils/extract.go+++ b/resources/utils/extract.go@@ -1,3 +1,4 @@+// Package utils provides the library for installing resources..package utilsimport (diff --git a/server/anomaly_scanner.go b/server/anomaly_scanner.goindex 2384d3605f..f47d7de9f7 100644--- a/server/anomaly_scanner.go+++ b/server/anomaly_scanner.go@@ -280,11 +280,11 @@ func (s *AnomalyScanner) checkDatabaseAnomaly(ctx context.Context, instance *apizap.String("database", database.Name),zap.String("type", string(api.AnomalyDatabaseSchemaDrift)),zap.Error(err))- goto SchemaDriftEnd+ return}// Skip drift check if migration schema is not ready (we have instance anomaly to cover that)if setup {- goto SchemaDriftEnd+ return}var schemaBuf bytes.Bufferif _, err := driver.Dump(ctx, database.Name, &schemaBuf, true /*schemaOnly*/); err != nil {@@ -301,7 +301,7 @@ func (s *AnomalyScanner) checkDatabaseAnomaly(ctx context.Context, instance *apizap.String("type", string(api.AnomalyDatabaseSchemaDrift)),zap.Error(err))}- goto SchemaDriftEnd+ return}limit := 1list, err := driver.FindMigrationHistoryList(ctx, &db.MigrationHistoryFind{@@ -314,7 +314,7 @@ func (s *AnomalyScanner) checkDatabaseAnomaly(ctx context.Context, instance *apizap.String("database", database.Name),zap.String("type", string(api.AnomalyDatabaseSchemaDrift)),zap.Error(err))- goto SchemaDriftEnd+ return}if len(list) > 0 {if list[0].Schema != schemaBuf.String() {@@ -360,7 +360,6 @@ func (s *AnomalyScanner) checkDatabaseAnomaly(ctx context.Context, instance *api}}}-SchemaDriftEnd:}func (s *AnomalyScanner) checkBackupAnomaly(ctx context.Context, instance *api.Instance, database *api.Database, policyMap map[int]*api.BackupPlanPolicy) {diff --git a/server/server.go b/server/server.goindex f93c906515..01c3c17814 100644--- a/server/server.go+++ b/server/server.go@@ -1,3 +1,4 @@+// Package server implements the API server for Bytebase.package serverimport (diff --git a/server/task_scheduler.go b/server/task_scheduler.goindex 86e3f6a2ca..9b3ed58905 100644--- a/server/task_scheduler.go+++ b/server/task_scheduler.go@@ -367,9 +367,9 @@ func (s *TaskScheduler) canSchedule(ctx context.Context, task *api.Task) (bool,}// ScheduleIfNeeded schedules the task if-// 1. its required check does not contain error in the latest run.-// 2. it has no blocking tasks.-// 3. it has passed the earliest allowed time.+// 1. its required check does not contain error in the latest run.+// 2. it has no blocking tasks.+// 3. it has passed the earliest allowed time.func (s *TaskScheduler) ScheduleIfNeeded(ctx context.Context, task *api.Task) (*api.Task, error) {schedule, err := s.canSchedule(ctx, task)if err != nil {diff --git a/sql-server/server.go b/sql-server/server.goindex b6424ece5f..d68f63972d 100644--- a/sql-server/server.go+++ b/sql-server/server.go@@ -1,3 +1,4 @@+// Package sqlserver is the binary for SQL review server.package sqlserverimport (diff --git a/store/extension.go b/store/extension.goindex 70d744b441..21aec98071 100644--- a/store/extension.go+++ b/store/extension.go@@ -112,9 +112,7 @@ func (s *Store) SetDBExtensionList(ctx context.Context, schema *db.Schema, databreturn nil}-//// private functions.-//func generateDBExtensionActions(oldDBExtensionRawList []*dbExtensionRaw, extensionList []db.Extension, databaseID int) ([]*api.DBExtensionDelete, []*api.DBExtensionCreate) {var newDBExtensionList []*api.DBExtensionCreatefor _, dbExtension := range extensionList {diff --git a/store/store.go b/store/store.goindex e1e0868cf6..66bf18a789 100644--- a/store/store.go+++ b/store/store.go@@ -1,3 +1,4 @@+// Package store is the implementation for managing Bytebase's own metadata in a PostgreSQL database.package storeimport (diff --git a/store/view.go b/store/view.goindex 068c2d13bf..5d92d6aed3 100644--- a/store/view.go+++ b/store/view.go@@ -105,9 +105,7 @@ func (s *Store) SetViewList(ctx context.Context, schema *db.Schema, databaseID ireturn nil}-//// private functions.-//func generateViewActions(oldViewRawList []*viewRaw, viewList []db.View, databaseID int) ([]*api.ViewDelete, []*api.ViewCreate) {var viewCreateList []*api.ViewCreatefor _, view := range viewList {diff --git a/tests/fake/docs.go b/tests/fake/docs.gonew file mode 100644index 0000000000..631a05ab95--- /dev/null+++ b/tests/fake/docs.go@@ -0,0 +1,2 @@+// Package fake provides the fake implementation for several dependency services.+package fakediff --git a/tests/schema_update_test.go b/tests/schema_update_test.goindex c5e73950da..52409227e7 100644--- a/tests/schema_update_test.go+++ b/tests/schema_update_test.go@@ -351,7 +351,9 @@ func TestVCS(t *testing.T) {ctl := &controller{}err := ctl.StartServer(ctx, t.TempDir(), test.vcsProviderCreator, getTestPort(t.Name()))a.NoError(err)- defer func() { _ = ctl.Close(ctx) }()+ defer func() {+ _ = ctl.Close(ctx)+ }()err = ctl.Login()a.NoError(err)diff --git a/tests/sheet_vcs_test.go b/tests/sheet_vcs_test.goindex 8233813548..247ef59e0e 100644--- a/tests/sheet_vcs_test.go+++ b/tests/sheet_vcs_test.go@@ -44,7 +44,9 @@ func TestSheetVCS(t *testing.T) {ctl := &controller{}err := ctl.StartServer(ctx, t.TempDir(), test.vcsProviderCreator, getTestPort(t.Name()))a.NoError(err)- defer func() { _ = ctl.Close(ctx) }()+ defer func() {+ _ = ctl.Close(ctx)+ }()err = ctl.Login()a.NoError(err)diff --git a/tests/tenant_test.go b/tests/tenant_test.goindex 556fcf77e6..9fdaa8da23 100644--- a/tests/tenant_test.go+++ b/tests/tenant_test.go@@ -281,7 +281,9 @@ func TestTenantVCS(t *testing.T) {ctl := &controller{}err := ctl.StartServer(ctx, t.TempDir(), test.vcsProviderCreator, getTestPort(t.Name()))a.NoError(err)- defer func() { _ = ctl.Close(ctx) }()+ defer func() {+ _ = ctl.Close(ctx)+ }()err = ctl.Login()a.NoError(err)@@ -728,7 +730,9 @@ func TestTenantVCSDatabaseNameTemplate(t *testing.T) {ctl := &controller{}err := ctl.StartServer(ctx, t.TempDir(), fake.NewGitHub, getTestPort(t.Name()))a.NoError(err)- defer func() { _ = ctl.Close(ctx) }()+ defer func() {+ _ = ctl.Close(ctx)+ }()err = ctl.Login()a.NoError(err)diff --git a/tests/tests.go b/tests/tests.goindex 6a8acacc9b..0deaab43e1 100644--- a/tests/tests.go+++ b/tests/tests.go@@ -1,3 +1,4 @@+// Package tests provides integration tests for backend services.package testsimport (