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

+2-2
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

+1-1
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

+1-1
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

+1-1
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

+2-2
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

+1-1
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

+2-2
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

+5-5
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

+2-2
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

+2-2
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,

pkg/golinters/nolintlint/nolintlint.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ func (l Linter) Run(fset *token.FileSet, nodes ...ast.Node) ([]Issue, error) {
199199
position: pos,
200200
}
201201

202-
// check for, report and eliminate leading spaces so we can check for other issues
202+
// check for, report and eliminate leading spaces, so we can check for other issues
203203
if len(leadingSpace) > 0 {
204204
removeWhitespace := &result.Replacement{
205205
Inline: &result.InlineFix{
@@ -281,7 +281,7 @@ func (l Linter) Run(fset *token.FileSet, nodes ...ast.Node) ([]Issue, error) {
281281

282282
if (l.needs&NeedsExplanation) != 0 && (explanation == "" || strings.TrimSpace(explanation) == "//") {
283283
needsExplanation := len(linters) == 0 // if no linters are mentioned, we must have explanation
284-
// otherwise, check if we are excluding all of the mentioned linters
284+
// otherwise, check if we are excluding all the mentioned linters
285285
for _, ll := range linters {
286286
if !l.excludeByLinter[ll] { // if a linter does require explanation
287287
needsExplanation = true

pkg/golinters/revive.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ func reviveToIssue(pass *analysis.Pass, object *jsonObject) goanalysis.Issue {
146146
}
147147

148148
// This function mimics the GetConfig function of revive.
149-
// This allow to get default values and right types.
149+
// This allows to get default values and right types.
150150
// https://github.com/golangci/golangci-lint/issues/1745
151151
// https://github.com/mgechev/revive/blob/389ba853b0b3587f0c3b71b5f0c61ea4e23928ec/config/config.go#L155
152152
func getReviveConfig(cfg *config.ReviveSettings) (*lint.Config, error) {

pkg/lint/load.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func (cl *ContextLoader) buildArgs() []string {
8484
if strings.HasPrefix(arg, ".") || filepath.IsAbs(arg) {
8585
retArgs = append(retArgs, arg)
8686
} else {
87-
// go/packages doesn't work well if we don't have prefix ./ for local packages
87+
// go/packages doesn't work well if we don't have the prefix ./ for local packages
8888
retArgs = append(retArgs, fmt.Sprintf(".%c%s", filepath.Separator, arg))
8989
}
9090
}

pkg/lint/runner.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ func (r *Runner) runLinterSafe(ctx context.Context, lintCtx *linter.Context,
123123
// which affects to the next analysis.
124124
// To avoid this issue, we clear type information from the packages.
125125
// See https://github.com/golangci/golangci-lint/pull/944.
126-
// Currently DoesChangeTypes is true only for `unused`.
126+
// Currently, DoesChangeTypes is true only for `unused`.
127127
lintCtx.ClearTypesInPackages()
128128
}
129129

pkg/logutils/log.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ const (
1717
// Debug messages, write to debug logs only by logutils.Debug.
1818
LogLevelDebug LogLevel = 0
1919

20-
// Information messages, don't write too much messages,
20+
// Information messages, don't write too many messages,
2121
// only useful ones: they are shown when running with -v.
2222
LogLevelInfo LogLevel = 1
2323

24-
// Hidden errors: non critical errors: work can be continued, no need to fail whole program;
24+
// Hidden errors: non-critical errors: work can be continued, no need to fail whole program;
2525
// tests will crash if any warning occurred.
2626
LogLevelWarn LogLevel = 2
2727

pkg/packages/util.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func ExtractErrors(pkg *packages.Package) []packages.Error {
4242
continue
4343
}
4444

45-
// change pos to local file to properly process it by processors (properly read line etc)
45+
// change pos to local file to properly process it by processors (properly read line etc.)
4646
uniqErrors[i].Msg = fmt.Sprintf("%s: %s", uniqErrors[i].Pos, uniqErrors[i].Msg)
4747
uniqErrors[i].Pos = fmt.Sprintf("%s:1", pkg.GoFiles[0])
4848
}
@@ -65,7 +65,7 @@ func extractErrorsImpl(pkg *packages.Package, seenPackages map[*packages.Package
6565
}
6666
seenPackages[pkg] = true
6767

68-
if !pkg.IllTyped { // otherwise it may take hours to traverse all deps many times
68+
if !pkg.IllTyped { // otherwise, it may take hours to traverse all deps many times
6969
return nil
7070
}
7171

pkg/result/processors/nolint.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func (i *ignoredRange) doesMatch(issue *result.Issue) bool {
4646
}
4747

4848
// handle possible unused nolint directives
49-
// nolintlint generates potential issues for every nolint directive and they are filtered out here
49+
// nolintlint generates potential issues for every nolint directive, and they are filtered out here
5050
if issue.FromLinter == golinters.NolintlintName && issue.ExpectNoLint {
5151
if issue.ExpectedNoLintLinter != "" {
5252
return i.matchedIssueFromLinter[issue.ExpectedNoLintLinter]

pkg/result/processors/sort_results.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
)
1010

1111
// Base propose of this functionality to sort results (issues)
12-
// produced by various linters by analyzing code. We achieving this
12+
// produced by various linters by analyzing code. We're achieving this
1313
// by sorting results.Issues using processor step, and chain based
1414
// rules that can compare different properties of the Issues struct.
1515

0 commit comments

Comments
 (0)