pulumi/pkg/codegen/pcl
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
..
binder.go Type check resource attributes 2022-11-15 18:46:10 -08:00
binder_nodes.go Support a logical name for config vars 2022-11-02 12:39:57 -07:00
binder_resource.go sdk/go: Remove 'nolint' directives from package docs 2023-01-06 09:06:47 -08:00
binder_schema.go Interpret schema.Asset as pcl.AssetOrArchive 2022-12-08 16:00:17 +01:00
binder_schema_test.go Improve error msg for invalid enum values on convert 2022-12-01 15:29:22 -08:00
binder_test.go Remove traverse errors on dynamic types 2022-11-16 14:41:30 -08:00
component.go [codegen] Rename the PCL package. (#8103) 2021-09-29 20:11:56 -07:00
config.go Support a logical name for config vars 2022-11-02 12:39:57 -07:00
diagnostics.go [schema] Add support for on-demand binding. (#9620) 2022-05-23 15:44:35 -07:00
functions.go Fix codegen for __apply functions 2022-09-28 10:32:33 -07:00
intrinsics.go [codegen] Rename the PCL package. (#8103) 2021-09-29 20:11:56 -07:00
invoke.go Revert "Simplified invokes: SDK-gen and program-gen implementation for dotnet and nodejs" 2022-12-20 17:47:29 -08:00
local.go codegen: preserve externally visible names of a resources and outputs (#9464) 2022-04-25 15:07:25 -07:00
output.go codegen: preserve externally visible names of a resources and outputs (#9464) 2022-04-25 15:07:25 -07:00
program.go Make convert's pcl output yaml agnostic 2022-11-08 17:04:51 +00:00
resource.go Accept options.version on pulumi convert (#10456) 2022-08-22 10:36:01 -07:00
rewrite_apply.go ci: gofmt 1.18+ clean 2022-09-21 09:48:39 -07:00
rewrite_apply_test.go sdk/go: Remove 'nolint' directives from package docs 2023-01-06 09:06:47 -08:00
rewrite_convert.go Don't return half-nil fat ptrs from `SyntaxNode()` 2022-12-16 13:37:08 +01:00
rewrite_convert_test.go Fixes panic when generating go from pulumi yaml (#10047) 2022-07-07 13:15:47 -07:00
rewrite_properties.go [codegen] Rename the PCL package. (#8103) 2021-09-29 20:11:56 -07:00
type.go [codegen] simplify opaque types to string newtype (#9770) 2022-06-13 11:13:03 -07:00
utilities.go Revert "Simplified invokes: SDK-gen and program-gen implementation for dotnet and nodejs" 2022-12-20 17:47:29 -08:00