From b54598ddceb2c41a97d20f9412d375505021a9bd Mon Sep 17 00:00:00 2001 From: Will Roden Date: Mon, 23 Oct 2023 13:09:17 -0500 Subject: [PATCH 1/3] Lint godoc comments --- .golangci.yml | 6 ++++++ github/actions_permissions_enterprise.go | 2 +- github/actions_permissions_orgs.go | 2 +- github/codesofconduct.go | 6 ++++-- github/codespaces.go | 2 +- github/emojis.go | 3 ++- github/event_test.go | 2 +- github/event_types.go | 2 +- github/issues.go | 2 +- github/messages.go | 2 +- github/messages_test.go | 2 +- github/meta.go | 10 +++++++--- github/orgs_packages.go | 16 ++++++++-------- github/rate_limit.go | 2 +- github/reactions.go | 2 +- github/repos.go | 3 ++- github/repos_pages.go | 2 +- github/repos_rules.go | 2 +- github/secret_scanning.go | 12 ++++++------ github/users_packages.go | 16 ++++++++-------- github/users_ssh_signing_keys.go | 2 +- 21 files changed, 56 insertions(+), 42 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index d1ec5b11c92..91b45e8a66c 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -22,6 +22,7 @@ linters-settings: # and https://github.com/securego/gosec/issues/1007 - G602 issues: + exclude-use-default: false exclude-rules: - linters: - dupl @@ -38,3 +39,8 @@ issues: # We need to use sha1 for validating signatures - linters: [ gosec ] text: 'G505: Blocklisted import crypto/sha1: weak cryptographic primitive' + + # This is adapted from golangci-lint's default exclusions. It disables linting for error checks on + # os.RemoveAll and any function ending in "Close". + - linters: [ errcheck ] + text: Error return value of .(.*Close|os\.Remove(All)?). is not checked diff --git a/github/actions_permissions_enterprise.go b/github/actions_permissions_enterprise.go index 8311e729438..1d97fc91b4f 100644 --- a/github/actions_permissions_enterprise.go +++ b/github/actions_permissions_enterprise.go @@ -10,7 +10,7 @@ import ( "fmt" ) -// ActionsEnabledOnEnterpriseOrgs represents all the repositories in an enterprise for which Actions is enabled. +// ActionsEnabledOnEnterpriseRepos represents all the repositories in an enterprise for which Actions is enabled. type ActionsEnabledOnEnterpriseRepos struct { TotalCount int `json:"total_count"` Organizations []*Organization `json:"organizations"` diff --git a/github/actions_permissions_orgs.go b/github/actions_permissions_orgs.go index 801f1d97437..d55a2d45a61 100644 --- a/github/actions_permissions_orgs.go +++ b/github/actions_permissions_orgs.go @@ -145,7 +145,7 @@ func (s *ActionsService) AddEnabledReposInOrg(ctx context.Context, owner string, return resp, nil } -// RemoveEnabledRepoInOrg removes a single repository from the list of enabled repos for GitHub Actions in an organization. +// RemoveEnabledReposInOrg removes a single repository from the list of enabled repos for GitHub Actions in an organization. // // GitHub API docs: https://docs.github.com/en/rest/actions/permissions#disable-a-selected-repository-for-github-actions-in-an-organization func (s *ActionsService) RemoveEnabledReposInOrg(ctx context.Context, owner string, repositoryID int64) (*Response, error) { diff --git a/github/codesofconduct.go b/github/codesofconduct.go index 4318ba56d2c..11e1fb38df0 100644 --- a/github/codesofconduct.go +++ b/github/codesofconduct.go @@ -46,7 +46,8 @@ func (s *CodesOfConductService) List(ctx context.Context) ([]*CodeOfConduct, *Re return cs, resp, nil } -// ListCodesOfConduct +// ListCodesOfConduct returns all codes of conduct. +// // Deprecated: Use CodesOfConductService.List instead func (c *Client) ListCodesOfConduct(ctx context.Context) ([]*CodeOfConduct, *Response, error) { return c.CodesOfConduct.List(ctx) @@ -74,7 +75,8 @@ func (s *CodesOfConductService) Get(ctx context.Context, key string) (*CodeOfCon return coc, resp, nil } -// GetCodeOfConduct +// GetCodeOfConduct returns an individual code of conduct. +// // Deprecated: Use CodesOfConductService.Get instead func (c *Client) GetCodeOfConduct(ctx context.Context, key string) (*CodeOfConduct, *Response, error) { return c.CodesOfConduct.Get(ctx, key) diff --git a/github/codespaces.go b/github/codespaces.go index cd8b0e5bee5..f2e6a284cf0 100644 --- a/github/codespaces.go +++ b/github/codespaces.go @@ -112,7 +112,7 @@ func (s *CodespacesService) ListInRepo(ctx context.Context, owner, repo string, return codespaces, resp, nil } -// ListOptions represents the options for listing codespaces for a user. +// ListCodespacesOptions represents the options for listing codespaces for a user. type ListCodespacesOptions struct { ListOptions RepositoryID int64 `url:"repository_id,omitempty"` diff --git a/github/emojis.go b/github/emojis.go index 15b57130b3b..5a2c86baa38 100644 --- a/github/emojis.go +++ b/github/emojis.go @@ -30,7 +30,8 @@ func (s *EmojisService) List(ctx context.Context) (map[string]string, *Response, return emoji, resp, nil } -// ListEmojis +// ListEmojis returns the emojis available to use on GitHub. +// // Deprecated: Use EmojisService.List instead func (c *Client) ListEmojis(ctx context.Context) (map[string]string, *Response, error) { return c.Emojis.List(ctx) diff --git a/github/event_test.go b/github/event_test.go index 66a6bcd7e45..090edca4b21 100644 --- a/github/event_test.go +++ b/github/event_test.go @@ -23,7 +23,7 @@ func TestPayload_Panic(t *testing.T) { e.Payload() } -func TestPayload_NoPanic(t *testing.T) { +func TestPayload_NoPanic(_ *testing.T) { name := "UserEvent" body := json.RawMessage("{}") e := &Event{Type: &name, RawPayload: &body} diff --git a/github/event_types.go b/github/event_types.go index e91d22686ff..c270f6bcf0a 100644 --- a/github/event_types.go +++ b/github/event_types.go @@ -1069,7 +1069,7 @@ type ArchivedAt struct { To *Timestamp `json:"to,omitempty"` } -// ProjectsV2 represents an item belonging to a project. +// ProjectV2Item represents an item belonging to a project. type ProjectV2Item struct { ID *int64 `json:"id,omitempty"` NodeID *string `json:"node_id,omitempty"` diff --git a/github/issues.go b/github/issues.go index 42e58a17a8a..44364811d3f 100644 --- a/github/issues.go +++ b/github/issues.go @@ -303,7 +303,7 @@ func (s *IssuesService) Edit(ctx context.Context, owner string, repo string, num return i, resp, nil } -// Remove a milestone from an issue. +// RemoveMilestone removes a milestone from an issue. // // This is a helper method to explicitly update an issue with a `null` milestone, thereby removing it. // diff --git a/github/messages.go b/github/messages.go index c16b6015284..0d9811549c2 100644 --- a/github/messages.go +++ b/github/messages.go @@ -326,7 +326,7 @@ func ParseWebHook(messageType string, payload []byte) (interface{}, error) { return event.ParsePayload() } -// WebhookTypes returns a sorted list of all the known GitHub event type strings +// MessageTypes returns a sorted list of all the known GitHub event type strings // supported by go-github. func MessageTypes() []string { types := make([]string, 0, len(eventTypeMapping)) diff --git a/github/messages_test.go b/github/messages_test.go index 1243d755be8..2c74a2ca32a 100644 --- a/github/messages_test.go +++ b/github/messages_test.go @@ -193,7 +193,7 @@ func TestValidatePayload_NoSecretKey(t *testing.T) { // badReader satisfies io.Reader but always returns an error. type badReader struct{} -func (b *badReader) Read(p []byte) (int, error) { +func (b *badReader) Read(_ []byte) (int, error) { return 0, errors.New("bad reader") } diff --git a/github/meta.go b/github/meta.go index 57fa8ccf588..3e9743b00cb 100644 --- a/github/meta.go +++ b/github/meta.go @@ -87,7 +87,8 @@ func (s *MetaService) Get(ctx context.Context) (*APIMeta, *Response, error) { return meta, resp, nil } -// APIMeta +// APIMeta returns information about GitHub.com. +// // Deprecated: Use MetaService.Get instead. func (c *Client) APIMeta(ctx context.Context) (*APIMeta, *Response, error) { return c.Meta.Get(ctx) @@ -117,7 +118,9 @@ func (s *MetaService) Octocat(ctx context.Context, message string) (string, *Res return buf.String(), resp, nil } -// Octocat +// Octocat returns an ASCII art octocat with the specified message in a speech +// bubble. If message is empty, a random zen phrase is used. +// // Deprecated: Use MetaService.Octocat instead. func (c *Client) Octocat(ctx context.Context, message string) (string, *Response, error) { return c.Meta.Octocat(ctx, message) @@ -143,7 +146,8 @@ func (s *MetaService) Zen(ctx context.Context) (string, *Response, error) { return buf.String(), resp, nil } -// Zen +// Zen returns a random line from The Zen of GitHub. +// // Deprecated: Use MetaService.Zen instead. func (c *Client) Zen(ctx context.Context) (string, *Response, error) { return c.Meta.Zen(ctx) diff --git a/github/orgs_packages.go b/github/orgs_packages.go index 0ae68aaa369..449b3dd3e91 100644 --- a/github/orgs_packages.go +++ b/github/orgs_packages.go @@ -10,7 +10,7 @@ import ( "fmt" ) -// List the packages for an organization. +// ListPackages lists the packages for an organization. // // GitHub API docs: https://docs.github.com/en/rest/packages#list-packages-for-an-organization func (s *OrganizationsService) ListPackages(ctx context.Context, org string, opts *PackageListOptions) ([]*Package, *Response, error) { @@ -34,7 +34,7 @@ func (s *OrganizationsService) ListPackages(ctx context.Context, org string, opt return packages, resp, nil } -// Get a package by name from an organization. +// GetPackage gets a package by name from an organization. // // GitHub API docs: https://docs.github.com/en/rest/packages#get-a-package-for-an-organization func (s *OrganizationsService) GetPackage(ctx context.Context, org, packageType, packageName string) (*Package, *Response, error) { @@ -53,7 +53,7 @@ func (s *OrganizationsService) GetPackage(ctx context.Context, org, packageType, return pack, resp, nil } -// Delete a package from an organization. +// DeletePackage deletes a package from an organization. // // GitHub API docs: https://docs.github.com/en/rest/packages#delete-a-package-for-an-organization func (s *OrganizationsService) DeletePackage(ctx context.Context, org, packageType, packageName string) (*Response, error) { @@ -66,7 +66,7 @@ func (s *OrganizationsService) DeletePackage(ctx context.Context, org, packageTy return s.client.Do(ctx, req, nil) } -// Restore a package to an organization. +// RestorePackage restores a package to an organization. // // GitHub API docs: https://docs.github.com/en/rest/packages#restore-a-package-for-an-organization func (s *OrganizationsService) RestorePackage(ctx context.Context, org, packageType, packageName string) (*Response, error) { @@ -79,7 +79,7 @@ func (s *OrganizationsService) RestorePackage(ctx context.Context, org, packageT return s.client.Do(ctx, req, nil) } -// Get all versions of a package in an organization. +// PackageGetAllVersions gets all versions of a package in an organization. // // GitHub API docs: https://docs.github.com/en/rest/packages#list-package-versions-for-a-package-owned-by-an-organization func (s *OrganizationsService) PackageGetAllVersions(ctx context.Context, org, packageType, packageName string, opts *PackageListOptions) ([]*PackageVersion, *Response, error) { @@ -103,7 +103,7 @@ func (s *OrganizationsService) PackageGetAllVersions(ctx context.Context, org, p return versions, resp, nil } -// Get a specific version of a package in an organization. +// PackageGetVersion gets a specific version of a package in an organization. // // GitHub API docs: https://docs.github.com/en/rest/packages#get-a-package-version-for-an-organization func (s *OrganizationsService) PackageGetVersion(ctx context.Context, org, packageType, packageName string, packageVersionID int64) (*PackageVersion, *Response, error) { @@ -122,7 +122,7 @@ func (s *OrganizationsService) PackageGetVersion(ctx context.Context, org, packa return version, resp, nil } -// Delete a package version from an organization. +// PackageDeleteVersion deletes a package version from an organization. // // GitHub API docs: https://docs.github.com/en/rest/packages#delete-package-version-for-an-organization func (s *OrganizationsService) PackageDeleteVersion(ctx context.Context, org, packageType, packageName string, packageVersionID int64) (*Response, error) { @@ -135,7 +135,7 @@ func (s *OrganizationsService) PackageDeleteVersion(ctx context.Context, org, pa return s.client.Do(ctx, req, nil) } -// Restore a package version to an organization. +// PackageRestoreVersion restores a package version to an organization. // // GitHub API docs: https://docs.github.com/en/rest/packages#restore-package-version-for-an-organization func (s *OrganizationsService) PackageRestoreVersion(ctx context.Context, org, packageType, packageName string, packageVersionID int64) (*Response, error) { diff --git a/github/rate_limit.go b/github/rate_limit.go index 4243a144033..838c3ba7966 100644 --- a/github/rate_limit.go +++ b/github/rate_limit.go @@ -58,7 +58,7 @@ func (r RateLimits) String() string { return Stringify(r) } -// RateLimits returns the rate limits for the current client. +// Get returns the rate limits for the current client. func (s *RateLimitService) Get(ctx context.Context) (*RateLimits, *Response, error) { req, err := s.client.NewRequest("GET", "rate_limit", nil) if err != nil { diff --git a/github/reactions.go b/github/reactions.go index 14d193ae887..f06a8ef3dbc 100644 --- a/github/reactions.go +++ b/github/reactions.go @@ -493,7 +493,7 @@ func (s *ReactionsService) deleteReaction(ctx context.Context, url string) (*Res return s.client.Do(ctx, req, nil) } -// Create a reaction to a release. +// CreateReleaseReaction creates a reaction to a release. // Note that a response with a Status: 200 OK means that you already // added the reaction type to this release. // The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes". diff --git a/github/repos.go b/github/repos.go index f2059926ec8..60ff9b41347 100644 --- a/github/repos.go +++ b/github/repos.go @@ -1153,7 +1153,8 @@ type AllowForcePushes struct { Enabled bool `json:"enabled"` } -// RequiredConversationResolution, if enabled, requires all comments on the pull request to be resolved before it can be merged to a protected branch. +// RequiredConversationResolution requires all comments on the pull request to be resolved before it can be +// merged to a protected branch when enabled. type RequiredConversationResolution struct { Enabled bool `json:"enabled"` } diff --git a/github/repos_pages.go b/github/repos_pages.go index 83075dbdd23..060f6eb8b1d 100644 --- a/github/repos_pages.go +++ b/github/repos_pages.go @@ -286,7 +286,7 @@ func (s *RepositoriesService) RequestPageBuild(ctx context.Context, owner, repo return build, resp, nil } -// GetPagesHealthCheck gets a DNS health check for the CNAME record configured for a repository's GitHub Pages. +// GetPageHealthCheck gets a DNS health check for the CNAME record configured for a repository's GitHub Pages. // // GitHub API docs: https://docs.github.com/en/rest/pages#get-a-dns-health-check-for-github-pages func (s *RepositoriesService) GetPageHealthCheck(ctx context.Context, owner, repo string) (*PagesHealthCheckResponse, *Response, error) { diff --git a/github/repos_rules.go b/github/repos_rules.go index 7f964fe6655..2c24f8c27b3 100644 --- a/github/repos_rules.go +++ b/github/repos_rules.go @@ -48,7 +48,7 @@ type RulesetRepositoryIDsConditionParameters struct { RepositoryIDs []int64 `json:"repository_ids,omitempty"` } -// RulesetCondition represents the conditions object in a ruleset. +// RulesetConditions represents the conditions object in a ruleset. // Set either RepositoryName or RepositoryID, not both. type RulesetConditions struct { RefName *RulesetRefConditionParameters `json:"ref_name,omitempty"` diff --git a/github/secret_scanning.go b/github/secret_scanning.go index 30d3da8ebf8..ddcbfc1b667 100644 --- a/github/secret_scanning.go +++ b/github/secret_scanning.go @@ -90,7 +90,7 @@ type SecretScanningAlertUpdateOptions struct { Resolution *string `json:"resolution,omitempty"` } -// Lists secret scanning alerts for eligible repositories in an enterprise, from newest to oldest. +// ListAlertsForEnterprise lists secret scanning alerts for eligible repositories in an enterprise, from newest to oldest. // // To use this endpoint, you must be a member of the enterprise, and you must use an access token with the repo scope or // security_events scope. Alerts are only returned for organizations in the enterprise for which you are an organization owner or a security manager. @@ -117,7 +117,7 @@ func (s *SecretScanningService) ListAlertsForEnterprise(ctx context.Context, ent return alerts, resp, nil } -// Lists secret scanning alerts for eligible repositories in an organization, from newest to oldest. +// ListAlertsForOrg lists secret scanning alerts for eligible repositories in an organization, from newest to oldest. // // To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with // the repo scope or security_events scope. @@ -144,7 +144,7 @@ func (s *SecretScanningService) ListAlertsForOrg(ctx context.Context, org string return alerts, resp, nil } -// Lists secret scanning alerts for a private repository, from newest to oldest. +// ListAlertsForRepo lists secret scanning alerts for a private repository, from newest to oldest. // // To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with // the repo scope or security_events scope. @@ -171,7 +171,7 @@ func (s *SecretScanningService) ListAlertsForRepo(ctx context.Context, owner, re return alerts, resp, nil } -// Gets a single secret scanning alert detected in a private repository. +// GetAlert gets a single secret scanning alert detected in a private repository. // // To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with // the repo scope or security_events scope. @@ -194,7 +194,7 @@ func (s *SecretScanningService) GetAlert(ctx context.Context, owner, repo string return alert, resp, nil } -// Updates the status of a secret scanning alert in a private repository. +// UpdateAlert updates the status of a secret scanning alert in a private repository. // // To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with // the repo scope or security_events scope. @@ -217,7 +217,7 @@ func (s *SecretScanningService) UpdateAlert(ctx context.Context, owner, repo str return alert, resp, nil } -// Lists all locations for a given secret scanning alert for a private repository. +// ListLocationsForAlert lists all locations for a given secret scanning alert for a private repository. // // To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with // the repo scope or security_events scope. diff --git a/github/users_packages.go b/github/users_packages.go index da04919eccd..c3ffc6ab074 100644 --- a/github/users_packages.go +++ b/github/users_packages.go @@ -10,7 +10,7 @@ import ( "fmt" ) -// List the packages for a user. Passing the empty string for "user" will +// ListPackages lists the packages for a user. Passing the empty string for "user" will // list packages for the authenticated user. // // GitHub API docs: https://docs.github.com/en/rest/packages#list-packages-for-the-authenticated-users-namespace @@ -41,7 +41,7 @@ func (s *UsersService) ListPackages(ctx context.Context, user string, opts *Pack return packages, resp, nil } -// Get a package by name for a user. Passing the empty string for "user" will +// GetPackage gets a package by name for a user. Passing the empty string for "user" will // get the package for the authenticated user. // // GitHub API docs: https://docs.github.com/en/rest/packages#get-a-package-for-the-authenticated-user @@ -68,7 +68,7 @@ func (s *UsersService) GetPackage(ctx context.Context, user, packageType, packag return pack, resp, nil } -// Delete a package from a user. Passing the empty string for "user" will +// DeletePackage deletes a package from a user. Passing the empty string for "user" will // delete the package for the authenticated user. // // GitHub API docs: https://docs.github.com/en/rest/packages#delete-a-package-for-the-authenticated-user @@ -89,7 +89,7 @@ func (s *UsersService) DeletePackage(ctx context.Context, user, packageType, pac return s.client.Do(ctx, req, nil) } -// Restore a package to a user. Passing the empty string for "user" will +// RestorePackage restores a package to a user. Passing the empty string for "user" will // restore the package for the authenticated user. // // GitHub API docs: https://docs.github.com/en/rest/packages#restore-a-package-for-the-authenticated-user @@ -110,7 +110,7 @@ func (s *UsersService) RestorePackage(ctx context.Context, user, packageType, pa return s.client.Do(ctx, req, nil) } -// Get all versions of a package for a user. Passing the empty string for "user" will +// PackageGetAllVersions gets all versions of a package for a user. Passing the empty string for "user" will // get versions for the authenticated user. // // GitHub API docs: https://docs.github.com/en/rest/packages#get-all-package-versions-for-a-package-owned-by-the-authenticated-user @@ -141,7 +141,7 @@ func (s *UsersService) PackageGetAllVersions(ctx context.Context, user, packageT return versions, resp, nil } -// Get a specific version of a package for a user. Passing the empty string for "user" will +// PackageGetVersion gets a specific version of a package for a user. Passing the empty string for "user" will // get the version for the authenticated user. // // GitHub API docs: https://docs.github.com/en/rest/packages#get-a-package-version-for-the-authenticated-user @@ -168,7 +168,7 @@ func (s *UsersService) PackageGetVersion(ctx context.Context, user, packageType, return version, resp, nil } -// Delete a package version for a user. Passing the empty string for "user" will +// PackageDeleteVersion deletes a package version for a user. Passing the empty string for "user" will // delete the version for the authenticated user. // // GitHub API docs: https://docs.github.com/en/rest/packages#delete-a-package-version-for-the-authenticated-user @@ -189,7 +189,7 @@ func (s *UsersService) PackageDeleteVersion(ctx context.Context, user, packageTy return s.client.Do(ctx, req, nil) } -// Restore a package version to a user. Passing the empty string for "user" will +// PackageRestoreVersion restores a package version to a user. Passing the empty string for "user" will // restore the version for the authenticated user. // // GitHub API docs: https://docs.github.com/en/rest/packages#restore-a-package-version-for-the-authenticated-user diff --git a/github/users_ssh_signing_keys.go b/github/users_ssh_signing_keys.go index 567623f8875..23e4c36aea3 100644 --- a/github/users_ssh_signing_keys.go +++ b/github/users_ssh_signing_keys.go @@ -93,7 +93,7 @@ func (s *UsersService) CreateSSHSigningKey(ctx context.Context, key *Key) (*SSHS return k, resp, nil } -// DeleteKey deletes a SSH signing key for the authenticated user. +// DeleteSSHSigningKey deletes a SSH signing key for the authenticated user. // // GitHub API docs: https://docs.github.com/en/rest/users/ssh-signing-keys#delete-an-ssh-signing-key-for-the-authenticated-user func (s *UsersService) DeleteSSHSigningKey(ctx context.Context, id int64) (*Response, error) { From 900fea4b6005f22d4839525c0a4e485e3174397f Mon Sep 17 00:00:00 2001 From: Will Roden Date: Mon, 23 Oct 2023 13:16:41 -0500 Subject: [PATCH 2/3] revert unrelated changes --- github/event_test.go | 2 +- github/messages_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/github/event_test.go b/github/event_test.go index 090edca4b21..66a6bcd7e45 100644 --- a/github/event_test.go +++ b/github/event_test.go @@ -23,7 +23,7 @@ func TestPayload_Panic(t *testing.T) { e.Payload() } -func TestPayload_NoPanic(_ *testing.T) { +func TestPayload_NoPanic(t *testing.T) { name := "UserEvent" body := json.RawMessage("{}") e := &Event{Type: &name, RawPayload: &body} diff --git a/github/messages_test.go b/github/messages_test.go index 2c74a2ca32a..1243d755be8 100644 --- a/github/messages_test.go +++ b/github/messages_test.go @@ -193,7 +193,7 @@ func TestValidatePayload_NoSecretKey(t *testing.T) { // badReader satisfies io.Reader but always returns an error. type badReader struct{} -func (b *badReader) Read(_ []byte) (int, error) { +func (b *badReader) Read(p []byte) (int, error) { return 0, errors.New("bad reader") } From 8d624e39918321c7f8453b73a5033b0f29b29701 Mon Sep 17 00:00:00 2001 From: Will Roden Date: Mon, 23 Oct 2023 14:04:26 -0500 Subject: [PATCH 3/3] fix .golangci.yml --- .golangci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.golangci.yml b/.golangci.yml index 91b45e8a66c..1770bd2e417 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -18,6 +18,8 @@ linters: linters-settings: gosec: excludes: + # duplicates errcheck + - G104 # performance issue: see https://github.com/golangci/golangci-lint/issues/4039 # and https://github.com/securego/gosec/issues/1007 - G602 @@ -44,3 +46,8 @@ issues: # os.RemoveAll and any function ending in "Close". - linters: [ errcheck ] text: Error return value of .(.*Close|os\.Remove(All)?). is not checked + + # We don't care about file inclusion via variable in examples or internal tools. + - linters: [ gosec ] + text: 'G304: Potential file inclusion via variable' + path: '^(example|update-urls)\/'