copyright: don't skip directories "." or ".." in checkCopyright
The checkCopyright function skips directories with names beginning
with "." (for example ".git"). But TestToolsCopyright invokes
the function on directory "..", which means the test is not checking
anything. To avoid this, make an exception to the "." prefix test
so that "." and ".." will still be checked.
Also add a copyright notice to file gopls/doc/assets/assets.go, so
the TestToolsCopyright test will pass when it's no longer skipping
everything.
Fixes golang/go#68306
Change-Id: I773dd29113b34f79ce33a02cb91a53664d26b3df
Reviewed-on: https://go-review.googlesource.com/c/tools/+/596736
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
diff --git a/copyright/copyright.go b/copyright/copyright.go
index 556c6e4..f5e2de7 100644
--- a/copyright/copyright.go
+++ b/copyright/copyright.go
@@ -24,7 +24,7 @@
}
if d.IsDir() {
// Skip directories like ".git".
- if strings.HasPrefix(d.Name(), ".") {
+ if strings.HasPrefix(d.Name(), ".") && d.Name() != "." && d.Name() != ".." {
return filepath.SkipDir
}
// Skip any directory that starts with an underscore, as the go
diff --git a/gopls/doc/assets/assets.go b/gopls/doc/assets/assets.go
index 6fef4a8..139bd2f 100644
--- a/gopls/doc/assets/assets.go
+++ b/gopls/doc/assets/assets.go
@@ -1,3 +1,7 @@
+// Copyright 2024 The Go 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 assets is an empty package to appease "go test ./...",
// as run by our CI builders, which doesn't like an empty module.
package assets