Skip to content

Commit 99c6516

Browse files
authored
docs: fix grammar issues in comments (#2352)
1 parent ecbb9c4 commit 99c6516

File tree

18 files changed

+30
-30
lines changed

18 files changed

+30
-30
lines changed

internal/cache/cache.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ const (
257257
// and to reduce the amount of disk activity caused by using
258258
// cache entries, used only updates the mtime if the current
259259
// mtime is more than an hour old. This heuristic eliminates
260-
// nearly all of the mtime updates that would otherwise happen,
260+
// nearly all the mtime updates that would otherwise happen,
261261
// while still keeping the mtimes useful for cache trimming.
262262
func (c *Cache) used(file string) error {
263263
info, err := os.Stat(file)
@@ -311,7 +311,7 @@ func (c *Cache) trimSubdir(subdir string, cutoff time.Time) {
311311
// Read all directory entries from subdir before removing
312312
// any files, in case removing files invalidates the file offset
313313
// in the directory scan. Also, ignore error from f.Readdirnames,
314-
// because we don't care about reporting the error and we still
314+
// because we don't care about reporting the error, and we still
315315
// want to process any entries found before the error.
316316
f, err := os.Open(subdir)
317317
if err != nil {

internal/cache/cache_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ func TestCacheTrim(t *testing.T) {
233233
t.Fatalf("second trim did work: %q -> %q", data, data2)
234234
}
235235

236-
// Fast forward and do another trim just before the 5 day cutoff.
236+
// Fast-forward and do another trim just before the 5-day cutoff.
237237
// Note that because of usedQuantum the cutoff is actually 5 days + 1 hour.
238238
// We used c.Get(id) just now, so 5 days later it should still be kept.
239239
// On the other hand almost a full day has gone by since we wrote dummyID(2)

internal/pkgcache/pkgcache.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const (
2626
)
2727

2828
// Cache is a per-package data cache. A cached data is invalidated when
29-
// package or it's dependencies change.
29+
// package, or it's dependencies change.
3030
type Cache struct {
3131
lowLevelCache *cache.Cache
3232
pkgHashes sync.Map

internal/robustio/robustio_flaky.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func retry(f func() (err error, mayRetry bool)) error {
5353

5454
// rename is like os.Rename, but retries ephemeral errors.
5555
//
56-
// On windows it wraps os.Rename, which (as of 2019-06-04) uses MoveFileEx with
56+
// On Windows it wraps os.Rename, which (as of 2019-06-04) uses MoveFileEx with
5757
// MOVEFILE_REPLACE_EXISTING.
5858
//
5959
// Windows also provides a different system call, ReplaceFile,

pkg/commands/run.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ func (e *Executor) initRunConfiguration(cmd *cobra.Command) {
243243

244244
func (e *Executor) getConfigForCommandLine() (*config.Config, error) {
245245
// We use another pflag.FlagSet here to not set `changed` flag
246-
// on cmd.Flags() options. Otherwise string slice options will be duplicated.
246+
// on cmd.Flags() options. Otherwise, string slice options will be duplicated.
247247
fs := pflag.NewFlagSet("config flag set", pflag.ContinueOnError)
248248

249249
var cfg config.Config
@@ -259,7 +259,7 @@ func (e *Executor) getConfigForCommandLine() (*config.Config, error) {
259259
// cfg vs e.cfg.
260260
initRootFlagSet(fs, &cfg, true)
261261

262-
fs.Usage = func() {} // otherwise help text will be printed twice
262+
fs.Usage = func() {} // otherwise, help text will be printed twice
263263
if err := fs.Parse(os.Args); err != nil {
264264
if err == pflag.ErrHelp {
265265
return nil, err

pkg/golinters/goanalysis/runner.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ func (r *runner) prepareAnalysis(pkgs []*packages.Package,
185185
// and analysis-to-analysis (horizontal) dependencies.
186186

187187
// This place is memory-intensive: e.g. Istio project has 120k total actions.
188-
// Therefore optimize it carefully.
188+
// Therefore, optimize it carefully.
189189
markedActions := make(map[actKey]struct{}, len(analyzers)*len(pkgs))
190190
for _, a := range analyzers {
191191
for _, pkg := range pkgs {

pkg/golinters/goanalysis/runner_action.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@ func (act *action) analyze() {
179179

180180
if act.pkg.IllTyped {
181181
// It looks like there should be !pass.Analyzer.RunDespiteErrors
182-
// but govet's cgocall crashes on it. Govet itself contains !pass.Analyzer.RunDespiteErrors condition here
183-
// but it exit before it if packages.Load have failed.
182+
// but govet's cgocall crashes on it. Govet itself contains !pass.Analyzer.RunDespiteErrors condition here,
183+
// but it exits before it if packages.Load have failed.
184184
act.err = errors.Wrap(&IllTypedError{Pkg: act.pkg}, "analysis skipped")
185185
} else {
186186
startedAt = time.Now()

pkg/golinters/goanalysis/runner_loadingpackage.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func (lp *loadingPackage) analyze(loadMode LoadMode, loadSem chan struct{}) {
6161
if err := lp.loadWithFacts(loadMode); err != nil {
6262
werr := errors.Wrapf(err, "failed to load package %s", lp.pkg.Name)
6363
// Don't need to write error to errCh, it will be extracted and reported on another layer.
64-
// Unblock depending actions and propagate error.
64+
// Unblock depending on actions and propagate error.
6565
for _, act := range lp.actions {
6666
close(act.analysisDoneCh)
6767
act.err = werr
@@ -269,16 +269,16 @@ func (lp *loadingPackage) loadImportedPackageWithFacts(loadMode LoadMode) error
269269
// Load package from export data
270270
if loadMode >= LoadModeTypesInfo {
271271
if err := lp.loadFromExportData(); err != nil {
272-
// We asked Go to give us up to date export data, yet
272+
// We asked Go to give us up-to-date export data, yet
273273
// we can't load it. There must be something wrong.
274274
//
275275
// Attempt loading from source. This should fail (because
276276
// otherwise there would be export data); we just want to
277277
// get the compile errors. If loading from source succeeds
278-
// we discard the result, anyway. Otherwise we'll fail
278+
// we discard the result, anyway. Otherwise, we'll fail
279279
// when trying to reload from export data later.
280280

281-
// Otherwise it panics because uses already existing (from exported data) types.
281+
// Otherwise, it panics because uses already existing (from exported data) types.
282282
pkg.Types = types.NewPackage(pkg.PkgPath, pkg.Name)
283283
if srcErr := lp.loadFromSource(loadMode); srcErr != nil {
284284
return srcErr
@@ -311,7 +311,7 @@ func (lp *loadingPackage) loadImportedPackageWithFacts(loadMode LoadMode) error
311311
// Cached facts loading failed: analyze later the action from source. To perform
312312
// the analysis we need to load the package from source code.
313313

314-
// Otherwise it panics because uses already existing (from exported data) types.
314+
// Otherwise, it panics because uses already existing (from exported data) types.
315315
if loadMode >= LoadModeTypesInfo {
316316
pkg.Types = types.NewPackage(pkg.PkgPath, pkg.Name)
317317
}

pkg/golinters/gochecknoglobals.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import (
1010
func NewGochecknoglobals() *goanalysis.Linter {
1111
gochecknoglobals := checknoglobals.Analyzer()
1212

13-
// gochecknoglobals only lints test files if the `-t` flag is passed so we
13+
// gochecknoglobals only lints test files if the `-t` flag is passed, so we
1414
// pass the `t` flag as true to the analyzer before running it. This can be
15-
// turned of by using the regular golangci-lint flags such as `--tests` or
15+
// turned off by using the regular golangci-lint flags such as `--tests` or
1616
// `--skip-files`.
1717
linterConfig := map[string]map[string]interface{}{
1818
gochecknoglobals.Name: {

pkg/golinters/lll.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ func getLLLIssuesForFile(filename string, maxLineLen int, tabSpaces string) ([]r
5151
// we can return this line as a long line instead of returning an error.
5252
// The reason for this change is that this case might happen with autogenerated files
5353
// The go-bindata tool for instance might generate a file with a very long line.
54-
// In this case, as it's a auto generated file, the warning returned by lll will
54+
// In this case, as it's an auto generated file, the warning returned by lll will
5555
// be ignored.
5656
// But if we return a linter error here, and this error happens for an autogenerated
5757
// file the error will be discarded (fine), but all the subsequent errors for lll will
58-
// be discarded for other files and we'll miss legit error.
58+
// be discarded for other files, and we'll miss legit error.
5959
res = append(res, result.Issue{
6060
Pos: token.Position{
6161
Filename: filename,

0 commit comments

Comments
 (0)