pulumi/pkg/backend/display
Abhinav Gupta 0bff0b8716 sdk/go: Remove 'nolint' directives from package docs
Go treats comments that match the following regex as directives.

    //[a-z0-9]+:[a-z0-9]

Comments that are directives don't show in an entity's documentation.
5a550b6951 (diff-f56160fd9fcea272966a8a1d692ad9f49206fdd8dbcbfe384865a98cd9bc2749R165)

Our code has `//nolint` directives that now show in the API Reference.
This is because these directives are in one of the following forms,
which don't get this special treatment.

    // nolint:foo
    //nolint: foo

This change fixes all such directives found by the regex:
`// nolint|//nolint: `.
See bottom of commit for command used for the fix.

Verification:
Here's the output of `go doc` on some entities
before and after this change.

Before
```
% go doc github.com/pulumi/pulumi/sdk/v3/go/pulumi | head -n8
package pulumi // import "github.com/pulumi/pulumi/sdk/v3/go/pulumi"

nolint: lll, interfacer

nolint: lll, interfacer

const EnvOrganization = "PULUMI_ORGANIZATION" ...
var ErrPlugins = errors.New("pulumi: plugins requested")
```

After
```
% go doc github.com/pulumi/pulumi/sdk/v3/go/pulumi | head -n8
package pulumi // import "github.com/pulumi/pulumi/sdk/v3/go/pulumi"

const EnvOrganization = "PULUMI_ORGANIZATION" ...
var ErrPlugins = errors.New("pulumi: plugins requested")
func BoolRef(v bool) *bool
func Float64Ref(v float64) *float64
func IntRef(v int) *int
func IsSecret(o Output) bool
```

Before
```
% go doc github.com/pulumi/pulumi/sdk/v3/go/pulumi URN_
package pulumi // import "github.com/pulumi/pulumi/sdk/v3/go/pulumi"

func URN_(o string) ResourceOption
    URN_ is an optional URN of a previously-registered resource of this type to
    read from the engine. nolint: revive
```

After:
```
% go doc github.com/pulumi/pulumi/sdk/v3/go/pulumi URN_
package pulumi // import "github.com/pulumi/pulumi/sdk/v3/go/pulumi"

func URN_(o string) ResourceOption
    URN_ is an optional URN of a previously-registered resource of this type to
    read from the engine.
```

Note that golangci-lint offers a 'nolintlint'  linter
that finds such miuses of nolint,
but it also finds other issues so I've deferred that to a follow up PR.

Resolves #11785

Related: https://github.com/golangci/golangci-lint/issues/892

[git-generate]
FILES=$(mktemp)
rg -l '// nolint|//nolint: ' |
  tee "$FILES" |
  xargs perl -p -i -e '
    s|// nolint|//nolint|g;
    s|//nolint: |//nolint:|g;
  '
rg '.go$' < "$FILES" | xargs gofmt -w -s
2023-01-06 09:06:47 -08:00
..
internal/terminal [display] Hide the cursor in interactive mode. 2022-12-20 10:56:59 -08:00
testdata Update test baselines 2022-12-20 10:27:31 -08:00
diff.go Truncate long stack outputs (#10021) 2022-07-12 11:24:21 -07:00
diff_test.go [cli] Abstract out terminal interactions 2022-11-08 17:13:56 -08:00
display.go [cli] Add a replay-events debug command. (#9271) 2022-04-07 09:03:19 -07:00
doc.go Document Go packages (#6009) 2021-01-11 11:07:59 -07:00
events.go Moving previewDigest to sdk/go/common/display, and exporting it. (#9886) 2022-06-27 09:08:06 -05:00
json.go Add DeletedWith resource option 2022-10-31 12:03:18 +02:00
jsonmessage.go [color] Use graphemes to measure strings. 2022-11-09 08:23:00 -08:00
object_diff.go Truncate long stack outputs (#10021) 2022-07-12 11:24:21 -07:00
options.go [cli] Abstract out terminal interactions 2022-11-08 17:13:56 -08:00
progress.go sdk/go: Remove 'nolint' directives from package docs 2023-01-06 09:06:47 -08:00
progress_test.go [cli] Abstract out terminal interactions 2022-11-08 17:13:56 -08:00
query.go re-enable and color dot spinner for non-interactive mode (#8996) 2022-02-15 14:37:04 -08:00
rows.go Moving previewDigest to sdk/go/common/display, and exporting it. (#9886) 2022-06-27 09:08:06 -05:00
sigint_unix.go [cli] Reimplement the interactive renderer 2022-11-07 22:02:44 -08:00
sigint_windows.go [cli] Reimplement the interactive renderer 2022-11-07 22:02:44 -08:00
tableutil.go [color] Use graphemes to measure strings. 2022-11-09 08:23:00 -08:00
tree.go sdk/go: Remove 'nolint' directives from package docs 2023-01-06 09:06:47 -08:00
watch.go [cli] Add a replay-events debug command. (#9271) 2022-04-07 09:03:19 -07:00