From fb972ef2144ec999bb5e1854e18edd7710b2fd72 Mon Sep 17 00:00:00 2001 From: Ludovic Fernandez Date: Thu, 23 Jan 2025 04:25:06 +0100 Subject: [PATCH] chore: Check and fix license headers (#3449) --- .golangci.yml | 12 +++++++++++- github/admin_stats_test.go | 5 +++++ github/enterprise_audit_log_test.go | 2 +- github/gists.go | 2 +- github/orgs_audit_log_test.go | 2 +- github/pulls_reviewers.go | 7 ++----- scrape/apps_test.go | 5 +++++ scrape/example/scrape/main.go | 5 +++++ scrape/forms_test.go | 5 +++++ scrape/scrape_test.go | 5 +++++ 10 files changed, 41 insertions(+), 9 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index fae768c5a57..5c5646983aa 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -11,12 +11,13 @@ linters: - gocritic - godot - gofmt + - goheader - goimports - gosec - misspell - nakedret - - perfsprint - paralleltest + - perfsprint - revive - sliceofpointers - stylecheck @@ -35,6 +36,15 @@ linters-settings: enabled-checks: - commentedOutCode - commentFormatting + goheader: + values: + regexp: + CopyrightDate: "Copyright \\d{4} " + template: |- + {{CopyrightDate}}The go-github AUTHORS. All rights reserved. + + Use of this source code is governed by a BSD-style + license that can be found in the LICENSE file. gosec: excludes: # duplicates errcheck diff --git a/github/admin_stats_test.go b/github/admin_stats_test.go index 63e428bb5fd..2f4ca3ac012 100644 --- a/github/admin_stats_test.go +++ b/github/admin_stats_test.go @@ -1,3 +1,8 @@ +// Copyright 2017 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + package github import ( diff --git a/github/enterprise_audit_log_test.go b/github/enterprise_audit_log_test.go index 08ecd23c996..bc2369090fb 100644 --- a/github/enterprise_audit_log_test.go +++ b/github/enterprise_audit_log_test.go @@ -1,6 +1,6 @@ // Copyright 2021 The go-github AUTHORS. All rights reserved. // -// `Use` of this source code is governed by a BSD-style +// Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package github diff --git a/github/gists.go b/github/gists.go index 08180c6d301..ee4314b986e 100644 --- a/github/gists.go +++ b/github/gists.go @@ -1,6 +1,6 @@ // Copyright 2013 The go-github AUTHORS. All rights reserved. // -// Use of this source code is governed by BSD-style +// Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package github diff --git a/github/orgs_audit_log_test.go b/github/orgs_audit_log_test.go index 3a6cacef45b..f4b617c587b 100644 --- a/github/orgs_audit_log_test.go +++ b/github/orgs_audit_log_test.go @@ -1,6 +1,6 @@ // Copyright 2021 The go-github AUTHORS. All rights reserved. // -// `Use` of this source code is governed by a BSD-style +// Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package github diff --git a/github/pulls_reviewers.go b/github/pulls_reviewers.go index 9dd60ae6888..526047937e3 100644 --- a/github/pulls_reviewers.go +++ b/github/pulls_reviewers.go @@ -85,11 +85,8 @@ func (s *PullRequestsService) ListReviewers(ctx context.Context, owner, repo str func (s *PullRequestsService) RemoveReviewers(ctx context.Context, owner, repo string, number int, reviewers ReviewersRequest) (*Response, error) { // reviewers.Reviewers may be empty if the caller wants to remove teams, but not users. Unlike AddReviewers, // "reviewers" is a required param here. Reference: https://github.com/google/go-github/issues/3336 - removeRequest := removeReviewersRequest{ - NodeID: reviewers.NodeID, - Reviewers: reviewers.Reviewers, - TeamReviewers: reviewers.TeamReviewers, - } + // The type `removeReviewersRequest` is required because the struct tags are different from `ReviewersRequest`. + removeRequest := removeReviewersRequest(reviewers) if removeRequest.Reviewers == nil { // GitHub accepts the empty list, but rejects null. Removing `omitempty` is not enough - we also have to promote nil to []. diff --git a/scrape/apps_test.go b/scrape/apps_test.go index 7e9688e5efb..31db5cc504a 100644 --- a/scrape/apps_test.go +++ b/scrape/apps_test.go @@ -1,3 +1,8 @@ +// Copyright 2013 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + package scrape import ( diff --git a/scrape/example/scrape/main.go b/scrape/example/scrape/main.go index a55b88eb366..febf07cd854 100644 --- a/scrape/example/scrape/main.go +++ b/scrape/example/scrape/main.go @@ -1,3 +1,8 @@ +// Copyright 2019 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + // The scrape tool demonstrates use of the github.com/google/go-github/scrape // package to fetch data from GitHub. The tool lists whether third-party app // restrictions are enabled for an organization, and lists information about diff --git a/scrape/forms_test.go b/scrape/forms_test.go index b10f250127d..0b7a9f9ef1c 100644 --- a/scrape/forms_test.go +++ b/scrape/forms_test.go @@ -1,3 +1,8 @@ +// Copyright 2013 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + package scrape import ( diff --git a/scrape/scrape_test.go b/scrape/scrape_test.go index c31bb8337cd..ca0452374d8 100644 --- a/scrape/scrape_test.go +++ b/scrape/scrape_test.go @@ -1,3 +1,8 @@ +// Copyright 2013 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + package scrape import (